LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Driver for Advantech DIO Module

The key point here is that the parallelism in RS485 merely exists to reduce the amount of copper wire that needs to be strung around. You still have to finish one complete command/response cycle on one device before you can move on to the next. So in a sense what Advantech told you is true: from their stand point you can access the modules in parallel because at the hardware/physical interface level you only need one set of wires for all of them. But at the software/command-protocol level accesses still need to be serialized precisely because there is only one set of wires. If you want to be talking to the two modules at exactly the same time you have to use two ports.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 11 of 29
(1,813 Views)
Hi Mike,
Thank you for the very informative message. Finally, the maker understand the trouble that I can't get the data from the two modules at the same time. Lastly I have to use two ports; one RS485 port for AI and one RS485 port for DIO module.
 
There is another challenge here for me, the DIO. The DIO has 8 inputs and 8 outputs. For my application I always wants to have DIO status information while at the same time doing DO commands. But remember this is in one resource. To get DIO information there is a particular syntax for it, likewise DO has its own. I placed a timeout that i will keep DIO on updating even there is DO command. BUT this is not working yet for me. With this VI, i can get DIO information and when I trigger any of the DO controls, the DO String will update but it will not trigger the module. It will not update on the DIO status too. Its like the event for "DO String" 'value change' is not working.
I would appreciate for any advise on how can I correct the VI?
 
If this will not work again, then I need to consider of getting two modules, DI and DO, and connecting them to separate port...Smiley Sad 
 
Thanks a lot.
0 Kudos
Message 12 of 29
(1,794 Views)
How many of these Inputs and Outputs do you actually use? If you have enough digital "width" you can connect some of your digital outputs back to spare inputs. This way you can read the digital inputs coming from the process you are monitoring and the state of the output bits all in one read.

One other thought, if having data that is exactly simultaneous is important, are serial devices really the right way to go? Plug-in cards would be faster, wider and easier to use - and the triggering capabilities are much more extensive.

Mike...

Message Edited by mikeporter on 06-01-2007 09:00 PM


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 13 of 29
(1,792 Views)

Hello Mike,

Yes, simultaneous data i need too...I will be using 4 DI and 8 DO...

I definitely agree with you on this. Anyway this serial devices are still for evaluation. I am just having hard time with its drivers and its all around capability.

---------------------------------------------------------

One other thought, if having data that is exactly simultaneous is important, are serial devices really the right way to go? Plug-in cards would be faster, wider and easier to use - and the triggering capabilities are much more extensive.

----------------------------------------------------------------

Many thanks...

0 Kudos
Message 14 of 29
(1,781 Views)
Hello Bong,
a couple of remarks:
1) the DO String Value Change event will not be fired assigning the new value to the control terminal: it will only be triggered changing the control from the user interface (which you don't want to do) or assigning the value using the property "Value (Signaling)"
2) even if the event would be fired, you are not handling it properly: your code writes the command to the module and then, just after the event case, writes another command without waiting for the module answer; you need to handle the DO command completely, before sending the DI command
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 15 of 29
(1,751 Views)

Hello Paolo,

Thank you for the remarks.

I think for the No. 1, I tried different ways but not successful. Please see the screen shots on the excel file. I found out that this will only work (event will be triggered) if i will type the commands or syntax on the front panel. But I don't want this way. I want to trigger a Control Switches to send a DO signal to the module.                               

For the No.2 comment, I did not get what you mean.

I also attached my DIO sample VI. I would appreciate if you can show me how can I improve the VI and send DO correctly.

Thank you very much.

Download All
0 Kudos
Message 16 of 29
(1,748 Views)
When you send a DO command to the module, it sends back an answer. You should read this answer and remove it from the input buffer before sending the DI command.
As from the event triggering, the first try in test 5.xls is the better approach, though it can be further optimized.
I don't have LV 8.2, can you post your vi in 8.0?
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 17 of 29
(1,743 Views)
Thank you for the reply and for helping me.
Below is the VI in 8.0 version.
---------------------------------------------------
You should read this answer and remove it from the input buffer before sending the DI command.
--------------------------------------------------
How can I remove it from the input buffer?
Download All
0 Kudos
Message 18 of 29
(1,738 Views)
Hello Bong,
sorry for the confusion: reading the answer will also remove it from the input buffer. I attach a modified version of your vi: please note that it's now completely event driven.
I got rid of the useless DO String. Most important: I defined CR as the termination character, so the Read operation will end upon receiving a CR (that marks the end of the module answer), independently of the fact that Byte count was greater than the actual number of character received.
Of course i did not test the vi, moreover it may not completely meet your goal, so you will likely change something in the code.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 19 of 29
(1,732 Views)
Hi Paolo,
 
wow!...That was cool!..I did not change anything from the VI, i connected the ADAM modules, put power and ran the VI and works perfect. There is only one thing i wish to confirm;
- While the VI is running, I triggered any of the controls and left it ON as it is. I can see the modules LED lit which means a DO signal was sent. If I stop the VI and turn-OFF the power of the module, and Turn it ON again and ran the VI again, the VI will not remember the last status of the DO signal. The modules also shows DO are all OFF even though the controls are left ON. But once I touch or trigger any of the controls, then that is the time it will update all DO signals. Is this the correct way or should the VI remember the last status of DO whenever the VI rans?
Thanks a lot Paolo. I hope this thread could help others too who will evaluate or use a Advantech Modules.
0 Kudos
Message 20 of 29
(1,713 Views)