The example shows the connection of a «dot-matrix» graphical alpha-numeric LCD module (GLCD) to a dsPIC30F microcontroller. The example covers the initialization of the GLCD, writing text, drawing lines, boxes, and circles. The realization is carried out by using the mikroC compiler for dsPIC30F microcontrollers. The interconnection of the GLCD module and a dsPIC30F device is shown in Fig. 13-3.
#include "bmp1.h" char cArr[20]; char *someText; void Delay2S(){ delay_ms(2000); }//~ void main() { unsigned short ii; unsigned int jj; sometext = cArr; //--- turn off A/D inputs ADPCFG = 0xFFFF; // Init for dsPICPRO3 development system Glcd_Init(&PORTB, 2, &PORTB,3, &PORTB,4, &PORTB,5, &PORTB,7, &PORTB,6, &PORTD); Delay_100ms(); lMainLoop: Glcd_Fill(0x00); Glcd_Image( maska_bmp ); Delay2S(); Glcd_Fill(0x00); Glcd_Circle(63,32, 20, 1); Delay2S(); Glcd_Line(120,1, 5,60, 1); Glcd_Line(12,42, 5,60, 1); Delay2S(); Glcd_Rectangle(12,20, 93,57, 1); Delay2S(); Glcd_Line(120,12, 12,60, 1); Delay2S(); Glcd_H_Line(5,15, 6, 1); Glcd_Line(0,12, 120,60, 1); Glcd_V_Line(7,63, 127, 1); Delay2S(); for (ii = 1; ii <= 10; ii++) Glcd_Circle(63,32, 3*ii, 1); Delay2S(); Glcd_Box(12,20, 70,57, 2); Delay2S(); Glcd_Set_Font(defaultFont, 5,7, 48); someText = "BIG:ONE"; Glcd_Write_Text(someText, 5,3, 2); Delay2S(); someText = "SMALL:NOT:SMALLER"; Glcd_Write_Text(someText, 20,5, 1); Delay2S(); Glcd_Fill(0x00); Glcd_Set_Font(System3x6, 3, 6, 0x20); Glcd_Write_Text(someText, 10,5, 1); Delay2S(); goto lMainLoop; }//~!