My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and work
for Realtime Embedded AB.
My company
Contact
You are always welcome to contact me
and ask questions or make comments
about my blog.
Now it's time to return to the LCD driver application program again. We will start by running a simulation to find out how everything is connected. Let's use a really simple program.
int main(void) {
XStatus Status; // Initialize the GPIO component Status = XGpio_Initialize(&GpioLCD, GPIO_LCD_DEVICE_ID); if (Status != XST_SUCCESS) return XST_FAILURE; // Set the direction for all bits to be outputs XGpio_SetDataDirection(&GpioLCD, LCD_CHANNEL, 0x00); // Display one character XromWriteData(0x6,0x1);
return XST_SUCCESS; }
Here is the simulation waveform plot showing the GPIO bus connected to the LCD.
From this plot we can find out how the GPIO signals should be connected to the LCD driver. It was not the way we thought. Here is what it should look like.
Register Select 0:Instruction register during write 1:Data for read or write operation
1
AC17
LCD_RW
Read/Write Control 0:Write, LCD accepts data 1:Read, LCD presents data
2
AB17
LCD_DB7
Data Bus bit 7
3
AF12
LDC_DB6
Data Bus bit 6
4
AE12
LCD_DB5
Data Bus bit 5
5
AC10
LCD_DB4
Data Bus bit 4
6
AB10
Editing the user constraints file
We will change the pin mapping in the ETC_system.ucf file.
#### Module LCD_16x2 constraints
NET LCD_16x2_GPIO_IO_pin<0> LOC="AE13"; NET LCD_16x2_GPIO_IO_pin<0> IOSTANDARD = LVCMOS33; NET LCD_16x2_GPIO_IO_pin<0> PULLDOWN; NET LCD_16x2_GPIO_IO_pin<0> TIG; NET LCD_16x2_GPIO_IO_pin<1> LOC=AC17; NET LCD_16x2_GPIO_IO_pin<1> IOSTANDARD = LVCMOS33; NET LCD_16x2_GPIO_IO_pin<1> PULLDOWN; NET LCD_16x2_GPIO_IO_pin<1> TIG; NET LCD_16x2_GPIO_IO_pin<2> LOC=AB17; NET LCD_16x2_GPIO_IO_pin<2> IOSTANDARD = LVCMOS33; NET LCD_16x2_GPIO_IO_pin<2> PULLDOWN; NET LCD_16x2_GPIO_IO_pin<2> TIG; NET LCD_16x2_GPIO_IO_pin<3> LOC=AF12; NET LCD_16x2_GPIO_IO_pin<3> IOSTANDARD = LVCMOS33; NET LCD_16x2_GPIO_IO_pin<3> PULLDOWN; NET LCD_16x2_GPIO_IO_pin<3> TIG; NET LCD_16x2_GPIO_IO_pin<4> LOC=AE12; NET LCD_16x2_GPIO_IO_pin<4> IOSTANDARD = LVCMOS33; NET LCD_16x2_GPIO_IO_pin<4> PULLDOWN; NET LCD_16x2_GPIO_IO_pin<4> TIG; NET LCD_16x2_GPIO_IO_pin<5> LOC=AC10; NET LCD_16x2_GPIO_IO_pin<5> IOSTANDARD = LVCMOS33; NET LCD_16x2_GPIO_IO_pin<5> PULLDOWN; NET LCD_16x2_GPIO_IO_pin<5> TIG; NET LCD_16x2_GPIO_IO_pin<6> LOC=AB10; NET LCD_16x2_GPIO_IO_pin<6> IOSTANDARD = LVCMOS33; NET LCD_16x2_GPIO_IO_pin<6> PULLDOWN; NET LCD_16x2_GPIO_IO_pin<6> TIG;
Generate a new bitstream
We use the menu command Hardware->Generate Bitstream in Xilinx Platform Studio to generate a new bitstream.
Device configuration
We use the menu command Device Configuration->Download Bitstream to configure the FPGA.
Application program
Here is our "Hello World" program again.
int main(void) {
XStatus Status; // Initialize the GPIO component Status = XGpio_Initialize(&GpioLCD, GPIO_LCD_DEVICE_ID); if (Status != XST_SUCCESS) return XST_FAILURE; // Set the direction for all bits to be outputs XGpio_SetDataDirection(&GpioLCD,LCD_CHANNEL, 0x00);
We compile and link the program in Xilinx Platform Studio SDK and use the command Device Configuration->Program Hardware to load and execute the program. We keep staring at the LCD display and after a few seconds it displays:
Dissertation Topics June 14, 2011 01:45 PM PDT Internet has given the easiest means to obtain information in the form of websites, forums and blogs.
thesis proposal writing help April 21, 2011 07:26 AM PDT It is so complex and unexciting to flap the book for hours, but with the help of computer, it is trouble-free to do a research.
dissertation writing October 18, 2010 11:35 AM PDT I have been visiting various blogs for my dissertation writing assignment research. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards