Communication (Read Messages) discrepancy
Posted: Tue 1. Nov 2016, 10:16
Hello
We are using a miniPCIe (2 Channels).
The Card is on Bus 6 (Firmware 1.3.0)
The Development package is PCAN Basic API and development platform is .Net (C#, 4.2)
Somehow, I am not able to read a particular ID. Below is my code
On PCAN View I can see all the 3 messages, but somehow msg.ID = 0x18FF0921 is never read. I put a breakpoint there.
But it never Enters the Else if statement.
All message are on same bus. Is the Code not okay?
We are using a miniPCIe (2 Channels).
The Card is on Bus 6 (Firmware 1.3.0)
The Development package is PCAN Basic API and development platform is .Net (C#, 4.2)
Somehow, I am not able to read a particular ID. Below is my code
Code: Select all
do
{
//TPCANMsg msg = new TPCANMsg();
statusCAN = PCANBasic.Read(channel, out msg, out _timeStamp);
if (statusCAN == TPCANStatus.PCAN_ERROR_OK)
{
if (msg.ID == 0x18FF0221)
{
temp = (TwoBitStates)((msg.DATA[5] & 0x30) >> 4);// 0x30 = 0011 0000
}
else if (msg.ID == 0x18FF0421)
{
temp = msg.DATA[5];
}
else if (msg.ID == 0x18FF0921)
{
temp = msg.DATA[5];
}
else
{ /* ignore other messages*/ }
}
else
{
LogWriter.LogWrite("Component CAN Error in Reading: " + statusCAN.ToString() + _timeStamp.ToString());
}
} while (!Convert.ToBoolean(statusCAN & TPCANStatus.PCAN_ERROR_QRCVEMPTY));
But it never Enters the Else if statement.
All message are on same bus. Is the Code not okay?