10-12-2018 02:00 PM
Can someone see what I'm doing wrong in my code? I have two message windows MsgLog1 and MsgLog2. MsgLog2 is a continuous running message. MsgLog1 is a "copy" of MsgLog2. No message in MsgLog1 should be displayed on the first run. Only two consecutive messages of the same type (0 or 1) should be displayed with D/T stamped in MsgLog1. However, sometimes I get two of the same message displayed in MsgLog1 with same D/T but sometimes not. Using Labview 2012 (TestMssg 2012.zip). Adjust the "millseconds wait" seemed to help but not consistent!
Solved! Go to Solution.
10-12-2018 02:58 PM
Is the code I added to your VI more what you want?
10-12-2018 04:04 PM
Thanks for your quick response sir!
What you modified is not quite what I had intended. There's no event structure needed in my application as the boolean is actually a data bit of either '1' or '0'. So I modified my original code with a simulated random '1' or '0' to generate the event. The idea is, if two CONSECUTIVE '0' would technically be displayed on the MsgLog1 (the 3rd one will not) but the time-stamped should be different by at least 1-sec (see the correct.jpg file). The incorrect display is shown in the Incorrect.jpg file. I don't want to control the Wait milliseconds to be able to have this proper display in MsgLog1. If they are identical messages, I don't want to display it a second time. I updated the code V2 in LV2012 version. thanks
10-12-2018 05:17 PM
Try this one. I took the liberty to clean the code up a bit.
10-12-2018 05:30 PM
Here's another version. You will have to put in your logic for counters, red font, etc, but it gets rid of duplicates.
mcduff
10-12-2018 05:33 PM
@mcduff wrote:
Here's another version. You will have to put in your logic for counters, red font, etc, but it gets rid of duplicates.
mcduff
I like your choice to compare the strings better than my choice to use time. However both gives the OP some examples of different ways to approach the problem.
10-12-2018 05:36 PM
I was impressed that you figured out the counter logic and the "matryoshka" cases structures.
mcduff
10-15-2018 09:30 AM
The time comparison to ensure 1 sec in between message as you had implemented worked best. Your code is very clean and easy to read comparing to my original. I also like mcduff's comparing strings approach. In either case, Thank you much for your advice and timely response.