LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event-driven programming in Compactrio

Dear all,

 

is it possible to do event-driven programming under compactrio (real-time project)?

 

I tried on computer level, it works well. Let's say, if value of numeric control is changing, then certain event will be triggered.

 

But when I move to real time project, it does run with no error, but it fails to detect any event.

 

Please, anyone can help me?

 

Thank you... 

0 Kudos
Message 1 of 5
(4,145 Views)

Generally speaking, VI's running on the cRIO are in the Real-Time environment and don't have a "front panel" where the "Events" you are probably talking about are captured. This concept is muddled a bit when running in the development environment where there is a "front panel" displayed on the PC but this is really for debugging purposes (somebody else may be able to explain this better...).

 

At any rate, I believe there is no reason why you can't use the event structure on the cRIO its just that normal "click" and "key" event don't really mean anything.

 

If you want to use the structure you probably have to dive into "dynamic" or "program-driven" events. Search in the examples for "Dynamically Register for Events" to see how these work.

 

Personally, if you are just getting going with the cRIO I would start with a straight forward state machine and work from there.

 

Cheers,

 

 

 

 

- Jolt
Message 2 of 5
(4,120 Views)
I think you are right. Event driven programming in CRio doesn't seem to be a good idea. Thank you for yoyr reply.
0 Kudos
Message 3 of 5
(4,090 Views)

It should probably also be said, as you probably know, in event-driven programming events are detected by the operating system and posted for any program running on the computer to act on. VxWorks, the real-time operating system of cRIO devices, is not nearly as robust as say a windows or mac OS that you may be used to programming in. While I am sure VxWorks would handle it just fine, it may not behave the way you might expect all the time.

 

Someone correct me here if I am wrong, but Real-Time programs tend to need to be more robust and less prone to unexpected behavior than the average program. This is why state-machine program architecture is most recommended for RT because the programmer can easily plan out in advance every possible case the program could be in and handle each case explicitly when programming. I have also heard rumors that sometimes when timed loops are combined with event-driven programming, events can theoretically be missed because the timed loop could take priority over the untimed event structure loop and hog up all the resources for a period of time, causing the event to be missed by the event structure. Such unexpected behavior would typically be intolerable in RT programming and would also be a really tough bug to hunt down.

 

I still have a lot to learn about event-driven programming in LabVIEW though and I feel like I am just scratching the surface.

Message Edited by rex1030 on 04-02-2010 08:58 AM
---------------------------------
[will work for kudos]
0 Kudos
Message 4 of 5
(3,970 Views)

The only Event that will run? is the Timeout-- if you have that case -- Event Structure IS Not supported in NI cRIO.

0 Kudos
Message 5 of 5
(3,181 Views)