estomax
2008-04-24 22:10:11 UTC
Hey Everyone,
i am pretty new to LabView, and am trying to use LabView to control a High Voltage (HV) power supply through the USB port. The driver for it is installed and it is emulating COM3 port, which LabView can see. I am just trying to test the commanding by using the Basic Serial Write and Read.vi from the tutorial.
The power supply that i'm using states the following in the manual:
Serial communications will use the following protocol:<STX><CMD><,>ARG><,><CSUM><ETX>Where:<STX> = 1 ASCII 0x02 Start of Text character<CMD> = 2 ASCII characters representing the command ID<,> = 1 ASCII 0x2C character<ARG> = Command Argument<,> = 1 ASCII 0x2C character<CSUM> = Checksum (see section 6.3 for details)<ETX> = 1 ASCII 0x03 End of Text character
6.3 CHECKSUMS
The checksum is computed as follows:? Add the <CMD>, <,>, and <ARG> bytes into a 16 bit (or larger) word.The bytes are added as unsigned integers.? Take the 1?s compliment (negate it).? Truncate the result down to the eight least significant bits.? Clear the most significant bit (bit 7) of the resultant byte, (bitwise AND with 0x7F).? Set the next most significant bit (bit 6) of the resultant byte (bitwise OR with 0x40).Using this method, the checksum is always a number between 0x40 and 0x7F.The checksum can never be confused with the <STX> or <ETX> controlcharacters, since these have non-overlapping ASCII values.so this means if i try to use command #14 for example, with argument 100, then i would write<STX>14,100,<CSUM><ETX> (this is shown in an example of the manual)
adding 14, 44(ascii comma), 100 together = 158, so 10011110, then complement it i get 01100001
if i clear the most significant bit, i assume that means delete it?: 1100001then set the most significant remaining bit, that means make it a 1? so i get 1100001 (dec:97 hex:61)
now to translate this to the string that labview wants, do i enter
\214\2C100\2C\61\3 ?
if anyone has experience with this or recognizes the command structure i would appreciate any help
thanks in advance!
i am pretty new to LabView, and am trying to use LabView to control a High Voltage (HV) power supply through the USB port. The driver for it is installed and it is emulating COM3 port, which LabView can see. I am just trying to test the commanding by using the Basic Serial Write and Read.vi from the tutorial.
The power supply that i'm using states the following in the manual:
Serial communications will use the following protocol:<STX><CMD><,>ARG><,><CSUM><ETX>Where:<STX> = 1 ASCII 0x02 Start of Text character<CMD> = 2 ASCII characters representing the command ID<,> = 1 ASCII 0x2C character<ARG> = Command Argument<,> = 1 ASCII 0x2C character<CSUM> = Checksum (see section 6.3 for details)<ETX> = 1 ASCII 0x03 End of Text character
6.3 CHECKSUMS
The checksum is computed as follows:? Add the <CMD>, <,>, and <ARG> bytes into a 16 bit (or larger) word.The bytes are added as unsigned integers.? Take the 1?s compliment (negate it).? Truncate the result down to the eight least significant bits.? Clear the most significant bit (bit 7) of the resultant byte, (bitwise AND with 0x7F).? Set the next most significant bit (bit 6) of the resultant byte (bitwise OR with 0x40).Using this method, the checksum is always a number between 0x40 and 0x7F.The checksum can never be confused with the <STX> or <ETX> controlcharacters, since these have non-overlapping ASCII values.so this means if i try to use command #14 for example, with argument 100, then i would write<STX>14,100,<CSUM><ETX> (this is shown in an example of the manual)
adding 14, 44(ascii comma), 100 together = 158, so 10011110, then complement it i get 01100001
if i clear the most significant bit, i assume that means delete it?: 1100001then set the most significant remaining bit, that means make it a 1? so i get 1100001 (dec:97 hex:61)
now to translate this to the string that labview wants, do i enter
\214\2C100\2C\61\3 ?
if anyone has experience with this or recognizes the command structure i would appreciate any help
thanks in advance!