0
Answered

Generic can bus more than 255?

Thanos 5 years ago in IQANdesign updated by Gustav Widén (System support) 5 years ago 2

Hi,

I am new to iqan and I work on a project where I have connected an arduino uno with several sensors on an MC41 / MD3 via generic can bus.

I have managed to transfer correct values for most of the sensors up to number 255 (1byte). i.e temperature, humidity, sound do not need more than 255.

Although, I use an accelerometer /gyroscope where it can go up to +-2000 dps (degrees per second). As I mentioned before I can get correct values up to+-128 dps. 

As a solution I tried to send 2 bytes for the gyro and read 2 bytes in iqan as well. That just changed the scale. i.e -2 dps became -512 dps. Also, I played with less bits in iqan but still the same. I get correct numbers only when using 8bits. 

Is there any way to split the bytes in iqan and read the correct value more than 255?

Any other idea to solve this would be helpful.

Thank you. 

Answered

Sounds like an issue with scaling and value type.

Two approaches exist:

 use a GPIN and set value type signed if the data is sent as 2-byte signed.

take the J1939 approach and send everything as unsigned, and set the same offset on both sending and receiving side. Using JPIN channel:

Either of the two channel types GPIN and JPIN can be connected to the GFIN that reads the Generic CAN frame. It is just two different ways of decoding the data.