UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor neelmehta89
Visitor
4,610 Views
Registered: ‎04-06-2012

Display a counter on an LCD

Jump to solution

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.

0 Kudos
1 Solution

Accepted Solutions
Teacher eteam00
Teacher
5,909 Views
Registered: ‎07-21-2009

Re: Display a counter on an LCD

Jump to solution

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.
0 Kudos
2 Replies
Teacher eteam00
Teacher
5,910 Views
Registered: ‎07-21-2009

Re: Display a counter on an LCD

Jump to solution

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.
0 Kudos
Visitor neelmehta89
Visitor
4,603 Views
Registered: ‎04-06-2012

Re: Display a counter on an LCD

Jump to solution

Makes perfect sense. Thanks.

0 Kudos