cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sharpless512
Visitor
Visitor
8,940 Views
Registered: ‎12-06-2011

Text on second line LCD

Hi ,

 

I have bought the Spartan 3E starter kit because I want to learn VHDL.

 

I'm trying to get text on the lcd, so far it worked. But I don't know how to put text on the second line.

Is there a special code for it?

 

I have studied this pdf file: http://www.cosmiac.org/pdfs/09Tutorial6.pdf

 

UCF file:

---------
NET "clk" LOC = "C9";
NET "reset" LOC = "K17";

NET "SF_CE0" LOC = "D16" | IOSTANDARD = LVCMOS33 | SLEW = SLOW ;

NET "LCD_E" LOC = "M18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
NET "LCD_RS" LOC = "L18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
NET "LCD_RW" LOC = "L17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;

NET "SF_D<0>" LOC = "R15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
NET "SF_D<1>" LOC = "R16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
NET "SF_D<2>" LOC = "P17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
NET "SF_D<3>" LOC = "M15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;

NET "led[0]" LOC = F12;
NET "led[1]" LOC = E12;
NET "led[2]" LOC = E11;
NET "led[3]" LOC = F11;
NET "led[4]" LOC = C11;
NET "led[5]" LOC = D11;
NET "led[6]" LOC = E9;
NET "led[7]" LOC = F9;
--------

 

 

Can you help me?

 

Many thanks.

0 Kudos
7 Replies
bwiec
Xilinx Employee
Xilinx Employee
8,932 Views
Registered: ‎08-02-2011

There is a pointer that you can change manually with a Set DD RAM Address command. Please see the Spartan 3e Users Guide:

 

"Set DD RAM Address
Set the initial DD RAM address.
After this command, all subsequent read or write operations to the display are to or from
DD RAM. The addresses for displayed characters appear in Figure 5-3.
Execution Time: 40 μs"

 

See Figure 5-3 (UG230) for addressing.

www.xilinx.com
0 Kudos
sharpless512
Visitor
Visitor
8,924 Views
Registered: ‎12-06-2011

thank you for your fast reply!

 

But how can you put that in code, please help

Tags (1)
0 Kudos
bwiec
Xilinx Employee
Xilinx Employee
8,922 Views
Registered: ‎08-02-2011

Just add it to your main state machine (looking at the tutorial you are looking at). The timing should be the same as a write command, if I recall correctly.

www.xilinx.com
0 Kudos
eteam00
Professor
Professor
8,913 Views
Registered: ‎07-21-2009

This post might be helpful.

 

-- 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
sharpless512
Visitor
Visitor
8,908 Views
Registered: ‎12-06-2011

So what code (in bits) do I need to send?

Do I need to send that code after each letter? Is that the same code as the letters but other bits?

 

0 Kudos
bwiec
Xilinx Employee
Xilinx Employee
8,905 Views
Registered: ‎08-02-2011

I believe (again, from memory) that the pointer gets incremented (by default) every time you write to it. But notice the address map does not wrap directly... there are some extra addresses on the top line that do not correspond to the display.

 

The bits you need to send depends on what address you want to point to. See TABLE 5-3 for the address mapping and control signals.

www.xilinx.com
0 Kudos
sharpless512
Visitor
Visitor
8,897 Views
Registered: ‎12-06-2011

0x40 is for next line on the lcd, but do I need to write 0100 0000 in the cur_state of the program after you want to write on the second line?

 

How do you update the pointer?

 

still many thanks for your replies!

 

0 Kudos