My question is for help me in programming an Aduino to control a stepper motor using a communication protocol (listed in the bottom)
As my skills for programming is very low, i can't write a program to Arduino to control the rotary table.
I can see the program is sending code to com3 but i don't know how to program the Arduino so it can communicate with this code.
Someone who can help me with this?
Contents
1General Rotary Communication Protocol
2 Commands
2.1V
2.2SmMxxx
2.3ImMxxx
2.4DmCWLO
2.5DmCWHi
2.6EmHALT
3Rotary Sample Command Sequence
General Rotary Communication Protocol
All commands sent to the rotary table are in simple character format including the motor numbers. Only the
parts marked as xxx passed to the table as byte data. For example if you want table 1 rotate 4 steps instead of
passing "I1M004" you pass "I1M" + (char)0 + (char)0 + (char)4
In general all commands get a reply in the form of: ^XXXXXX
Commands
V
Request the status of the rotary table. Usual reply would be ^R1R2R3R4 indicating rotary 1 ready, rotary 2
ready, etc. ^B1xxxR2R3R4 means rotary 1 is busy where xxx are 3 bytes indicates how many steps the
rotary still has to perform.
SmMxxx
Sets the speed of the motor m to xxx, where xxx is a 3 bytes of data indicating the speed. Example code:
port.Write("S1M" + (char)0 + (char)6 + (char)255); // set motor 1 to speed 1791. The standard speed range
of our rotary table is: 0x000001 to 0x0012FF (1 to 4863). Controller will respond with ^mxx mirroring the
motor number and 2 last bytes of speed setting.
ImMxxx
Turns motor m xxx number of steps. Controller will acknowledge with ^Bmxxx
DmCWLO
Set motor number m to rotate clockwise (So each consecutive command to rotate the motor m will rotate it
clockwise).
DmCWHi
Sets rotary m to rotate counterclockwise.
EmHALT
Rotary m stop.
Rotary Sample Command Sequence
Motor numbers are passed as characters but the number of steps and speed are passed as 3 bytes of binary for
simplicity.
send: V reply: ^R1R2R3R4
send: S1M1791 reply: ^191
sned: D1CWLO reply: ^
send: I1M100 reply: ^B1100