AlbertHall
- Joined Jun 4, 2014
- 12,347
You are still not clearing RCIF in the interrupt routine. If this interrupt ever happens it will run the interrupt code continuously and never get to the rest of the code.
Yes. But have not connevted anything to RX, so Nothing inerrupts.You are still not clearing RCIF in the interrupt routine. If this interrupt ever happens it will run the interrupt code continuously and never get to the rest of the code.
The RCIF flag is cleared by reading RCREG.You are still not clearing RCIF in the interrupt routine. If this interrupt ever happens it will run the interrupt code continuously and never get to the rest of the code.
But apparently it is irrelevant anyway.The RCIF flag is cleared by reading RCREG.
Been following, but since I don't do much in C it didn't stand out at first. Always use LAT? for outputs and PORT? for inputs when possible. Some older devices only have PORT? so you're stuck with that route.Finaly
Changed RB0 to LATB0 and then it works,
Shades of post #2 !Finaly
Changed RB0 to LATB0 and then it work
Use LAT for writing, use PORT for reading. For PIC's that don't have LAT, you should use a shadow register and write that full byte value to PORT.Been following, but since I don't do much in C it didn't stand out at first. Always use LAT? for outputs and PORT? for inputs when possible. Some older devices only have PORT? so you're stuck with that route.
EUSART1_Write(80); // to indicate it's ex time we are sending.
__delay_ms(100);
EUSART1_Write(hour); // send the Hour // integer
__delay_ms(100);
EUSART1_Write(minut); // send minutes // integer
__delay_ms(100);
EUSART1_Write(second); //send seconds // integer.
__delay_ms(100);
EUSART1_Write(81); // to indicate we have no more.
__delay_ms(100);
void EUSART1_Write(uint8_t txData)
{
while(0 == PIR3bits.TX1IF)
{
}
TX1REG = txData;
}
void __interrupt() myISR(void)
{// things to do
// only interrupt is from RX EUSART
if (RCIF==1)
{
CREN=0;
UART_Buffer=RCREG;
RB4=!RB4; // test only.
DataRecieve=1;
CREN=1;
}
}
Yep, that would work too.Maybe i could "store" the data in EEPROM and then read it out.
void __interrupt() myISR(void)
{// things to do
// only interrupt is from RX EUSART
if (RCIF==1)
{
CREN=0;
eeprom_write(0,RCREG);
eeprom_write(1,44);// 2C Hex , Control value.
RB4=!RB4; // LED Did flash.
CREN=1;
}
}