The example shows the connection of an alpha-numeric LCD module 2x16 characters to a dsPIC30F microcontroller by using an 8-bit interface. The following code demonstrates usage of the LCD 8-bit Library routines. The example covers the initialization of the LCD module and instructions for contolling and writing the module. The realization is carried out by using the mikroPascal compiler for dsPIC30F microcontrollers. The interconnection of the LCD module and a dsPIC30F device by using an 8-bit interface is shown in Fig. 13-2.
Fig. 13-2 Interconnection of the LCD module and a dsPIC30F device by using a 8-bit interface
program LCD8bitTest; var txt : string; begin ADPCFG := $FFFF; // PORTB to be digital Lcd8_Init(PORTB, 7, 6, 5, 4, 3, 2, 1, 0, PORTD, 0, 1, 2); Lcd8_Cmd(LCD_CURSOR_OFF); Lcd8_Cmd(LCD_CLEAR); Lcd8_Out(1, 1, 'mikroElektronika'); Lcd8_Out(2, 1, '2x16 LCD Testing'); end.