I am trying to be able to use CAN but having some problems with the basic. Hoping some one
can help.
I have two MCB2100 board from keil with lpc2129 on them.
I am using the LPC_FullCAN from the file section. I am just trying to send a message from
one board to the next, it works fine the first time, after that the board doesn't recieve
them. The sending board does actualy send the message. The problem is on the recievers
side. I don't know if there is a flag that i need to clear or something.
Here is my Code:
#include
/* LPC21xx definitions */
#include "LPC_FullCAN_SW.h"
int main (void) {
int i;
unsigned int kt;
unsigned char qt;
unsigned int LEDvalue = 0x10000000L;
FULLCAN_MSG MsgBuf;
VPBDIV = 1;
// Init Vector Interrupt Controller
VICIntEnClr = 0xFFFFFFFFL; // Disable all Ints
VICIntSelect = 0x00000000L;
// Initialisation of CAN interfaces
// CAN interface 1, use IRQVec0, at 125kbit
FullCAN_Init(1,0,CANBitrate125k_12MHz);
IODIR1 = 0x00FF0000; /* P1.16..23 defined as Outputs */
ADCR = 0x002E0401; /* Setup A/D: 10-bit AIN0 @ 3MHz */
init_serial(); /* Initialize Serial Interface */
for(i = 0; i < 10000000; i++);
// Receive message with ID 102h on CAN 1
FullCAN_SetFilter(1,0x102);
while (1) { /* Loop forever */
// Check if message received on CAN 1
if (FullCAN_PullMessage(1,&MsgBuf))
{
LEDvalue = MsgBuf.DatA;// = 0x00000000L; // all zeros
}
IOSET1 = LEDvalue;
for(i = 0; i < 1000000; i++);
IOCLR1 = LEDvalue;
}
}
thanks
------------------------------------

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )