User manual

611
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
GLCD_CS2_Direction : sbit at TRISB5_bit;
GLCD_RS_Direction : sbit at TRISF0_bit;
GLCD_RW_Direction : sbit at TRISF1_bit;
GLCD_EN_Direction : sbit at TRISF4_bit;
GLCD_RST_Direction : sbit at TRISF5_bit;
// End Glcd module connections
// Touch Panel module connections
var DriveA : sbit at LATC13_bit;
DriveB : sbit at LATC14_bit;
DriveA_Direction : sbit at TRISC13_bit;
DriveB_Direction : sbit at TRISC14_bit;
// end Touch Panel module connections
var write_erase : bit;
pen_size : byte;
x_coord, y_coord : word;
write_msg, clear_msg, erase_msg : array[5] of char; // GLCD menu messages
procedure Initialize();
begin
ADPCFG := 0xFF3F; // set AN6 and AN7 channel pins as analog
DriveA_Direction := 0; // Set DriveA pin as output
DriveB_Direction := 0; // Set DriveB pin as output
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0); // Clear GLCD
ADC1_Init(); // Initialize ADC
TP_Init(128, 64, 6, 7); // Initialize touch panel
TP_Set_ADC_Threshold(3900); // Set touch panel ADC threshold
end;
procedure Calibrate();
begin
Glcd_Dot(0,63,1); // Draw bottom left dot
Glcd_Write_Text(‘TOUCH BOTTOM LEFT’,12,3,1);
TP_Calibrate_Bottom_Left(); // Calibration of bottom left corner
Delay_ms(1000);
Glcd_Dot(0,63,0); // Clear bottom left dot
Glcd_Dot(127,0,1); // Draw upper right dot
Glcd_Write_Text(‘ ‘,12,3,1);
Glcd_Write_Text(‘TOUCH UPPER RIGHT’,12,4,1);
TP_Calibrate_Upper_Right(); // Calibration of upper right corner
Delay_ms(1000);
end;
begin
write_msg := ‘WRITE’;
clear_msg := ‘CLEAR’;
erase_msg := ‘ERASE’;