LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communications problem

hi there!

i've got a general problem. i connect some devices (power supply, bacode scannner) to te com-ports. with the hyperterminal i can steer them with the individual commands for each device. that works fine.
if i try to do the same thing with the labview serial communications vi's it doesn't work great. if i place the serial command sending (com-port initialization & closing included) in a subvi and i call the subvi once in the main programm it doesn't work. if i call the subvi twice the commans would be processed correctly. this phenomen i have with some different devices. with hyperterminal it works without problems and i haven't to send the command twice.

i hve tried different things with the timing if sending the commands and
i have tried some things to reset the sending buffer etc. but i didn't found the reason.

thanx for your help
0 Kudos
Message 1 of 12
(3,325 Views)
I suggest to open and initialise your com port once in the beginning of your program and use it until the end of your program where you close it.
So split your open communicate close vi in three parts and use the first and last part only once.
greetings from the Netherlands
0 Kudos
Message 2 of 12
(3,325 Views)
further to the above,

Adding
Bytes At Serial Port.vi follow by Serial Port Read.vi

before your command would helps to clear the port avoiding reading back extra bytes (uncleared bytes) after sending your command.

Hope this will help too.
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 3 of 12
(3,325 Views)
this is an option that i tried before and it hasn't helped...

after closing hyperterminal and it's connection with the port, the receiving- and trasmitbuffer shoulb be clean i think.
running my vi after closing hyperterminal there ist the same effect.
0 Kudos
Message 4 of 12
(3,325 Views)
perhaps, you can post your code here see if anyone can help.
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 5 of 12
(3,325 Views)
here is one of my subvi's that should steer a power suply

if i call this vi from my mainvi nothing happens. if i call the vi twice the commands will be processed...
0 Kudos
Message 6 of 12
(3,325 Views)
Try to replace the "Wait Until Next ms Multiple" function by the "Wait (ms)".

By using the "Wait Until Next ms Multiple" function the delay on the first call (sequence 5[0..12]) will not be 100ms but an arbitrary value (next multiple of 100ms of the timer - actual timer value). This means that the intervall between the sending in sequence 5 and 6 can be very short.

For more detail, see for example :
http://zone.ni.com/devzone/conceptd.nsf/webmain/E83351E12CD2D50886256B66006E4D15?opendocument
0 Kudos
Message 7 of 12
(3,325 Views)
Try running the vi with the "execution highlight" button clicked. This is to check if there is a need to force some millisecond delay.
0 Kudos
Message 8 of 12
(3,325 Views)
that i've already tried with no results
0 Kudos
Message 9 of 12
(3,325 Views)
This is a simple VI I use to test my serial instruments - I hope it helps!

Like my Answer? Give it a Rating!

Christopher G. Relf
Certified LabVIEW Developer

Christopher.Relf@mBox.com.au
International Voicemail & Fax: +61 2 8080 8132
Australian Voicemail & Fax: (02) 8080 8132

---
EULA
1) This is a private email, and although the views expressed within it may not be purely my own, unless specifically referenced I do not suggest they are necessarily associated with anyone else including, but not limited to, my employer(s).
2) This email has NOT been scanned for virii - attached file(s), if any, are provided as is. By copying, detaching and/or opening attached files, you agree to indemnify the sender of such responsibility.
3) Because e-mail
can be altered electronically, the integrity of this communication cannot be guaranteed.




Copyright © 2004-2024 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 4.0 License.
0 Kudos
Message 10 of 12
(3,325 Views)