RS232 Specifications
- pmartin
- Topic Author
18 years 2 weeks ago #3547517
by pmartin
RS232 Specifications was created by pmartin
Hi everyone!
What are the exact specs for talking to the Roboteq controller via RS232 (including delay time for response packets)? Also, when I am sending a command, say a motor command value, "!M", does the '!' character actually need to be sent? Should it be programmed as an 'unsigned char' type in C/C++?
Thanks!
Patrick
What are the exact specs for talking to the Roboteq controller via RS232 (including delay time for response packets)? Also, when I am sending a command, say a motor command value, "!M", does the '!' character actually need to be sent? Should it be programmed as an 'unsigned char' type in C/C++?
Thanks!
Patrick
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 22
- Thank you received: 0
18 years 1 week ago #3590831
by tonysantoni
Robotony
Replied by tonysantoni on topic Re:RS232 Specifications
Robotony
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 22
- Thank you received: 0
18 years 1 week ago #3590977
by tonysantoni
Robotony
Replied by tonysantoni on topic Re:RS232 Specifications
The RS232 port on the Roboteq controller is configured as: 9600/1/1/EVEN/NO control flow.
Your program needs to configure the port on the computer with these parameters.
I have programmed in Visual Basic in which case you send the commands like: "?A" or "^00 00" defined as strings. you send complete string as it appears enclosed in the double quotes, including the ? or ! or ^.
Example (assume you have a sub named SEND(string) that sends a string via the RS232):
Dim mystring as string
mystring = "?A"
Call Send(mystring)
Private sub Send(anystring as string)
your code specific to the RS232 send function here
end sub
I have not translated this in C but it should work the same way.
Under Windows the transmission time through the RS232 is about one millisec. The controller keeps the commands in a buffer sampled every 16 millisec so the response time to a command is 16 millisec worst case., which more or less should also be the rate at which commands are sent (the buffer accomodates for time variations)
Your program needs to configure the port on the computer with these parameters.
I have programmed in Visual Basic in which case you send the commands like: "?A" or "^00 00" defined as strings. you send complete string as it appears enclosed in the double quotes, including the ? or ! or ^.
Example (assume you have a sub named SEND(string) that sends a string via the RS232):
Dim mystring as string
mystring = "?A"
Call Send(mystring)
Private sub Send(anystring as string)
your code specific to the RS232 send function here
end sub
I have not translated this in C but it should work the same way.
Under Windows the transmission time through the RS232 is about one millisec. The controller keeps the commands in a buffer sampled every 16 millisec so the response time to a command is 16 millisec worst case., which more or less should also be the rate at which commands are sent (the buffer accomodates for time variations)
Robotony
Please Log in or Create an account to join the conversation.
- pmartin
- Topic Author
18 years 1 week ago #3594114
by pmartin
Replied by pmartin on topic Re:RS232 Specifications
Thanks for the info. I'm making some Linux based software using C++, and the serial port configuration is highly detailed. With other RS232 motor controllers I have had to send out "unsigned char" data in order to get the commands to work properly on the motor controller side.
Please Log in or Create an account to join the conversation.
- pmartin
- Topic Author
18 years 1 week ago #3608556
by pmartin
Replied by pmartin on topic Re:RS232 Specifications
Tony,
As a recap of your example, just to make sure I'm getting this right...
If I want to send a motor set command to achieve some speed I would compose a string (or unsigned character string) as:
"!A0F", and send it to the controller to get the result "tell channel 1 to go forward at 0F speed". So the "0F" is not really a hex number, it is a string representation of a hex? (I am referring to pg. 92 of manual)
Likewise, modifying a parameter would also be a full string with the " " (read: space) literal between the other substrings.
Thanks!
As a recap of your example, just to make sure I'm getting this right...
If I want to send a motor set command to achieve some speed I would compose a string (or unsigned character string) as:
"!A0F", and send it to the controller to get the result "tell channel 1 to go forward at 0F speed". So the "0F" is not really a hex number, it is a string representation of a hex? (I am referring to pg. 92 of manual)
Likewise, modifying a parameter would also be a full string with the " " (read: space) literal between the other substrings.
Thanks!
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 22
- Thank you received: 0
18 years 1 week ago #3646706
by tonysantoni
Robotony
Replied by tonysantoni on topic Re:RS232 Specifications
You understood correctly. You need to send the string equivalent of an hex number rather than the hex number as unsigned char.
So for 255 dec you would send "FF" not FF.
Tks
Tony
So for 255 dec you would send "FF" not FF.
Tks
Tony
Robotony
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 22
- Thank you received: 0
18 years 1 week ago #3646768
by tonysantoni
I forgot to say that we at Roboteq have source code available demonstrating the API interface. It is in VB6.0 but can be easily changed in C. In case you want it, e-mail me at <A href="This email address is being protected from spambots. You need JavaScript enabled to view it." target=_blank>This email address is being protected from spambots. You need JavaScript enabled to view it.
Tks
Tony
Robotony
Replied by tonysantoni on topic Re:RS232 Specifications
I forgot to say that we at Roboteq have source code available demonstrating the API interface. It is in VB6.0 but can be easily changed in C. In case you want it, e-mail me at <A href="This email address is being protected from spambots. You need JavaScript enabled to view it." target=_blank>This email address is being protected from spambots. You need JavaScript enabled to view it.
Tks
Tony
Robotony
Please Log in or Create an account to join the conversation.
Moderators: tonysantoni
Time to create page: 0.068 seconds