I can't show message in lcd when interrups are enabled

Thread Starter

msanthiago

Joined May 25, 2017
3
Hi everyone! I hope someone can helpme with this problem.
I want to use the interruptions RBIE but, it happens that I put in HIGH GIE bit from INTCON register, the lcd does not show the message.
I'm using pic 18f485 and the mikroc compiler.
I have done tests in proteus and is ok but in the protoboard not run.

This is de code that I'm using. (I'm sorry for my english.)

sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
void main( void ){

TRISB=0xFF;

GIE_bit=1;
RBPU_bit=1;
RBIE_bit=1;

CMCON=0b111;
Lcd_Init();
lcd_out(1,1, "hola");

while(1);
}
 

nsaspook

Joined Aug 27, 2009
16,320
Do you have a RBIE interrupt handler that reads portb to clear a mismatch and resets the interrupt flag (RB Port Change Interrupt Flag)?

I would also read portb and clear the RBIF flag before setting RBIE_bit=1; in your code.
 

spinnaker

Joined Oct 29, 2009
7,830
Hi everyone! I hope someone can helpme with this problem.
I want to use the interruptions RBIE but, it happens that I put in HIGH GIE bit from INTCON register, the lcd does not show the message.
I'm using pic 18f485 and the mikroc compiler.
I have done tests in proteus and is ok but in the protoboard not run.

This is de code that I'm using. (I'm sorry for my english.)

sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
void main( void ){

TRISB=0xFF;

GIE_bit=1;
RBPU_bit=1;
RBIE_bit=1;

CMCON=0b111;
Lcd_Init();
lcd_out(1,1, "hola");

while(1);
}
Does the LCD work when interrupts are NOT enabled?
 
Top