LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS-232 comunication problem, can only send one command to a relay card

Hello
I'm using the rs-232 port to control a camera through a relay card.  But I can only send one command, and nothing works after that. And I have to restart the labview to send another command.
 
The guy who made the relay card made also a controller in C++ and that works fine...and he says that I only need to send the ascii code.. with no termination character and no handshake....and the rs-232 should be 9600 baund, 8 ,N, 1.
 
So in my program I enter the ascii numbers and then use a "byte array to string" to send it to the rs-232 port.
The command for stearing right is :
Byte 1: 60
Byte 2: 83
Byte 3: 10  (this is the different channels on the relay card, it can be 1  to 16)
Byte 4: 01  (this is on or off, 1=on and 0=off)
Byte 5: 69
Byte 6: 62
 
I've also tried the serial example in labview but with the same result....and I have called the labview support but with no luck...
 
Hope anyone can help me out with this....or give me some ideas of what may be wrong...
 
Best regards
Martin Ojeda
 
 
 
0 Kudos
Message 1 of 4
(2,671 Views)
In your CMD2 event case you are intitializing the com port again.  Remove this function.  You could gain insight to your problem if you would wire the error ins and outs and put an error out cluster on your front panel to see if any com errors occured.  What happens if you use hyperterminal to send the commands?  Hyperterminal is always a good check to see if the device is working properly.
- tbob

Inventor of the WORM Global
Message 2 of 4
(2,655 Views)
Thanks for the reply, I connected a rs-232 plug to the other end of the cable and connected it to aanother computer...then I used hyperterminal to read the port while I used the control program that worked...and there I saw that the other program send two commands one to turn on the channel and one to turn off the channel...(He said nothing to me about sending two commands...that smartass..).... 🙂

So when I send two commands now in Labview it works!!!

Best Regards
Martin Ojeda
0 Kudos
Message 3 of 4
(2,627 Views)

Martin, I'm glad you found the solution on your own.  Hyperterminal is always a great tool for serial communications debugging.

Lesson to be learned by all:

Don't assume the other person knows what he is talking about.Smiley Very HappySmiley Very HappySmiley Very Happy

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 4
(2,611 Views)