Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

Modifying Nios II Device Drivers?

Altera_Forum
Honored Contributor II
1,191 Views

Hello all... 

 

I would like to create a new version of the altera_avalon_lcd_16207 device driver. I have a 20 character x 4 line display that I would like to use instead of the 16 character x 2 line one that ships with the development board. I have already connected it to the development board and it works but only the first 16 characters of the first 2 lines are active. 

 

I realize I could probably hack the standard driver to make it work but I would rather be able to create an altera_avalon_lcd_20x4 device driver based on the original code. What I need to know is how to go about creating it and getting it to link correctly thru Quartus II and the Nios II IDE. 

 

Any ideas? 

 

Thanks in advance...
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
359 Views

Hello BigGuiness. 

Try this: 

 

1. go to your components folder 

2. make a new folder called altera_avalon_lcd_20x4 and copy the contents of the altera_avalon_lcd_16207 to the new folder. 

3 edit the file called class.ptf in your new directory and change all instances of altera_avalon_lcd_16207 with altera_avalon_lcd_20x4.  

4. save the file and start NIOS II IDE. 

 

You should now have a new component called altera_avalon_lcd_20x4.  

(if it doesn't work make sure the name of the new directory is EXACTLY the same as the new name in the class.ptf). 

 

Now all you need to do is modify the driver ... 

 

Let me know if it works :-)
0 Kudos
Altera_Forum
Honored Contributor II
359 Views

Hello Goon, 

 

If I get a chance I'll try your suggestion. For right now I just hacked the existing driver to make it work. 

 

Just in case anyone wants to do the same here is what I did to support the 20x4 LCD. 

 

In the altera_avalon_lcd_16207\HAL\inc\altera_avalon_lcd_16207.h file change the ALT_LCD_HEIGHT and ALT_LCD_WIDTH# defines to match the actual LCD size. In my case the height is 4 and the width is 20. 

 

In the altera_avalon_lcd_16207\HAL\src\altera_avalon_lcd_16207.c file change the static char colstart[4] values to match the memory addressing for each line of the display. THis information should be found in the datasheet for the display you are using. On the Opterx DMC20481 display I am using these values are 0x00, 0x40, 0x14, 0x54. 

 

I looked over the rest of the HAL code for the LCD and everything else works without changing anything. The display still scrolls long lines (any line over ALT_LCD_WIDTH up to ALT_LCD_VIRTUAL_WIDTH) and it scrolls up as it's supposed to when lines are added to the bottom of the display. 

 

Thanks for the reply.
0 Kudos
Reply