0
Answered

Newbie On Switching Values

Carl 7 years ago in IQANdesign updated by Ulrik Zakariasson (Software development) 7 years ago 4

Hi Guys,


Newbie here, was CodeSys, now starting IQan.


I have a project where I have two values (Two 5v sensors) operating all the time and I want to send the value of these over can on the same SPN etc but the one to send is requested by another SPN.


So I have sensor A and sensor B. Both use the same SPN 2927.

When SPN 3928 received equals 1, Sensor A value is sent on SPN 2927. When SPN 3928 equals 2, Sensor B value is sent on SPN 2927.

What do I use to set which value is be sent on receiving the SPN?



Cheers,

Answer

Answer

If I understand this correctly, you have two sensor inputs coming in on VIN channels.  You wish to output one sensor value or the other onto the J1939 bus based on the value of a J1939 input parameter.  You can only read SPNs, so if you want to send a J1939 CAN message, you will need to use the JFOUT channel and populate it with JPOUT parameters.  The input to the JPOUT parameter can then be a MATH channel with the appropriate logic to select the desired sensor value.


Answer

If I understand this correctly, you have two sensor inputs coming in on VIN channels.  You wish to output one sensor value or the other onto the J1939 bus based on the value of a J1939 input parameter.  You can only read SPNs, so if you want to send a J1939 CAN message, you will need to use the JFOUT channel and populate it with JPOUT parameters.  The input to the JPOUT parameter can then be a MATH channel with the appropriate logic to select the desired sensor value.


Hi. That's it exactly. What would I use as a function rather than q code?

You have to build the objects and change the drop-down at the bottom to 'Max Of (Absolute)':



If you haven't taken the training classes, I highly recommend it.