Cannot set CANBSEL to CANTFLG on MC9S12G128

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot set CANBSEL to CANTFLG on MC9S12G128

Jump to solution
565 Views
ilya_r
Contributor III


I am trying to send a CAN message but in the debugger the following lines of code are skipped:

 

do {

    CANTBSEL = CANTFLG;

  }while(!CANTBSEL);

 

here is the full function:

 

void CANMsgTX(J1939_MSG *MsgTX)
{
  volatile byte txbuffer;
  while(!CANTFLG)

 
  do  {
    CANTBSEL = CANTFLG;
  }while(!CANTBSEL);

    
  txbuffer = CANTBSEL;

 

  LoadMsgTX(MsgTX);

 

  CANTFLG = txbuffer;
}

 

 

thus CANBSEL and txbuffer stay at 0

Labels (1)
0 Kudos
1 Solution
387 Views
ilya_r
Contributor III

Fixewd the issue:

the following line:

while(!CANTFLG) 

did not have {} after and thus the line following was never called.

View solution in original post

0 Kudos
1 Reply
388 Views
ilya_r
Contributor III

Fixewd the issue:

the following line:

while(!CANTFLG) 

did not have {} after and thus the line following was never called.

0 Kudos