eduardo de la torre
eduardo de la torre

Reputation: 1

Unable to resolve identifier RBIE and RBIF, any guess?

trying to compile a code but keep giving build failed and checking red flags shows only Unable to resolve identifier in RBIE and RBIF. below is the code i have im using it with a pic18f45k50 with a lcd and 4x4 keyboard try internet but only show the RBIE function and thats all and my teacher is not of much help so im on my own.

#include <xc.h>
#include <stdio.h>
#include <String.h>

#pragma config FOSC = INTOSC_HS
#pragma config WDT = OFF
#pragma config LVP = OFF
#define _XTAL_FREQ 8000000

#define time 10
#define CD 0x01
#define RH 0x02
#define EMS 0x06
#define DC 0x0F
#define DSr 0x1C
#define DSl 0x18
#define FS 0x38
#define RAW1 0x80
#define RAW2 0xC0
#define E LATEbits.LATE0
#define RS LATEbits.LATE1
void settings(void);
void __interrupt() KB(void);
int keyboard(void);
void entrada(void);
void calculo(void);
void dataLCD(void);
void settingsLCD(unsigned char word);
void LCD(unsigned char data);
void writeLCD(unsigned char word);
int i, j, key, keys[4][4] = {
 {7, 8, 9, 15},
 {4, 5, 6, 14},
 {1, 2, 3, 13},
 {10, 0, 11, 12}
};
float numa, numb, operacion, igual, k=0, resultado;
char text[12], text2[12] = {"R= "};
void main(void){
 settings();
 while(1){
 }
}
void settings(void){
 OSCCON = 0X72;
 ADCON1 = 0x0F;
 TRISD = 0;
 LATD = 0;
 TRISE = 0;
 LATE = 0;
 TRISB = 0xF0;
 LATB = 0x0F;
 GIE = 1;
 RBIE = 1;
 RBIF = 0;
 settingsLCD(CD);
 settingsLCD(EMS);
 settingsLCD(DC);
 settingsLCD(FS);
 dataLCD();
}
void settingsLCD(unsigned char word){
 RS = 0;
 LCD(word);
}
void LCD(unsigned char data){
 E = 1; __delay_ms(time);
 LATD = data;
 __delay_ms(time);
 E = 0;
}
void __interrupt() KB(void){
 if (RBIF){
 if ((PORTB & 0xF0) != 0){
 k++;
 calculo();
 if (key == 11 || key == 10) {
 settingsLCD(RAW1 + 11);
 sprintf(text,"%.2f", resultado);
 for (i = 0; i <= strlen(text); i++){
 writeLCD(text[i]); // CAMBIO
 __delay_ms(time);
 }
 }
 LATB = 0xF;
 }
 RBIF = 0;
 }
}
int keyboard(void){
 LATB = 0x01;
 for(i = 0; i <= 3; i++){ //CAMBIO
 if (PORTBbits.RB4){
 j = 0;
 break;
 } else if (PORTBbits.RB5){
 j = 1;
 break;
 } else if (PORTBbits.RB6){
 j = 2;
 break;
 }else if (PORTBbits.RB7){
 j = 3; break;
 }
 LATB = LATB << 1;
 }
 return keys[i][j]; //CAMBIO
}
void entrada(void){
 key = keyboard();
 if (k == 1){
 numa = key;
 } else if (k == 2){
 operacion = key;
 }else if (k == 3){
 numb = key;
 } else if (k == 4){
 igual = k;
 k= 0;
 }
}
void calculo(void){
 entrada();
 if(operacion == 15){
 resultado = numa / numb;
 } else if (operacion == 14){
 resultado = numa * numb;
 } else if (operacion == 13){
 resultado = numa - numb;
 } else if (operacion == 12){
 resultado = numa + numb;
 }
}
void dataLCD(void){
 settingsLCD(RAW1);
 for (i = 0; i<= strlen(text2); i++){
 writeLCD(text2[i]);
 __delay_ms(time);
 }}
void writeLCD(unsigned char word){
 RS = 1;
 LCD(word);
}
#pragma config DEBUG = ON
#pragma config F0SC = INT0SCI0
#pragma config WDTEN = OFF
#pragma config LVP = ON
#pragma config ICPRT = OFF

Upvotes: 0

Views: 97

Answers (1)

Mike
Mike

Reputation: 4288

These bits are not implented in the PIC18F45k50 and they are not defined in the header. You had to change the name in your program:

RBIF -> IOCIF
RBIE -> IOCIE

Look into datasheet section 10.11:

An input change on PORTB<7:4> or PORTC<2:0> sets flag bit, IOCIF of the INTCON register. The interrupt can be enabled/disabled by setting/clearing enable bit, IOCIE of the INTCON register. Pins must also be individually enabled with the IOCB/IOCC register.

Upvotes: 1

Related Questions