LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you write an independantly cycling subroutine?

I have a program that communicates with a micro through a serial port and runs it through a series of tests. The baud rate is very slow (1200 baud - I wasn't kidding!) and I poll several chunks of data each cycle during the testing.

One of the indicators on my front panel is an "Elapsed Time" display. This timer takes several seconds to update - instead of smoothly incrementing one second at a time, it updates every 6-7 seconds and it looks clunky as a result. This is due to the multiple serial communication steps in my program that take time to process.

Is there any way I can put the logic for that timer inside a chunk of code that cycles independantly of the rest of my code so it will increment nicely? This is nothing necessary at all, this is just a purely aesthetical fix I would like to place in my program.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 1 of 18
(3,397 Views)
One of the great features of LabVIEW is data flow processing. As result, you can run multiple loops at the same time. Why don't you put simply your timing stuff in a separate while loop ?

CC
Chilly Charly    (aka CC)
Message 2 of 18
(3,384 Views)
My main program is a large stack of case structures and it takes a few seconds to cycle through the whole thing. If I write a separate while loop, won't the program still have a delay from running through the case structures before it hits that while loop? Can it truly scan each chunk of programming indenpendantly? (I know...put it in your code and find out, spif!)

btw - the big delay is due to the fact that I read and write to several data registers in the micro in each cycle and due to the slow baud rate, every read and write command has a 0.25 delay timer programmed in it. This adds up to several seconds per scan of my program.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 3 of 18
(3,382 Views)
Another btw....every time I see you post on here I get that dang cartoon character Chilly Willy and the book Charlie and the Chocolate Factory stuck in my head!
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 4 of 18
(3,381 Views)
Well, why not trying it on a quick example ?
CC
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 18
(3,377 Views)
I'll try out your suggestion....tomorrow. It's late and my wife just informed me the toilet overflowed again so I have work to do at home now. Why do kids seem to think that flushing toys down the toilet is so dang entertaining???
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 6 of 18
(3,376 Views)

@Spaceman spif wrote:
Another btw....every time I see you post on here I get that dang cartoon character Chilly Willy and the book Charlie and the Chocolate Factory stuck in my head!



😄
Actually, "Chilly" is a typing mistake. My actual "name" is "Chilli", given by friends a day when I confused a piece of carrot with a small chilli pepper...

CC
Chilly Charly    (aka CC)
Message 7 of 18
(3,381 Views)
Since LabVIEW is a dataflow oriented programming language sections of code which are not dependent upon data from other sections of code via data flow will run in parallel (well, at least as nearly to parallel as possible) as chilly charly has suggested. At any time that there is a delay in one loop the other will operate. If you had one loop which was consuming all of the processor time then you might still have a problem. I have not looked at chilly charlys example but I expect that he put a delay timer in the time update loop. Since you only need 1 second resolution you don't need this loop to run as fast as possible and take excessive processor time from your main algorithm. Therefore you need to make sure to include a delay in your program as well.
0 Kudos
Message 8 of 18
(3,354 Views)
Spaceman: Weren't you a kid once? Flushing things down the toilet was very entertaining when I was a kid.
- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 18
(3,345 Views)

@chilly charly wrote:

Actually, "Chilly" is a typing mistake. My actual "name" is "Chilli", given by friends a day when I confused a piece of carrot with a small chilli pepper...

Obviously, you have the wrong icon then... 🙂
Message 10 of 18
(3,339 Views)