Code: Select all
#include "predef.h"
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <netinterface.h>
#include <ucos.h>
#include <string.h>
#include <serial.h>
#include <taskmon.h>
#include <multican.h>
#include <pins.h>
extern "C" {
void UserMain( void *pd );
}
const char *AppName = "CAN Generator (Dev Board)";
#define CAN_MODULE (1)
void UserMain(void *pd) {
InitializeStack();
OSChangePrio( MAIN_PRIO );
EnableAutoUpdate();
EnableTaskMonitor();
Pins[20].function(PIN_20_CAN1_RX );
Pins[22].function(PIN_22_CAN1_TX );
if (MultiCanInit(CAN_MODULE, 250000, 0, 4) == CAN_OK) {
while (1) { // Infinite loop to listen for and send CAN messages
OSTimeDly(2);
char buffer[8];
siprintf(buffer, "%i", Secs);
int status = MultiCanSendMessage(CAN_MODULE, NormToNbId(106), (PBYTE)buffer, strlen(buffer), 50);
iprintf("_%i", status);
}
} else {
iprintf( "CAN init failed\r\n" );
}
}
I did come across this thread, which appears to be similar.
http://forum.embeddedethernet.com/viewt ... f=5&t=1167
That mentions reading the CAN registers, but the example is for flexcan, and I think the multican is some newer version for the 54415. I don't see anything about reading registers in the multican.h file.
Thanks,
Lance