Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Visitor
neelmehta89
Posts: 7
Registered: ‎04-06-2012
0
Accepted Solution

Display a counter on an LCD

I want to display an internal "counter" to the LCD on the Spartan 3E starter kit. I am currently being able to print a fixed string, and I am familiar with the basic LCD operation.

 

To display a counter, the DB7:DB4 are not fixed but dependent on the counter value. So, instead of going through a "case" and finding out what the counter bit is and then using the corresponding bits from CG-ROM and printing it on the LCD, is there a direct/indirect way to display the counter?

 

Note that I am using verilog as my HDL language and what needs to be printed is a number/counter.

Expert Contributor
eteam00
Posts: 7,505
Registered: ‎07-21-2009
0

Re: Display a counter on an LCD

is there a direct/indirect way to display the counter?

 

Let's assume the counter is 8 bits wide, and you want to display the counter's 8-bit value as 2 hexadecimal (range 0-9 + A-F) characters.

 

  • From Table 4 of the HD44780U data sheet we see that the displayed characters '0'-'9' are represented by character codes 0x30-0x39.
  • From Table 4 of the HD44780U data sheet we see that the displayed characters 'A'-'F' are represented by character codes 0x41-0x46.
  • To each of the 4-bit portions of the 8-bit counter value, add 0x30.  If the result is greater than 0x39, then add another 0x07.
  • The resulting sum is what you should 'send' to the LCD (actually, you are sending it to the HD44780U LCD controller).

Does this make sense?

 

-- Bob Elkind

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
Visitor
neelmehta89
Posts: 7
Registered: ‎04-06-2012
0

Re: Display a counter on an LCD

Makes perfect sense. Thanks.