string recognize and led

A

Amit

Hello group,

I'm writing a code to recognize two strings of 0s and 1s base on a
Moore machine. The goal is to wait for two numbers (let's say 75). One
string will represent 7 and the other represents 5.

Let's say:

5= 000010000100
7= 000010000110


Now, when the appropriate string (digit) is recongnized the number
must be displayed on an LED on Altera board (DE2). I understand that
I have to add a mulitplexer to do this but the thing I am not sure
that how can I keep the number (7) intact till recognizing the next
appropriate number (5)? (other numbers must be ignored)

Do I need a latch? if this is right, then can I only simulate it using
if statement?

Regards,
ak
 
K

KJ

Amit said:
Hello group,

I'm writing a code to recognize two strings of 0s and 1s base on a
Moore machine.
Not how I would approach it, but OK.
The goal is to wait for two numbers (let's say 75). One
string will represent 7 and the other represents 5.

Let's say:

5= 000010000100
7= 000010000110


Now, when the appropriate string (digit) is recongnized the number
must be displayed on an LED on Altera board (DE2). I understand that
I have to add a mulitplexer to do this but the thing I am not sure
that how can I keep the number (7) intact till recognizing the next
appropriate number (5)? (other numbers must be ignored)
process(Clock)
begin
if rising_edge(Clock) then
if (Input_String = "000010000100") then
Led_Display <= Whatever you need to display a '5'
elsif (Input_String = "000010000110") then
Led_Display <= Whatever you need to display a '7'
end if;
end if;
end process;
Do I need a latch?
A flip flop(s) to hold the data.
if this is right, then can I only simulate it using
if statement?
Why restrict yourself to only one statement type. Use the appropriate
statements.

KJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top