Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Mimicking an event structure in RT?

Hi all,

 

I'm writing code for my CompactRIO 9073 and am familiar with using the state machine and event structures in LabVIEW.

I am using boolean shared variables to send 'commands' to the real-time system, such as 'Start', 'Abort', 'Clear', 'Reset' etc. for data acquisition and other duties. I wanted to use an event structure, monitoring these shared variables in the way I would normally monitor front panel controls, to invoke jobs on the queued state machine whenever a value changes to True. However, event structures are not supported (other than user events) in Real-Time code.

 

Other than polling my shared variables continually, which seems like a waste of CPU, is there a good way to achieve effectively the same code architecture?

 

I'm using LabVIEW 8.6, Win XP Pro. Thanks in advance for all advice 🙂

Message Edited by Thoric on 01-12-2009 11:20 AM
Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 1 of 4
(2,332 Views)

Hi Thoric,

 

Well I guess that runs right up against the problem of having no UI on a real-target.  Ultimatily my suggestion would be one of two suggestions:

1.  Right-click the SV, have it show timeout, and and set the timeout to -1.  Essentially it becomes a blocking SV.

2.  Make more of a command-based architecture.  I would suggest a quick read-up on http://zone.ni.com/devzone/cda/tut/p/id/3098

 

I prefer #2 because ultimatily you have complete control over the communication, but I understand the quick prototyping with SVs.  Also remember that LV programming on RT is similar, but NOT the same.  Front panel objects can be discouraged, and RT FIFOs are the key to determinism.  Have a good one.

Brian K.
Message 2 of 4
(2,304 Views)

Thoric,

 

You might consider creating an additional shared variable that is simply used to indicate when a new 'command' is present.  That way you only need to monitor one variable all the time.  If it goes true, then you know that you need to check the rest of the variables to see what the new 'command' is.

Message 3 of 4
(2,299 Views)

Thoric,

 

I would like to echo Brian K. suggestion that you look at the "Command-based Communication using Simple TCP/IP Messaging"  This is a very good method to mimick event based archetecture in RT.  I highly recommend it. 

 

Steve

 

SteveA
CLD

-------------------------------------
FPGA/RT/PDA/TP/DSC
-------------------------------------
0 Kudos
Message 4 of 4
(2,264 Views)