I declared these global variables:
volatile unsigned char BUFFER[7]={0,0,0,0,0,0,0};//to get all data volatile unsigned char *PTR=&BUFFER[0];//points to start address Inside the Microchip PIC interrupt function, the pointer reads the UART register and deference it to BUFFER[] array according to my code:
*PTR=rcreg; PTR++; I then check the data in function main():
for(i=0;i<3;i++){ if(BUFFER[i]==DATA[i]){ k++; if(k==2){LED_On();} } } and set ptr to point at the start address of BUFFER[]
ptr=BUFFER; Question: Is this the best way and correct way to read data in the register? How can I use pointer in interrupt function?
Thank you for your kind attention and help in advance!
for...if...if...on people is no way to ask for help.