LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

strange send several times

Hello,
i did a program with 2 while loops in parallel in the first there is the aquisition of temperature and in the other there is the send of an email at a special hour. All is good except that the email should send at 11h for example but when i try there are several sent emails at this time. It's strange because i decided to send an email only when the 2 times are equal (or their difference is 0.)
0 Kudos
Message 1 of 5
(2,994 Views)

Hi,

You may consider to post your vi or atleast a jpg picture of the block diagram for us to understand your problem better.

However what I can think is that you may be not considering seconds or milli seconds of the hour to send the email. The loop may be fast enough to send the email few times with in even the same second.

You may consider to have a variable where you store the next sending time with date. So update this variable each time you send the email. So even the time looks exactly 11 hr, the date is different for a second loop and so it will only send one mail.

Hope it helps!

 

0 Kudos
Message 2 of 5
(2,993 Views)
thank you it helps me. As you can see it i consider seconds but i can't for milliseconds.
0 Kudos
Message 3 of 5
(2,989 Views)

So how many times a second do you think the bottom while loop might be capable of executing? The only thing in the loop that will take a little bit of processing time is the email function and if it executes in less that a second, you will get multiple sends. A quick and easy fix (but not all that elegant, perhaps), is to just put a 1 second delay after the email is sent so that when the loop iteratates again, the times will no long be equal.

p.s. Your code for stopping the while loops will not work. Because the Boolean stop button is outside the while loop, it will not be read after the program starts. In order to be read with each iteration, controls have to be inside a loop.

0 Kudos
Message 4 of 5
(2,983 Views)
i did as you said i wait for 1 sec and it works good, so thank you very much for your help.
0 Kudos
Message 5 of 5
(2,971 Views)