Keyboard input help

R

Rishi Dhupar

Guest
Hi,

Trying to figure out how I can concatanate input from a keyboard. I
cannot seem to figure out how I would store the number "12" from
keyboard input. The user presses 1, gets stored somewhere then he
presses 2, then that gets stored somewhere. How can I like put these
together so verilog knows it is "12"?


Basically I am just doing keyboard input to LCD output.
Type in a 3 digit number on KB and press the space key, and it should
print out the number * 2 to the LCD.


Thanks for any help.


Rishi Dhupar
 
Have you written any code that you could offer up for review? Are your
simulations not producing the output you would expect?

If you wish to put multiple values together into one larger word, search the
various verilog websites for "concatenation".



"Rishi Dhupar" <rishid@gmail.com> wrote in message
news:1155521684.727642.32280@h48g2000cwc.googlegroups.com...
Hi,

Trying to figure out how I can concatanate input from a keyboard. I
cannot seem to figure out how I would store the number "12" from
keyboard input. The user presses 1, gets stored somewhere then he
presses 2, then that gets stored somewhere. How can I like put these
together so verilog knows it is "12"?


Basically I am just doing keyboard input to LCD output.
Type in a 3 digit number on KB and press the space key, and it should
print out the number * 2 to the LCD.


Thanks for any help.


Rishi Dhupar
 
Well my professor gave me the keyboard and lcd driver to use.

I just have to make the interface to connect them. The keyboard
driver outputs the 8 bit binary value to which key is pressed.

So for instance I press "4" on the key, my interface would get 00000100
then I press 2, it would get 00000010. So you are saying I need to
concatanate these two? That doesn't make sense, putting them together
wouldn't get me 42.

I would need to get 00101010 (42d) and then I know how to do the rest
from that.

Am I missing something?

Thanks,

Rishi






Rob wrote:
Have you written any code that you could offer up for review? Are your
simulations not producing the output you would expect?

If you wish to put multiple values together into one larger word, search the
various verilog websites for "concatenation".



"Rishi Dhupar" <rishid@gmail.com> wrote in message
news:1155521684.727642.32280@h48g2000cwc.googlegroups.com...
Hi,

Trying to figure out how I can concatanate input from a keyboard. I
cannot seem to figure out how I would store the number "12" from
keyboard input. The user presses 1, gets stored somewhere then he
presses 2, then that gets stored somewhere. How can I like put these
together so verilog knows it is "12"?


Basically I am just doing keyboard input to LCD output.
Type in a 3 digit number on KB and press the space key, and it should
print out the number * 2 to the LCD.


Thanks for any help.


Rishi Dhupar
 
It looks like you're missing the decimal to binary part?
What does the LCD want? Is it going to display a binary
number or decimal? Maybe you don't need to convert to
binary.

For concatenation, you would end up with binary-coded
decimal. If you're only using decimal numbers, look at
the low four bits only of each key-press. So your 42
would turn into 01000010, which is '42' in BCD. Multiplying
by two in BCD is not quite as simple as it would be in binary,
but if the LCD wants to display a decimal number, it is
probably easier than first converting '42' to binary, then
multiplying by two (shift left) and converting back to
decimal.

If you want to convert to binary, the common way it
would be done is to start with zero in an accumulator
and then at each keypress, multiply the accumulator
by 10 and add the new key value. Thus when you
start off, acc is '0' and when you press '4' you get
0 * 10 + 4 = 4. Then you press '2' and get 4 * 10 + 2
= 42. You would then need logic to multiply and
display when the space key is pressed.

Good Luck,
Gabor

Rishi Dhupar wrote:
Well my professor gave me the keyboard and lcd driver to use.

I just have to make the interface to connect them. The keyboard
driver outputs the 8 bit binary value to which key is pressed.

So for instance I press "4" on the key, my interface would get 00000100
then I press 2, it would get 00000010. So you are saying I need to
concatanate these two? That doesn't make sense, putting them together
wouldn't get me 42.

I would need to get 00101010 (42d) and then I know how to do the rest
from that.

Am I missing something?

Thanks,

Rishi






Rob wrote:
Have you written any code that you could offer up for review? Are your
simulations not producing the output you would expect?

If you wish to put multiple values together into one larger word, search the
various verilog websites for "concatenation".



"Rishi Dhupar" <rishid@gmail.com> wrote in message
news:1155521684.727642.32280@h48g2000cwc.googlegroups.com...
Hi,

Trying to figure out how I can concatanate input from a keyboard. I
cannot seem to figure out how I would store the number "12" from
keyboard input. The user presses 1, gets stored somewhere then he
presses 2, then that gets stored somewhere. How can I like put these
together so verilog knows it is "12"?


Basically I am just doing keyboard input to LCD output.
Type in a 3 digit number on KB and press the space key, and it should
print out the number * 2 to the LCD.


Thanks for any help.


Rishi Dhupar
 

Welcome to EDABoard.com

Sponsor

Back
Top