ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW Interface for Arduino Discussions

取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 18 条)
9,403 次查看

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

0 项奖励
2 条消息(共 18 条)
5,323 次查看

Or just use three parallel loops

greetings from the Netherlands
0 项奖励
3 条消息(共 18 条)
5,323 次查看

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 项奖励
4 条消息(共 18 条)
5,323 次查看

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 项奖励
5 条消息(共 18 条)
5,323 次查看

This is what I was thinking:

loop_example.png

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

0 项奖励
6 条消息(共 18 条)
5,323 次查看

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 项奖励
7 条消息(共 18 条)
5,323 次查看

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 项奖励
8 条消息(共 18 条)
5,323 次查看

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 项奖励
9 条消息(共 18 条)
5,323 次查看

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 项奖励
10 条消息(共 18 条)
5,323 次查看