FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm having difficulties getting events to work

Hi all,
 
I'm trying to write a simple temperature controller that reads 8 channels of fieldpoint temperatures every 10 seconds, and then performs a control action (either heat, cool or do nothing) based on these temperatures.  In addition, every two minutes an average of the temperature is written to a text file for storage.  I can get this to work no problem, but I also wanted to add the ability to plot the historic data read from the data files at any time as well.  I thought putting my plotting code into an event structure might be a good way to do things, because otherwise I had to wait until my 10 second wait command completed before the plot would display correctly, and the same thing would happen with my Stop program button.  Putting these commands into an event structure seems to have fixed things in that they happen immediately when I press their control button on the front panel, however it doesn't seem to update my temperature display.
 
I'd appreciate any thoughts on what I'm doing wrong, or where I can look for some more examples on how to use events.  I've tried looking, but I don't seem to be able to frame the right question.  I've attached my code as well.
 
Thanks in advance!
 
Tim
0 Kudos
Message 1 of 2
(3,308 Views)

Hi Tim,

I wasn't able to run your code because I don't have a FieldPoint device set up, but I don't think the event structure is going to remedy the problem that you are trying to fix. The issue is that your main loop is timed to run only once every 10 seconds, and thus any code that you put inside of it (including event code) will only be executed once every 10 seconds. If you want to process other things at a different rate, then you need to build a second parallel loop that is timed to execute at a different rate. In order for both loops to run concurrently, they need to be entirely parallel, which means that there can not be any data dependencies between them. Any data that needs to be transferred between the two loops will need to be transferred by local variable or property node.

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,296 Views)