LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Driver for Advantech DIO Module

Hello Bong, glad to hear it was useful for you.
That's one of the important points left over: initialization. As the DO is executed only on a data change, at the very beginning of the program you need to synchronize the module and the user interface by issuing a first DO command; for example, if you simply want to preserve the current switch configuration, before the main loop is started you may read a switch value through a local variable and rewrite it to the same switch by means of the Value(Signaling) property.
Another point to be considered in the final application is error handling. So far I have managed only a serial read error, but there may be other problems: for example, the module may not correctly receive the command and return an error message instead of the DI status message. You should be prepared to interpret this error message properly, by not updating the status indicators and possibly turn on an error LED or something similar.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 21 of 29
(1,192 Views)
Hello Paolo,
 
Thanks a lot.
Got your message very clearly about the initialization and error handling.
Thanks...
 
Regards,
0 Kudos
Message 22 of 29
(1,174 Views)

Hello Paolo,

I want to make a few changes on the VI. Instead of making DO Controls as Control Switches, i made them as Indicators which will only be True when the outside process conditions are all true. I made three example just for showing only. I put the first three indicators as case to the event. If i run this VI and simulate a True Condition of the feedbacks, the results are;

- DO Controls LED will update,                                                                                                                                                                                                      - an output signal is actually sent to the module,

Problem is the DIO status is not updating or the Timeout case is not functioning i think. What is making the Timeout case do not function? I would appreciate again for any advise. I attached some files for your visual. Thanks again!

 

Download All
0 Kudos
Message 23 of 29
(1,166 Views)
Hello Bong,
the timeout case has little chance to execute, because you are firing the DO event for every loop. With a 100 ms timeout and 100 ms cycle time, this means that the timeout will likely never expire. The right way to proceed is to update DO indicators only when changes happen.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 24 of 29
(1,157 Views)
Hi Paolo,
 
Thank you for the reply and advise. Does this mean Event Structure may not be the ideal way to go with this but rather a Case Structure? I had a previous version of Case Structure before where if there is a change in the DO string then DIO will update. Please see the attached excel copy.
The logic on this version VI is also correct. It will send output signal to DO when conditions are met, it will read DI signal, and it will also updates DIO status signal. But the problem here is everytime it updates the DIO status indicators on the front panel 'blinks'. Maybe the reason of blinking is due to the nature of Case Structure when it reads from True to False and vise versa. Is there still a way to remove this blinking so that I can get a continuous DIO status?
 
Many thanks....
0 Kudos
Message 25 of 29
(1,150 Views)
You can stay with the event structure. Make the comparison like in your earlier versions, then in the True case (changed) fire the DO event.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 26 of 29
(1,145 Views)

Hi Paolo,

After a week of soul searching I am able to find the right VI for me. Thanks a lot of your kind advises. Regards,

0 Kudos
Message 27 of 29
(1,104 Views)
Hello
 
I wanted to use the serial driver to send data to my clock board with a serial input connected to an MSP. I was trying to see if everything was working and checking.First question is, which program should i use to send numbers or anything from my PC. i mean before labview or else could any one please tell me what modules i should use to get number from the user and send it to the serial port. I am not familiar with lab view.
 
Thank you very much
0 Kudos
Message 28 of 29
(1,091 Views)

Hi,

I am not familiar with clock board and MSP. This is an old thread and it might be useful to start a new thread. We have a lot of friends in the forum who might be able to assist you. Also, please try to explain more clearly what you are trying to do.

0 Kudos
Message 29 of 29
(1,086 Views)