Hi all,
Has anyone had experience with PIC18F25K80 ECAN and MCC?
I'm having trouble understanding CAN and want to make a simple program to transmit a 8 bytes.
I tried reading the datasheet but the examples don't make sense to me so I tried MCC and the below code but the 8 byte sequence is not showing on the oscilloscope.
Can anyone tell me whats wrong, or point me to a basic example please? Thanks.
Has anyone had experience with PIC18F25K80 ECAN and MCC?
I'm having trouble understanding CAN and want to make a simple program to transmit a 8 bytes.
I tried reading the datasheet but the examples don't make sense to me so I tried MCC and the below code but the 8 byte sequence is not showing on the oscilloscope.
Can anyone tell me whats wrong, or point me to a basic example please? Thanks.
Code:
#include "mcc_generated_files/mcc.h"
void main(void)
{
// Initialize the device
SYSTEM_Initialize();
TMR0_Initialize();
TMR0_StartTimer();
while(1)
{
ECAN_Initialize();
uCAN_MSG txMessage;
txMessage.frame.idType = dSTANDARD_CAN_MSG_ID_2_0B;
txMessage.frame.id = 0x100;
txMessage.frame.dlc = 5;
txMessage.frame.data0 = 128;
txMessage.frame.data1 = 64;
txMessage.frame.data2 = 32;
txMessage.frame.data3 = 64;
txMessage.frame.data4 = 128;
txMessage.frame.data5 = 255;
txMessage.frame.data6 = 128;
txMessage.frame.data7 = 64;
CAN_transmit(&txMessage);
}
}