You are on page 1of 3

AN706: Motor Mind C control using a Microchip PIC16f73 1

Overview:
This application note describes how to control the Motor Mind C (MMC) with
Microchip's PIC16F73 microcontroller using the MMC's SetDC command as well
as how to detect and clear fault conditions. This application note implements a
simple serial control interface of the Motor Mind C (MMC) in both PIC assembly
language and PIC MCU C. Five PIC16F73 pins are used as button inputs. Each
button press sends a specific motor speed and direction command to the MMC.

Button 1 = -75% duty cycle


Button 2 = -25% duty cycle
Button 3 = 0 duty cycle
Button 4 = 25% duty cycle
Button 5 = 75% duty cycle

The PIC monitors the status byte of the MMC once a second to determine if a
fault condition has occurred. If a fault occurs, an LED will light up. The fault
condition will be cleared on the next button press prior to altering the duty cycle,
turning off the LED.

Schematic:
VCC_MOTOR VCC_5VDC
MC7805B-D2T
R1 U1
1.0 Ohm
1 3
2 VIN VOUT
GND C2 C4 R2
C3 C1 + + 10uF 25V 0.1 uF 1.0K
0.1 uF 330uF 35V

NOTE: PORTB SW1


PIC16F73 INTERNAL PULL-UPS NO momentary detector
U2 ENABLED VCC_5VDC 1 2

VCC_MOTOR R3 SW2
1.0K 1 28 NO momentary detector
NOTE: SECOND 2 MCLR RB7 27 1 2
MOTOR MIND C D1 3 RA0 RB6 26
MOTOR NOT SHOWN
Green 4 RA1 RB5 25 SW3
FOR CLARITY RA2 RB4
5 24 NO momentary detector
1 40 6 RA3 RB3 23 1 2
MOTOR VMOT VMOT RA4 RB2
2 39 7 22
M- 3 VMOT VMOT 38 8 RA5 RB1 21 SW4
4 VMOT VMOT 37 9 GND1 RB0/INT 20 NO momentary detector
5 M1- M2- 36 10 OSC1 VCC 19 1 2
6 M1- M2- 35 Y1 11 OSC2 GND2 18
7 M1- M2- 34 4.00MHz 12 RC0 RC7/RX 17 SW5
8 M1+ M2+ 33 1 2 13 RC1 RC6/TX 16 NO momentary detector
9 M1+ M2+ 32 14 RC2 RC5/SDA 15 1 2
10 M1+ M2+ 31 4 3 RC3 RC4/SCL
11 NC NC 30
12 GROUND GROUND 29
M+ 13 GROUND GROUND 28 C5 C6
14 GROUND GROUND 27 27 pF 27 pF
15 AIN1/RC1 NC 26
16 AIN2/RC2 NC 25
17 NC MODE1 24
18 NC MODE0 23
19 NC NUM_MOT 22
20 NC ADDR 21
TM FM
AN706: Motor Mind C control using a Microchip PIC16f73 2

Flow Chart:

PIC Port and Register Initialization

No

Has 20ms
elapsed?

Yes

Is a button Update PWM registers


Yes
being and send duty cycle
pressed? information to MMC

No

Decrement main
loop counter

Have we
Yes
No gone through the Reset loop
main loop 50 counter
times?

Check MMC
status

No Is there
Clear fault
a fault
LED
condition?

Yes

Set fault
LED

Attempt to
clear fault
AN706: Motor Mind C control using a Microchip PIC16f73 3

Source Code:

Complete source code can be found on the Solutions Cubed website:


www.solutions-cubed.com. See AN706_asm.zip and AN706_c.zip.

You might also like