Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

nxWriteSignalSinglePoint and nxReadSignalSinglePoint

Hello,

 

I am currently to trying to accomplish (in C): write a signal value to the bus via j1939 then read the value back to verify it was written correctly.  The way I am going about it is: creating a SignalOutSinglePoint session (with the C function "nxCreateSession"), creating a SignalInSinglePoint session (with "nxCreateSession"), updating a value (with "nxWriteSignalSinglePoint"), then reading the value (with "nxReadSignalSinglePoint").  

 

The problem I am running into is that when I read the value, it is not the updated value.  For example, I update the Engine Speed to 2000rpm, when I read the value it is 1800rpm (which is the default value).  But using a bus monitor, I can see that the Engine Speed did in fact update to 2000rpm.  I have tried all kinds of timings and they all produce the same result.  

 

My guess is that because they are two seperate sessions, when I write to the write session, it does not update the read session.  So my two part question is: 1) is my guess correct and 2) is there anyway to merge the two together so that they both contain the same values?

 

Thank you in advance!

0 Kudos
Message 1 of 2
(3,179 Views)

Hello,

While I am not very familiar with J1939 using XNET in C, I think your guess sounds reasonable. Looking around I am wondering if you might need to implement triggering? 

 

It sounds like you are writing to the motor to change the speed, then trying to read the speed of the motor, is that correct? If so, two seperate sessions should be fine. Make sure you are actually reading the sensor value for the motor rather than the value you are setting the motor to. 

 

Aside from that, here is a link to the help for nxCreateSession in case you have not seen it. The help pages for the other functions you are using are linked in this document. 

Aaron Douglass
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,157 Views)