This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2148 - CAN

Hi,

Am using an LPC2148 controller with the MCP2515 CAN_IC connected via the SPI. With the CAN_IC I'm supposed to read the TX-Control registers and RX-Control registers to set / read the status of the transmissions.

For this I have defined a struct as follows

struct txbNctrl_struct
{ int txpri:2; //0:1 //transmit priority bits int void2:1; //2 int txreq:1; //3 //transmit request status (clear to request message abort) int txerr:1; //4 //transmission error detected int mloa:1; //5 //message lost arbitration int abtf:1; //6 //message was aborted / or transmitted succesfully int void7:1; //7
};

in the main loop, I declare the struct as follows

struct txbNctrl_struct txb0ctrl,txb1ctrl,txb2ctrl; // one for each of the 3 transmit buffers

Now my problem is that, am not able to read the value from the MCP2515 as a whole byte say I get an error "error:incompatible types in assignment" for the following statements

txb0ctrl=mcp2515_read(TXB0CTRL);
txb1ctrl=mcp2515_read(TXB1CTRL);
txb2ctrl=mcp2515_read(TXB2CTRL);

where the TXB0CTRL,TXB1CTRL,TXB2CTRL are the addresses of the respective registers in the CAN_IC.

This code was used successfully used using the PIC microcontrollers and their compilers.

How should I modify my code with regard to Keil gcc compiler?

0