Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Hexadecimal commands via the serial port.

I am trying to communicate to a device via my serial port.  Each command packet sent to the device requires a number of parts:
 
Start Trans (STX)| Address High Byte | Address Low Byte| First Data Byte| Second Data Byte|....|Last Data Byte|Checksum High Byte|Checksum Low Byte|End Trans (ETX)
 
The manual for the device (a Liquilaz S03 from Particle Measuring Systems) describes how the command packet should be formatted in hexadecimal, but it also shows the corresponding ASCII.  In hexadecimal, a command packet might look like:
 
02|7B|20|7B|21|43|56|45|52|7B|20|31|03 (without the "|")
 
I've attached the very simple VI I'm using to send the command and read any response.  The problem is that I get no response from the device.  I've also tried sending the packet in the corresponding ASCII code, but I'm not sure I handled the STX and ETX correctly.
 
I have been using a RS232 "snooper" to see what the commands look like when I send them out through the serial port.  The string the snooper shows me (in hex) is identical to what I am entering into my program.
 
1. Do I need to something specific in LabView to let it know I am trying to send a hexadecimal command?  (I tried changing the string constant I am sending to hex format, but with the same result - no response from the device.)
2. The tech support at Particle Measuring suggested I set up a buffer, but I am not sure how this is different than what I am already doing.
 
Lastly, I know the device is working because I can get information from it using the basic software that came with it.
 
Thanks for any insight into this problem.
 
Corey
 
0 Kudos
Message 1 of 12
(16,120 Views)
You probably need to send the values in hex, as opposed to the characters "0", "2", "7", etc. In other words, the device is probably looking for the character that corresponds to a value of "02", followed by the character that corresponds to "7B". The snooper is showing you the hex values, which are 02, 7B, etc. These are not the characters "0", "2", etc. basically, you need a byte array as shown below:


Comments regarding your code:
  • Learn to wire through the error clusters. If any of the VISA functions generate an error you'll never know.
  • Your sequence frame is no necessary. You already have data dependency between the write and read.
  • You probably need a delay between the write and read. Use the "Time Delay" function in the Timing palette.

Message Edited by smercurio_fc on 05-22-2007 01:56 PM

Message 2 of 12
(16,116 Views)

My hero....it worked exactly as it should.  Thanks for your help.

 

Corey

0 Kudos
Message 3 of 12
(16,103 Views)

CoreyNE,

 

Just starting to program an interface to the Liquilaz and ran across your posting.  Do you have a working vi that I could start with?

Thanks,

torr

0 Kudos
Message 4 of 12
(15,531 Views)
Here are vi's to communicate with the Liquilaz particle counter.  The ascii communication conversion is the CLS-HEX Converter.  I initially wrote the vi's for a CLS-700 with a 0.2 um threshold and reading 6 channels.  The counter and sampler share similiar command structures but different addresses.   I hope this gives someone a head start. 

 

torr

0 Kudos
Message 5 of 12
(15,215 Views)

One last vi that is the sampling, data acquisition, and initialization.

 

torr

Message 6 of 12
(15,214 Views)

I have the same exact problem but I am not using Labview. I have a GUI in matlab that controls my instrumentation set. I would like to include this instrument as well in my GUI but I cannot communicate with the pump. The pump accepts hex strings and I have tried several different ways of inputing the string in matlab to no avail.

this is a string to run the pump

E9 00 06 57 4A 00 E8 00 00 01 F2 

Thanks in advance for your help.

0 Kudos
Message 7 of 12
(14,115 Views)

never mind got it to work with the following

start=[233 001 006 087 074 000 232 000 001 001 242];
stop=[233 000 006 087 074 000 232 000 000 001 242];
fwrite(s1,start)
pause(10)
fwrite(s1,stop)

it turns out that one of my wires was bad and thats why it didnt work intially

Hope noone else spends much time on this.

 

0 Kudos
Message 8 of 12
(14,113 Views)

Can someone upload the code for this? I cannot seem to figure out how to create a byte array that looks like yours.

0 Kudos
Message 9 of 12
(11,890 Views)

I am refering to the image that  posted.

0 Kudos
Message 10 of 12
(11,885 Views)