View Single Post
  #25   Spotlight this post!  
Unread 02-02-2010, 15:39
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Program Pnuematics

Quote:
Originally Posted by sparks-1784 View Post
Ok. Thanks for the help.

Unfortunately, the more magic that happens 'behind the scenes', the less one is able to understand how things work - especially for debug. I did open 'down' into each vi to try and understand what each was doing. Sometimes the vi's look a bit cryptic to the 'casual observer'.
Thanks again.
Our team is new to LabVIEW this year too.

I think how the "magic" works (Alan please correct this if wrong) is that when the compressor code is initialized in Begin vi, it sets up an event-driven task. This task is triggered by an external hardware interrupt.

So for example, when the pressure sensor detects the compressor pressure has reached a certain level, the pressure sensor sends a discrete signal (perhaps by grounding the line) to one of the IO ports of the cRIO. This IO port is configured to sense this change and interrupt the cRIO processor and run the compressor task mentioned above. The compressor task asserts the cRIO IO that triggers the relay to shut off the compressor.

When the pressure drops below min operating level, the pressure sensor sends another signal (perhaps by un-grounding the line) which generates another interrupt, which runs the compressor task again, which turns the compressor back on.

What I've described above is sometimes referred to as "event-driven programming". You can see why there is no need to put any code in teleop vi, because the task is event-driven and does not need to be "called" periodically.

The teleop vi is also a form of event-driven task, but in this case it is not driven by an external event but rather by an internal clock. Every 20 milliseconds an internal clock in the cRIO generates an interrupt which runs the teleop task one time.

This is probably documented somewhere but I haven't found it yet. If my explanation here is redundant or incorrect I certainly welcome input.

We haven't gotten to the compressor code yet so any info is appreciated.


~