Example 1 – Operating alpha-numeric LCD module by using 4-bit interface
The example shows the connection of an alpha-numeric LCD module 2x16 characters to a dsPIC30F microcontroller by using a 4-bit interface. The following code demonstrates usage of the LCD Custom 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 mikroBasic compiler for dsPIC30F microcontrollers. The interconnection of the LCD module and a dsPIC30F device by using a 4-bit interface is shown in Fig. 13-1.
Fig. 13-1 Interconnection of the LCD module and a dsPIC30F device by using a 4-bit interface
dim txt as string
ADPCFG = $FFFF
Lcd_Init(PORTB, 3,2,1,0, PORTD, 0,2,1)
Lcd_Out(1, 1, "mikroElektronika")
Lcd_Out(2, 1, "2x16 LCD Testing")