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

TWIN-CAN and dave

Hello,
I used DAVE to get the basic setup for the twin-can module of an XC161.

In the suggested code I found some "funny" lines

#define CAN_TXIPNDL          (*((uword volatile far *) 0x200288))
#define CAN_TXIPNDL_TXIPND0  ((T_Reg16 *) 0x200288)->bit0

if(CAN_TXIPNDL & CAN_TXIPNDL_TXIPND0)   // message object 0 transmit interrupt
{
}

I thought CAN_TXIPNDL_TXIPND0 is already a bit variable. IMHO the boolean expression is nonsense. The following expression should give me the same result:

if(CAN_TXIPNDL_TXIPND0)
{
}

Just to be shure, am I right or not?

Leo

  • My advise would be to check to see if there is an update on the Infineon web site for the Dave plug-in you are using.

    Why, in my opinion both statements are incorrect (unless you have a DPP set to page 0x80). Since you are trying to read a bit from an address that is not near thus incorrect. You need to make that the pointer to the bit is "far", "huge" or "xhuge".

    For example:

    #define CAN_TXIPNDL_TXIPND0  ((T_Reg16 far *) 0x200292)->bit0