Maker Pro
Maker Pro

PIC - Serial Comms

P

paul watson

Jan 1, 1970
0
Hi,

I am currently using a PIC16F877, Hitech Complier, PICDEM 2 PLUS board and
an ICD2 debugger-programmer. I want to send data from my PC to the serial
port of the PICDEM 2 PLUS board via the following code below. The software
works fine if I 'step-thro' the code and it goes into the 'if (RCIF) {'
branch and stores the data sent from the PC. If I switch to 'Run' mode the
software will not enter the 'if (RCIF) {' branch and store the sent data -
why ???

main()

{

serial_init(); // serial port setup

TRISB = 0x00;

PORTB = 0x00;



while(1) {



if (RCIF) {


RB1 = 1;


// serial received

rst = RCSTA; // essential to read this register first !


// check for over-run errors

overflow = sci_CheckOERR();


// check for framing errors

framing = sci_CheckFERR();


// Get 2 Bytes of Information

receive = sci_GetByte();


receiveA = sci_GetByte();


// Need to empty RCREG;

RCREG = 0;


}


}


}



Why is the run mode not working while the step-thro mode for the same
software code fine ??

Thanks for any help

Paul
 
Top