
Commands
Most commands use only one 8 bit characters to instruct the external microcontroller. To operate the FET
bridges, the single character selects the motor(s) and the functions as shown in the table below. To adjust
motor speed, an additional character is sent. The speed can be adjusted in 100 steps (0 to $64).
The upper nybble of the command specifies the motor(s), $D for motor "A", $E for motor "B" and $F for both
motors. The lower nybble is the command type.
First Character Second Character
Upper nybble Lower
nybble
Motor or input selection
A only B only Both
Read Analogues - - $F $3 -
Read status $D $E - $4 -
Read steps $D $E - $5 -
Speed $D $E $F $6 Speed, 0 to $64
Off $D $E $F $7 -
Stop $D $E $F $8 -
ON Forward $D $E $F $9 -
ON Reverse $D $E $F $A -
Ignore Limit $D $E $F $B -
Restore Limit $D $E $F $C -
Set/read/Config. $D $E $F $D 4 setup bytes
Reserved - - $F $E -
Not used - - $F $F -
Set/read config commands allow the bytes to be set in RAM, read and written to non-volatile memory.
Site last modified on 14 Oct 2008 © 1996-2008 Tain Electronics Pty Ltd
Tain Electronics
IPIC Dual Motor Driver - More Information
IPIC Dual Motor Driver - More Information
Connections
Power Supply + Positive Supply for Motors, PICAXE and external micro
0 0V or “Ground”
The power supply voltage should equal the motor voltage. Possible range is +7V to 25V.
Motors A, A Motor “A”
B, B Motor “B”
Switches, pulse counters and analogue inputs
0 0V or “Ground”
+ 5V out (max current 25mA)
1 Limit Switch, Motor “A”: * Close to ground to allow motor to run.
2 Pulse Count, Motor “A”
3 Limit Switch, Motor “B”: * Close to ground to allow motor to run.
4 Pulse Count, Motor “B”
5 0V or “Ground”
6 Analogue input, 0 to 5V
7 Analogue input, 0 to 5V
8 Digital input/output
9 Digital input/output
* Limit switch inputs are disabled initially so these terminals need not be connected to allow the motors to run.
Where to start…?
The only essential connections are the motor terminals A, A (B, B for a second motor) and the power supply input
terminals 0 and + between the two pairs of motor terminals. The + power supply voltage should suit the motor voltage
but as it also operate the PICAXE-08M via a 5V regulator, a minimum of 7V is recommended.
Program the PICAXE-08M to send and receive serial commands at 2400 bps via pin 6. After the external
microcontroller receives a command sequence, it replies after a delay of about 6 millisec. Any information requested
by the command (such as step count, speed etc) is sent at the same time. To allow the PICAXE to receive these
characters, the program should switch pin 6 to an input immediately after sending the command sequence.
Examples:
To start Motor A only, send $D9. Response sent by external micro is $52.
If both motors are used, command $E9 starts Motor B only. $F9 starts both.
To switch Motor A off, send $D7. Response sent by external micro is $52.
If both motors are used, command $E7 switches off Motor B only. $F7 controls both.
At the start, speed is set to maximum in the external micro. To change to speed, use commands $D6, $E6 or $F6,
followed by the speed value. Speed settings can range from 0 (0V) to $64, which is 100 decimal. The speed setting
is retained in the external controller until changed by another $D6, $E6 or $F6 command. Start and stop commands
DO NOT change the value stored in the speed setting memory. Switching power off and an again will reset speed to
maximum.
To stop the motor(s), two commands are available.
$D7, $E7 and $F7 switch the motor driver transistors off so there is no supply to the the motor(s).
$D8, $E8 and $F8 switch two motor driver transistors off but switch two others on to apply “regenerative braking” to the
motor(s). This causes a more rapid stop.
Many other facilities are available on the IPPIC board if you want to produce a more adventurous program. The limit
switches can stop the motors at chosen points. Then the limit switch can be ignored to allow the motor(s) to run
again. Pulses generated by notched wheels, micro switches or magnetic sensors can be counted.
Limit Switches
To tell the external controller to respond to the switch inputs, send $DC, $EC or $FC commands to make the motors
(A, B or both) respond to the limit switches. When this feature is used, the input terminals (nos. 1 and 3) must be
connected to ground to permit the motors to run. “Normally closed” limit switches will do that, causing the motor(s) to
stop when the switches are pressed. To allow the motors to run again while the switches are pressed, send the
“Ignore Limit” command, $DB, $EB or $FB.
Start the motor(s) again (ON Forward or ON Reverse) and then after the switches have closed, the $DC, $EC or $FC
commands could be sent to allow the switches to become effective again.
Step Counting
Input terminals 2 and 4 are connected to 5V by resistors in the IPPIC so to generate pulses to be counted by the
external micro, these inputs should be switched to 0V for each step. A microswitch, transistor, magnetic sensor or
phototransistor can do this. Pulse width must be at least 10msec. To reduce errors caused by switch "bounce", the
controller requires the input to remain high for at least 10msec before another step will be registered. (Future
versions will allow these time periods to be set via the "config" commands.)
The pulse counts can be read back by the PICAXE using the $D5 or $E5 commands. The response consists of
THREE CHARACTERS followed by a $52 character. The step count is found from:
ASC(First Character) + 256 * ASC (Second Character) + 65536 * ASC(Third Character).
It is not possible to read both step counts together with a single command. An $F5 command is accepted but is
treated as a $D5.