Upload
chelcho
View
22
Download
0
Embed Size (px)
Citation preview
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 cycleButton 2 = -25% duty cycleButton 3 = 0 duty cycleButton 4 = 25% duty cycleButton 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:
C627 pF
NOTE: PORTBINTERNAL PULL-UPSENABLEDU2
PIC16F73
20
2
21
34
111213
567
14
8
19
1
1817
22232425
2728
1615
910
26
VCC
RA0
RB0/INT
RA1RA2
RC0RC1RC2
RA3RA4RA5
RC3
GND1
GND2
MCLR
RC7/RXRC6/TX
RB1RB2RB3RB4
RB6RB7
RC5/SDARC4/SCL
OSC1OSC2
RB5
R11.0 Ohm
VCC_MOTOR
SW4NO momentary detector
1 2
NOTE: SECONDMOTOR NOT SHOWNFOR CLARITY
VCC_MOTOR
C30.1 uF
+C1330uF 35V
SW2NO momentary detector
1 2
SW1NO momentary detector
1 2
U1MC7805B-D2T
12
3VINGND
VOUT
C527 pF
VCC_5VDC
C40.1 uF
Y14.00MHz
21
4 3
R31.0K
+C210uF 25V
D1Green
R21.0K
VCC_5VDC
MOTORM-
M+
SW5NO momentary detector
1 2
MOTOR MIND C
123456789
1011121314151617181920 21
22232425262728293031323334353637383940VMOT
VMOTVMOTM1-M1-M1-M1+M1+M1+NCGROUNDGROUNDGROUNDAIN1/RC1AIN2/RC2NCNCNCNCTM FM
ADDRNUM_MOT
MODE0MODE1
NCNC
GROUNDGROUNDGROUND
NCM2+M2+M2+M2-M2-M2-
VMOTVMOTVMOT
SW3NO momentary detector
1 2
AN706: Motor Mind C control using a Microchip PIC16f73 2
Flow Chart:
Update PWM registersand send duty cycleinformation to MMC
Is a buttonbeing
pressed?
Has 20mselapsed?
PIC Port and Register Initialization
Yes
No
Decrement mainloop counter
Have we gone through the
main loop 50 times?
No
No
Yes
Reset loopcounter
Check MMCstatus
Yes
Clear faultLED
Is therea fault
condition?
No
Set faultLED
Attempt toclear fault
Yes
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.