LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I do cooperative task scheduling for Arduino

Hi dude,

     I am trying LIFA and so far so good. Since I have limited knowledge of LabVIEW so I have some problem with cooperative task scheduling in LabVIEW. Suppose, a project has three temperature sensors, three relay and three indicators(LED) and the function of the projet is simple high/low temperature sensing. But the hysteresis and delay time have to use for smooth operation of relay during thresholding of setpoint temperature. The detail explanation of process as follow:

1)The whole process takes 1 second to preform

2)There are three tasks, each task take about 333 msec.

3)Each task has a temperature sensor, relay and indicator to perform simple high/low temperature sensing.

4)Timeline is that Task 1 runs at 0 sec, Task 2 runs at 333 msec and Task 3 runs at 667 msec then Task 1 runs at 0 sec again and so on

Thanks,

pak

0 Kudos
Message 1 of 18
(8,536 Views)

You could use a time delay and a conditional block (to choose which sensors to read).

0 Kudos
Message 2 of 18
(4,456 Views)

Or just use three parallel loops

greetings from the Netherlands
0 Kudos
Message 3 of 18
(4,456 Views)

You could use a time delay and a conditional block (to choose which sensors to read).

Any example or hint, please.

Or just use three parallel loops

parallel or cascade blocks is a simple way but accuracy is bad.

8-12-2012 3-04-47 PM.jpg

0 Kudos
Message 4 of 18
(4,456 Views)

The 3 tasks cannot run really parallel because lifa has only one serial line to communicate.

You can however ask for 3 temperatures, calculate the new settings and tranfer the 3settings to th arduino and wait for the rest of the second.

If necessary you can read the temperatures more often and take the mean to get better accuracy.

It is even possible to adapt the arduino software so that there a beter measurement is taken.

greetings from the Netherlands
0 Kudos
Message 5 of 18
(4,456 Views)

This is what I was thinking:

loop_example.png

The cases are 0, 1, and 2.  Put one sensor in each.

0 Kudos
Message 6 of 18
(4,456 Views)

I would read them as soon as possible in case 0

use case 1 for calculating and case 2 for outputting the data

but that is personal.

The first wait of this system is undefined, check description of multiple ms wait.

Mostly shorter so a special frame before the while and the output of wait multiple ms connected to the while to make sure it executes serially.

greetings from the Netherlands
0 Kudos
Message 7 of 18
(4,456 Views)

Albert.Geven wrote:

Mostly shorter so a special frame before the while and the output of wait multiple ms connected to the while to make sure it executes serially.

That doesn't really make much sense.  If you are trying to say that there is no defined data flow for the wait VI then you would be correct.  I did not mention that before because I was just giving a simple example.  To ensure the timing function is executed in the same order every time you would need to put it into a single sequence structure and put some other data through it (data that is needed for the conditional.

0 Kudos
Message 8 of 18
(4,456 Views)

Thanks for reply, Arduino can do interrupt routine and cooperative task alone. I believe it can do more if I use the power of LabVIEW since Arduino is tethered to the computer (LabVIEW). Anyway, I'll go through it.

Best regards,

pak

0 Kudos
Message 9 of 18
(4,456 Views)

LabVIEW cannot utilize interrupts as they were intended unfortunately.

When you say "cooperative tasks" you make it sound more elaborate than your explanations.  Maybe I'm missing something here?  Are you really just referring to sequential code with delays?  Can you post your Arduino code that does what you call "cooperative tasks" please?

0 Kudos
Message 10 of 18
(4,456 Views)