Please, somebody should help me on how to display data as a result of processing ISR on the lcd of this picf4550. My interrupts handling seems to respond without lcd but fails whenver the LCD initialization codes and commands are added. The code was written using MikroC for PIC. Please help me....the code is shown below:
// the circuit is also added below
C:
/*
* Project name:
Lcd_Test (Simple demonstration of the LCD Library functions)
* Copyright:
.
* Description:
This is a simple demonstration of LCD library functions and interrupts handling. LCD is first
initialized, then some text is written at the first row.
* Test configuration:
MCU: P18F4550
Oscillator: HS, 08.0000 MHz
Ext. Modules: LCD 2x16
* NOTES:
None.
*/
char *text = "ASPIRE DIG. TECH.";
char *text2 = "Interupted";
int num=0;
void main() {
TRISD=0; // Configure PortD as output port
INTCON=0x10; // Enable INT0
INTCON2=0; // Set Falling Edge Trigger for INT0
TRISC=0;
INTCON.GIE=1; // Enable The Global Interrupt
//interrupts settings
//portD=0;
while(1)
{
//ADCON1 = 0x0F; // Set AN pins to Digital I/O
Lcd_Init(&PORTD); // Lcd_Init_EP4, see Autocomplete
LCD_Cmd(LCD_CLEAR); // Clear display
LCD_Cmd(LCD_CURSOR_OFF); // Turn cursor off
LCD_Out(1,1, text); // Print text to LCD, 1st row, 1st column
Delay_ms(1000);
LCD_Out(2,6,""); // Print text to LCD, 2nd row, 6th column
if (num>=1) {
Delay_ms(1000);
LCD_Cmd(LCD_CLEAR); // Clear display
LCD_Cmd(LCD_CURSOR_OFF);
LCD_Out(2,6, "interrupted");
Delay_ms(2000);
}
else {
LCD_Cmd(LCD_CLEAR); // Clear display
LCD_Cmd(LCD_CURSOR_OFF);
LCD_Out(2,6,"Waiting");
Delay_ms(2000);
}
}
//Program to depict the working of External Interrupt0 of PIC18F4550
}
void interrupt_low(int num) // Interrupt ISR
{
INTCON.INT0IF=0; // Clear the interrupt 0 flag
LATC=~LATC; // Invert (Toggle) the value at PortD
num=num+1;
}