83Views2Replies

Author Options:

PIC18f2450 Answered

Hi,
I am looking how i configure the portB of the pic18f2450 in interruption, read data from RB0 then print each bit in lcd screen

for the moment just to read i have probleme because my program don't enter the interruption
thanks



thanks

Discussions

0
user
nirvan

8 years ago

Hi
this is my programm
#define bufsize 16
char buffer[bufsize];                   /* buffer de reception */
char *ptRD = buffer;                           /* pointeur de lecture */
char *ptWR = buffer;                       /*pointeur d'ecriture dans le buffer*/

//char data[];

//routile d'intéruption


void interrupt_at_high_vector(void)                // reception d'une interruption
{
    while(INTCONbits.RBIF)        //detection
    {    char c;
        c=PORTBbits.RB0;
        *ptWR++ = c;
        }
    INTCONbits.RBIF=0;     }



#pragma code high_vector=0x08
void Vers_INT08(void){
_asm goto interrupt_at_high_vector _endasm
}
#pragma code



void main(void)
{
//TRISAbits.TRISA1=1;
//TRISBbits.TRISB0=1;
INTCONbits.INT0IF=0;
INTCONbits.INT0IE = 1;           // activer irq sur changement RB0
INTCONbits.GIEH = 1;             // activer les interruptions
TRISB=0x01;                          //configure port B en entrée
PORTBbits.INT0=1;

while(1);
return ;
}

HI
i think that there is not an answer for this problem but ok i had resolved the problem it was in the configuration of bits

thanks