From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-8502 problems with reading values on XNET

Hi all.

I have simply program for testing of CAN signals. On port 1 i write some generated values and on port 2 i'am reading same values. I am using Single point reading and writing. 

 

After first write I read only default values. On second read I read the values from the first write, but i need to read the actual values for comparing.

 

Thx for solution.

0 Kudos
Message 1 of 5
(2,857 Views)

Single point session types will provide you with the most recently received value. If no value has been received, single point will return the default value. If two or more frames were received between reads, only the last will be returned and the others will be lost.

 

In order to avoid reading default values you need to do two things. First, you need to explicitly start the input session so that it can receive data before the XNET Read.vi is called. Secondly you need to implement some mechanism, whether it be data flow with error wires, a state machine, or something else, that ensures the XNET Write.vi is called before the XNET Read.

 

If you post some screen shots of your code or attach the VI we can probably provide additional help.

Jeff L
National Instruments
0 Kudos
Message 2 of 5
(2,830 Views)

As JefeL said you'll want to use the right session type and the right way.  Here is a blog post I made discussing the different XNet session types and why you might choose which ones.  Also know you can use multiple sessions at the same time to get the best of all the available session types.

Message 3 of 5
(2,820 Views)

Thx a lot to all.

Finally I'am used frame stream and problem is solved. In my case it doesn't matter which type of session I used.

 

Once again

Thx a lot.

0 Kudos
Message 4 of 5
(2,807 Views)

@kominekp wrote:

In my case it doesn't matter which type of session I used.


It does matter, they function differently and server different purposes.  I'm glad it is working for you but you should research the different session types and understand when to use which one.

0 Kudos
Message 5 of 5
(2,792 Views)