I have a PIC18F4680, and I want to interface with an Ecan module and UART at the same time. I am sending the UART message correctly and reading the CAN bus properly, but when trying to do both things at the same time the microcontroller stops working. Is the PIC18F4680 able to manage both communications without crashing?
If it is not possible to work with both communications at the same time, which microcontroller should I use? The programming code is done for MicroC so I would prefer a microcontroller that is supported by MicroC.
I have tried to simplify the firmware architecture, but still it doesn't work. Here is the code:
Msg_Rcvd = CANRead(&CAN_RxID, data_rx, &rx_DLC, CAN_Rcv_Flags);
id = CAN_RxID;
dato = data_rx;
UART1_Write('$');
UART1_Write(dato[0]);
UART1_Write(dato[1]);
UART1_Write(dato[2]);
UART1_Write(dato[3]);
UART1_Write(dato[4]);
UART1_Write(dato[5]);
UART1_Write(dato[6]);
UART1_Write(dato[7]);
I have saved the values read from the CAN bus in different variables to avoid using both communications at the same time, but it is not working. I am not familiar with interrupts, and I do not know exactly how to use them. Has someone done something similar with interrupts?