Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple motor communication

Hi,
 
I'm using the basic read/write serial port program with the rs232 port to send strings of information to the two motors I'm working with.  The program and the motors seems to be functioning, but I'm having problems getting the a motor to respond to a command specific to that a motor.  For example if I use a the command report position, RP, without appending which motor should respond, I get both motor positions.  But I don't get anything if I use 1RP, 2RP, or use the global command 0RP, I don't get any response except from the echo mode the motors are on.
 
 
0 Kudos
Message 1 of 6
(4,076 Views)

Sounds like Animatics. Have you tried the tilde in front of the command as outlined in  the manual?

 

i.e. ~1RP

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 2 of 6
(4,072 Views)
Okay, I've asked animatics about the character prefixes on the commands for each motor.  The reason the strings 0rp or 1rp isn't working is because Labview doesn't automatically convert these prefixes the binary equivalents of 128-129.  What are the ASCII equivalents of 128-129?

Thanks,

Cindy
0 Kudos
Message 3 of 6
(4,055 Views)
Hello,
 
I think the standard ASCII character set only consists of values in the range: 0 - 127.  That is, it may not be a printable character.  Fortunately that doesn't matter; what really matters is that you send the byte(s) you would like, which has or have the underlying value 128 and/or 129.  To do this, all you have to do is define a byte with the value 128 or 129, and then type cast it to type string.  This will define a character or characters with that ascii value, regardless of whether or not you can read it in a string (ie. regardless of whether or not it's printable).
 
In LabVIEW you can use the type casting function located in the All Functions -> Advanced -> Data Manipulation palette.  Simply wire a numeric of type byte to the left input, a dummy string to the top input (you can actually leave it since it will be string by default... but for readability it's nice to know precisely what your type casting to :), and the output will be a string with ascii value defined by the input byte. 
 
Again in LabVIEW, if you want to define more than one byte at a time and build a string consisting of characters defined by an array of bytes, you can use the Byte Array to String function, found in All Functions -> String -> String/Array/Path Conversion palette.
 
These functions allow you to build an arbitrary string, irrespective of whether the characters are printable or not!
 
I think those functions should do the trick for you!
 
Repost if you have any further questions!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
Message 4 of 6
(4,046 Views)
I've tried type casting using a numeric control with the byte representation to a string, but it only works from the decimal values of 0-127.  I'm thinking that I need to work with converting binary strings of decimals 128-130 to ASCII strings and then concatenate this string to the rest of the motor command, so I'll get 0RP.   Is this the best way of transmitting commands to the motors I'm working with via the rs232 port?  Could I get some direction as to how I'd do something like this?

Thanks

Cindy
0 Kudos
Message 5 of 6
(4,027 Views)
Nevermind, I got it working. 

I just needed to changed the numeric representation from byte to work. 

Thanks,

Cindy
0 Kudos
Message 6 of 6
(4,021 Views)