FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-14-2006, 04:14 AM
Rishi Dhupar
Guest
 
Posts: n/a
Default Keyboard input help

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

Reply With Quote
  #2 (permalink)  
Old 08-14-2006, 04:50 AM
Rob
Guest
 
Posts: n/a
Default Re: Keyboard input help

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" <[email protected]> wrote in message
news:[email protected] ups.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
>



Reply With Quote
  #3 (permalink)  
Old 08-14-2006, 05:22 AM
Rishi Dhupar
Guest
 
Posts: n/a
Default Re: Keyboard input help

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" <[email protected]> wrote in message
> news:[email protected] ups.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
> >


Reply With Quote
  #4 (permalink)  
Old 08-14-2006, 03:55 PM
gabor
Guest
 
Posts: n/a
Default Re: Keyboard input help

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" <[email protected]> wrote in message
> > news:[email protected] ups.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
> > >


Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HiZ + input prasunp Verilog 4 02-26-2006 10:43 PM
PS/2 keyboard interface light led's tazkhan83 Verilog 0 02-25-2006 12:38 PM
How is the input transition time used in calculating input delays ?? Rajat Mitra Verilog 2 10-13-2005 05:51 AM
Simple PS/2 Keyboard John Verilog 8 06-01-2004 05:43 PM
CRC16 with 4-bit input Jaiphen Verilog 2 02-04-2004 07:09 PM


All times are GMT +1. The time now is 09:56 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved