LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous data acquisition with shared variable

Solved!
Go to solution

Hi,

 

I am basically just trying to get one of the easiest examples of Host/Target communication running but it doesn't seem to work.

 

I created a real-time project with 2 loops using the corresponding interface. The Target VI continuously produces random numbers in a deterministic loop and saves it to a single process shared variable (RT FIFO enabled). In the non-deterministic loop this data is saved to a network shared variable (buffering enabled). The Host VI is supposed to read the data from the network shared variable. What it does when starting Target and Host VI is acquiring 1 random number and holding that value forever instead of continuously acquiring random numbers. Why does that happen?

 

I am using Labview 2009. A picture of the code should be attached to this post.

 

Sincerely,

Thomas

0 Kudos
Message 1 of 6
(2,746 Views)

Hi Thomas,

 

The first thing I would double check is that you are getting the data between the loops using an indicator in the nondeterministic loop. Also, I would simply enable the RT FIFO capability on the Network Published Shared Variable in the deterministic loop. In this situation, LabVIEW will create the nondeterministic loop in the background and pass the data out of the deterministic loop. Lastly, if you could post your VIs to the forum then it will be easier to debug what may be going wrong.

Patrick H | National Instruments | Software Engineer
0 Kudos
Message 2 of 6
(2,712 Views)

Thank you for the input Patrick.


This morning I placed a boolean network variable in the non-deterministic loop to check, if the data is not empty and then it worked. I can't really imagine that this was the sole reason why it didn't work yesterday but I won't complain.So now when I start the target VI it keeps running until i tell it to stop. Yesterday it stopped immediately after starting it. (See attached exampe RT Testprojekt)

But of course I do not want to produce senseless data so I went on and replaced the random data part with some code to get data from a temperature sensor via a CANOpen Module (WINbloc PT100). I added code for initializing CANOpen, creating my SDOs, PDOs and try to read from a PDO in the deterministic loop. Now the same happens that happened yesterday: When I start the target VI, it stops immediately. And it even happens from time to time that I completely lose connection to the target PC and have to reboot it manually. I don't expect anyone to fix the whole CANOpen code (which has probably some mistakes in it) but can you give any indicators why the target VI stops immediately and how I can debug such a piece of code? I'm not sure how to do it since I can not directly access the data on the target PC in the way I could do it on the host PC. (See attached example RT CANOpen Testprojekt)

 

Thanks in advance for any input.

 

Greetings,

Thomas

Download All
0 Kudos
Message 3 of 6
(2,688 Views)
Solution
Accepted by topic author Thomas87

Hey Thomas,

 

I haven’t taken a look at what you have attached just yet but I will later. One thing I did notice from yesterday’s screenshot is that you do not initialize your shared variables. At the beginning of your code go through and write a value to each of the variables such as the stop variable to make sure you start in a state that you expect. Just be sure to enforce data flow so that you know the initialize step will happen first.

Patrick H | National Instruments | Software Engineer
Message 4 of 6
(2,684 Views)

Ok it looks like i got the real-time issues to work by myself by adding code to control the flow of the program and to leave breaks here and there. The CANOpen can initialize. I attached the example, if anyone has similar problems.

 

The next step is to understand mapping and communicating with the SDOs und PDOs in order to receive the sensor data, but I think that doesn't really belong into this thread/topic.

0 Kudos
Message 5 of 6
(2,662 Views)

Hi Thomas,

 

I would recommend posting to the Automotive and Embedded Networks forums so that people the work with this type of hardware and software will see your question.

 

Automotive and Embedded Networks:

http://forums.ni.com/t5/Automotive-and-Embedded-Networks/bd-p/30

 

Patrick H | National Instruments | Software Engineer
0 Kudos
Message 6 of 6
(2,642 Views)