LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicating with a device

I am trying to communication with a diamond camera using KD 6 protocol. I am using an RS 232- RS 485 Conveter for this purpose. My problem is that the camera receives a signal from my code however it does not execute the right command. I have checked my code and compared with another software and found the command formats to be the same. And the camera executes the right command with this other software.The protocol requires me to send 6 bytes of data to the camera. My question is this. Is there anything in the way Labview sends the input to the serial port that could be the cause for this problem?
0 Kudos
Message 1 of 8
(3,305 Views)
Are you sure that ypu're formatting the data the same? Are you sending the correct termination character? Are you supposed to be sending hex data? LabVIEW sends whatever you want it to but you may not be sending the correct data. For example, using a string control to send the characters AA is not the same has sending hex AA. Set the control for hex display and you'll see that text AA is really hex 6161. So if you're using a front panel string control, set it for hex, enter the command and try that. If you could provide some detail on the protocol, it would help and attaching the code you've written would help as well.
0 Kudos
Message 2 of 8
(3,305 Views)
I believe that what you are saying is right. I checked the hex display and it showed me different numbers. However I am using the function number to hexadecimal string for sending the input. I am attaching the main vi(try setup) and the subvi (another.vi). The subvi has the input command for the protocol. I also do not understand about the termination character. Can you please help me with that?

The communication protocol is RS 485 simplex, 9600 baud , 1 start bit, 8 data bits and one stop bit, even parity.
Download All
0 Kudos
Message 3 of 8
(3,305 Views)
I wanted to add that the final data I think needs to be sent as hex data. That is what I gathered from the protocol.
0 Kudos
Message 4 of 8
(3,305 Views)
Instead of using the Number to Hexadecimal String.vi in your subVI, use the Typecast function found in the Functions>>Advanced>>Data Manipulation subpalette. This will by default change your numbers to hexadecimal strings.
Take a look at the attached another[1].vi - I modified it for you.
Hope this helps.
-Julie
0 Kudos
Message 5 of 8
(3,305 Views)
Julie

I cannot open your file as it is version 7.0 and I use version 6.1. Can you send me the filed saved in the older version.'

Thanks!
Hema
0 Kudos
Message 6 of 8
(3,305 Views)
Julie's correct in that you shouldn't be using the Number to Hex String conversion. In case her suggestion doesn't work, just try using a string control set to hex display, enter the hex string and send that. Without the full documentation, I'm not clear as to whether you need to send the hex representation of 176 (B0) or x176. Also, what I mean by termination character is that often serial instruments require a character at the end of every transmitted string in order to tell the instrument to start processing the characters sent. It's often a carriage return or line feed (hex 0D and 0A). Your instrument manual should have the details on this.
0 Kudos
Message 7 of 8
(3,305 Views)
Julie and Dennis

Thank you for your help. I changed the function to type cast and sent the termination character and the program works.

Thanks
Hema
0 Kudos
Message 8 of 8
(3,305 Views)