Hello.
I need a RS232 command for the T825 SM DRIVER - for moving the step motor by steps.
I did the software in VB6, and some of the commands are warking great.
For example: sending:
0x85 (energize)
do delay(50m)
0x97,0x01 (forward )
will move the motor CW.
0x85 (energize)
do delay(50m)
0x97,0x00 (reverse)
will move the motor CCW
It will work continuously.
According to this example, i need the step command.
Thanks
Hello.
I removed a duplicate post you made in a different section of the forum to keep it organized.
Just to be clear for others who might come across this, the Tic does not have an RS-232 interface, and it sounds like you are using a RS-232 to TTL serial adapter.
There is no TTL serial command for moving the motor a certain number of steps relative to where it is (you can find all of the available commands in the “Command reference” section of the Tic user’s guide). However, there are a few ways you could achieve this.
One way would be using a variable to keep track of the position of the motor in your code, and using that to send the appropriate “Set target position” command.
Another way would be to use the “Get variable” command to read the “Current position” variable on the Tic, and base your “Set target position” command off of that.
Alternatively, you could utilize the “Halt and set position” command to essentially reset the current position of the motor as the 0 position, and then use the “Set target position” command since it will be relative to the new zeroed position. Please note that if your motor is moving when you send this command, it will stop without respecting the deceleration limit.
Brandon
Hi Brandon.
The t825 has TX AND RX .
I’m using uart adapter (rs232 to ttl) with 4.5 volt ttl level.
I did a vb6 app that can moves the actuator forward and backwards .
When It is at max length (my actuator is 15mm), I’m sending de energize command and it stops.
I need one more command example for using: number of microsteps but I do not know how to do it ![:frowning: :frowning:](https://forum.pololu.com/images/emoji/twitter/frowning.png?v=12)
But yes… the rs232 pins on the t825 - works.
The command you mentioned in your first post (0x97) is the “Go home” command. So, you are actually telling the Tic to start it’s homing procedure when you send it (instead of directly commanding it to go forward and reverse). If you want to control the velocity, you should use “Set target velocity” commands instead.
However, it sounded like you wanted to specify the number of steps to take (instead of the frequency at which to take them). For that, you should use the “Set target position” command using one of the methods I referred to in my previous post. The “Set target position” command allows you to specify the position you want the Tic to move to in units of microsteps.
Both the “Set target velocity” and “Set target position” commands are in the 32-bit write format (as opposed to the “Go home” command, which uses the Quick format). You can find an explanation of the 32-bit write format, including an example breaking down the bytes for a “Set target position” command, in the “Serial command encoding” section of the Tic user’s guide. Also, you might find it helpful to review the “Example serial code for Windows in C”, which has a function showing how you can generate the required bytes for the “Set target position” command for your desired 32-bit target value programmatically.
Brandon
Thanks Brandon.
I will check.
Thanks again for your help.
Hi Brandon.
I’m trying to send the command: Get variable
I’m sending only: 0xA1 via uart.
I don’t recieve anything .
I’m trying also to send : Set target position - FOR EXAMPLE:
E0,9,9,9,9,9
Nothing happens… ![:frowning: :frowning:](https://forum.pololu.com/images/emoji/twitter/frowning.png?v=12)
What am i doing wrong?
0xA1 is only the command byte for the “Get variable” command; however, as specified in the “Command reference” section of the Tic user’s guide, it uses a “Block read” format type. You can find more details about the “Block read” format type (including an example for using the “Get variable” command to read the target position variable) in the “Serial command encoding” section that I referred to in my previous post. As described there, you need to send the command byte, followed by a byte specifying the offset (which is where you want the block read to start), and a length byte specifying how many bytes you want the response to include. You can find details about the variables stored on the Tic (including their offset and type) in the “Variable reference” section of the Tic user’s guide.
For your “Set target position” command, I suspect you made an error when converting the desired target position to the appropriate bytes. What target position are you trying to send? The bytes you listed would try to set the target position to a very large value (2,299,070,857), which is larger than what is supported by the Tic (2,147,483,647).
Brandon
Hello Brandon.
It was very helpful.
I did the GET VARIABLE and it now ok ![:slight_smile: :slight_smile:](https://forum.pololu.com/images/emoji/twitter/slight_smile.png?v=12)
I tried to do the: SET TARGET POSITION and something is wrong.
The motor is not moving.
This command will move the motor ?
i do not need to add - ENERGIZE ?
Can you send me 2 examples (hex bytes) : One for forward and the second for backwards ?
Thanks.
You do not need to send a separate command to energize the motor, but depending on the state of the Tic when you start sending signals, it might be necessary to send an “Exit safe start” command first (which is just 0x83
).
Here is a breakdown for setting the target position to 1200 and -1200:
1200 in binary is 00000000 00000000 00000100 10110000
MSbs: 00000001
data1: 00110000
data2: 00000100
data3: 0000000
data4: 0000000
So for setting the target to 1200:
command |
MSbs |
data1 |
data2 |
data3 |
data4 |
0xE0 |
0x01 |
0x30 |
0x04 |
0x00 |
0x00 |
-1200 in binary (using two’s complement) is 11111111 11111111 11111011 01010000
MSbs: 00001110
data1: 01010000
data2: 01111011
data3: 01111111
data4: 01111111
So for setting the target to -1200:
command |
MSbs |
data1 |
data2 |
data3 |
data4 |
0xE0 |
0x0E |
0x50 |
0x7B |
0x7F |
0x7F |
Brandon
Hello Brandon.
First, thank you very much for your help.
I will show you what i did until now:
moving actuator forward: 85 , 97 , 01 , delay in ms , 86
moving actuator backward: 85 , 97 , 00 , delay in ms , 86
if i need small steps, the delay will be short…
When i tried to do your command, the actuator was not moving.
0xE0 0x01 0x30 0x04 0x00 0x00
or
0xE0 0x0E 0x50 0x7B 0x7F 0x7F
i also tried to send 83 before but nothing happened…
Do you think that i did it ok ?
If it will not work for me, i will use the delay option.
Thanks Brandon.
Using the homing commands to move the actuator like that is definitely not an intended way to use the Tic, but if it works for your application, I do not see anything particularly concerning about it. However, you will not have much control over it (i.e. the homing speeds are pre-set in the “Advanced settings” tab of the Tic Control Center and you would be relying on timing to move it a certain distance).
If you want to troubleshoot why the set target position commands are not working for you, you can post more details abut your system, and I would be glad to help. In particular, it would be helpful if you could post some simple but complete code that demonstrates the problem as well as a copy of your Tic settings file. You can save a copy of your Tic settings from the “File” drop-down menu of the Tic Control Center while the controller is connected. Also, could you describe what the LEDs on the Tic are doing when you send the “Set target position” commands? If the red LED is lit, could you check the “Status” tab of the Tic Control Center and see which error is being triggered?
Brandon
Thanks Brandon.
I will do it.
Hi Brandon.
The red led is always on.
please see the setup file.
tic_settings_v1.txt (1.3 KB)
Thank you for the settings file. I do not notice anything immediately concerning. Could you check the “Status” tab of the Tic Control Center and see which errors are being reported?
Brandon
Hello Brandon.
I will add 3 movies:
1- the t825 - before sending command to actuator.
2- the t825 - while actuator is moving
3- the pololu - while actuator is moving and stops in the end.
hope it will help.
thanks again for your help
From the behavior of your system in the videos, it looks like you are running your code that starts the homing procedure. To clarify, I was asking about what happens when you send the “Set target position” commands with the example bytes I specified. Can you send those “Set target position” commands and tell me what errors you see in the “Status” tab of the Tic Control Center when you do?
Also, could you post a copy of the code using the “Set target position” command that you run in that test?
Brandon
Hi Brandon.
I will do it on Sunday.
I think that after sending the command, no error occurs…
But to be sure, I will do all in Sunday.
Thanks again for your help.
Have a great weekend ![:wine_glass: :wine_glass:](https://forum.pololu.com/images/emoji/twitter/wine_glass.png?v=12)
the next movie is with: exit safe