#include \"DSP28_Device.h\"
#define TXCOUNT 10000 // Transmission will take place (TXCOUNT) times..
unsigned int i,j;
long loopcount = 0; // Counts the # of times the loop actually ran
void InitECan(void);
main()
{
/* Initialize the CAN module */
struct ECAN_REGS ECanaShadow;
/* Initialize the CAN module */
InitECan();
/* Write to the MSGID field */
ECanaMboxes.MBOX5.MID.all = 0x9FFFFFFF; // Extended Identifier
/* Begin transmitting */
// while(1) // Uncomment this line for infinite transmissions
for(; // Uncomment this line for finite transmissions
{
ECanaShadow.CANTRS.all = 0;
ECanaShadow.CANTRS.bit.TRS5 = 1; // Set TRS for mailbox under test
ECanaRegs.CANTRS.all = ECanaShadow.CANTRS.all;
while(ECanaRegs.CANTA.bit.TA5 == 0 ) {} // Wait for TA5 bit to be set..
ECanaShadow.CANTA.all = 0;
ECanaShadow.CANTA.bit.TA5 = 1; // Clear TA5
ECanaRegs.CANTA.all = ECanaShadow.CANTA.all;
loopcount ++;
}
}
void InitECan(void)
{
long i;
asm(\" EALLOW\"
SysCtrlRegs.WDCR = 0x006F;
SysCtrlRegs.PCLKCR.all = 0x4000;
SysCtrlRegs.PLLCR= 0x000A;
for(i=0; i<100000; i++) // Delay for PLL to stabilize
{ asm(\" NOP \" }