kennethone
Newbie level 1
DISPic30f4013 Can help
Hi Does nay one have any example code on how to use CAN, I looked at the code at the bottom of post, but I don't understand how to pass teh message pointer. I used
int main(void)
{
int i;
_TRISB8 = 0;
CANMSG testmsg;
/* SENDER
for (i=0;i<8;i++){
testmsg.data=1;
}
while(1){
CanSendMessage(&testmsg);
for(i=0; i<10000; i++){;}
}/**/
//* RECEIVER
while(1){
//TRISB = 0x0000;
//CanReceiveMessage(&testmsg);
if(testmsg.data[1]==1){
_RB8=1; // Turn on pin RB8 if message received data[1] == 1
}
}
/**/
}
but I don't have any idea on how to manipulate the SID or the length fields or even if they need to be manipulated. My code doesn't work.
Hi Does nay one have any example code on how to use CAN, I looked at the code at the bottom of post, but I don't understand how to pass teh message pointer. I used
int main(void)
{
int i;
_TRISB8 = 0;
CANMSG testmsg;
/* SENDER
for (i=0;i<8;i++){
testmsg.data=1;
}
while(1){
CanSendMessage(&testmsg);
for(i=0; i<10000; i++){;}
}/**/
//* RECEIVER
while(1){
//TRISB = 0x0000;
//CanReceiveMessage(&testmsg);
if(testmsg.data[1]==1){
_RB8=1; // Turn on pin RB8 if message received data[1] == 1
}
}
/**/
}
but I don't have any idea on how to manipulate the SID or the length fields or even if they need to be manipulated. My code doesn't work.