Editing PIC Stepper Motor Tester

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 218: Line 218:
 
All commands ( except stop should be terminated with a carriage return ) Note that the command interface is not very smart, giving parameters that are out of range my blow the whole program up. If so reboot the PIC. Do not send a new command ( except stop ) until earlier commands have been completed ( actually you can get ahead some if you are careful ).  In earlier versions the commands had to be in lower case, I think current versions take either upper or lower case - check it out.
 
All commands ( except stop should be terminated with a carriage return ) Note that the command interface is not very smart, giving parameters that are out of range my blow the whole program up. If so reboot the PIC. Do not send a new command ( except stop ) until earlier commands have been completed ( actually you can get ahead some if you are careful ).  In earlier versions the commands had to be in lower case, I think current versions take either upper or lower case - check it out.
  
see: [[Stepper Motor Demonstration and Tester]] which covers both the PIC and Arduino Version.
+
 
 +
{| class="wikitable"
 +
|-valign="top"
 +
! Command
 +
! Code
 +
! Notes, PIC Response
 +
<!------------------------------->
 +
|-valign="top"
 +
|Report version
 +
|v
 +
|Version of the PIC software something like:
 +
Serial Stepper Test ver July 4 2008
 +
<!------------------------------->
 +
|-valign="top"
 +
|Set direction
 +
|d+
 +
d-
 +
|plus for forward, minus for back
 +
Direction set.
 +
<!------------------------------->
 +
|-valign="top"
 +
|Where = Request motor position
 +
|w
 +
|Steps taken since power on or reset.
 +
Signed int.
 +
<!------------------------------->
 +
|-valign="top"
 +
|Report on all parameters
 +
|r
 +
|Delimited by commas something like:
 +
Dir +1, Permutation 1, Stepper Pos 80, Step Delay Us = 300 .....
 +
<!------------------------------->
 +
|-valign="top"
 +
|Go for a number of steps
 +
|gnnn
 +
|go for a number of steps ( max. about 30,000 ) Direction set with d.
 +
Responds with "g starting<cr>" when rotation begins, then with "g done<cr>" when done.  May be stopped early with stop command.
 +
<!------------------------------->
 +
|-valign="top"
 +
|Set the time delay between steps in ms ( max 255 )
 +
|tnnn
 +
|Reports delay set.  nnn = 0 to 255
 +
<!------------------------------->
 +
|-valign="top"
 +
|Micro second delay in addition to to the ms delay.
 +
|unnnn
 +
|Reports delay set. Ok to use values nnn = as high as 5000 us.
 +
<!------------------------------->
 +
|-valign="top"
 +
|Set the permutation of the motor wires.
 +
|pn
 +
|Set the permutation, find the value that works for your motor. ( n = 0 to 5 ) Responds with the permutation set.
 +
<!------------------------------->
 +
|-valign="top"
 +
|Special command 1, Spin the motor in an interesting way. 
 +
|x1
 +
|Motor spins responds with "x special done<cr>" when it is done.  May be stopped with the stop cammand.
 +
<!------------------------------->
 +
|-valign="top"
 +
|Special command 2, Vibrate the motor first a lot then less and less to stop
 +
|x2
 +
|responds with "x special done<cr>" when it is done
 +
<!------------------------------->
 +
|-valign="top"
 +
|Stop
 +
|!
 +
|Should almost immediately stop long running commands like Go or x1 or x2. Responds with  Stopped<cr> when stoped ( wich should be quick ).
 +
<!------------------------------->
 +
|-valign="top"
 +
|Other, not understood commands
 +
|xxx
 +
|Responds with "!Bad Command = xxx" if the command is not understood.
 +
<!------------------------------->
 +
 
 +
|}
 +
 
 +
 
 +
Notes on terminal program set up.
 +
 
 +
*Baud rate should be 19.2K 8N1
 +
*Most terminal programs can be set to treat a carriage return as a carriage return line feed. Do it.
 +
Some terminal programs will not transmit in lower case ( all our commands are lower case ) unless specially set to do so. Set it to allow lower case.
  
 
== Microcontroller Program Design ==
 
== Microcontroller Program Design ==

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)