v Instructions on Building and Integrating your PIC Board, H-Bridge, and Electromagnet Drive
Ø Building your Microcontroller
Ø Integrating the PIC with the H-Bridge (this one is key; now updated to show MOSFET pinout)
v PIC C Code for 16F876A in the Crane Project
Ø Pushbutton toggles with key bounce logic
Ø Push to hold logic (New April 18)
v Manuals
Ø The CCS PIC C Compiler Manual – a free PDF file for download from the Microchip web site!
Ø Introduction to PIC C – about $30.00 from Microchip. Dr. Beard has a copy if you want to see one.
v Instructions for setting up workstations in Rowan Hall room 237 to program your PIC project board
Please begin with main01.c or main02.c for your project and
modify it to suit the way you decided to build your interface. Note that the demo we ran used main01.c, and
that main02.c has examples for push-and-hold pushbuttons.
You are hooking together all these things:
v
Pushbuttons and thumbwheels, either the
interface for your project or a breadboard,
v
The PIC project board,
v
The two CMOS chips,
v
The H bridge
v
The electromagnet drive, and
v
The electromagnet.
The process of debugging everything and getting it working
is something I've shown several teams.
It goes like this:
At each stage, you may need to fix or change a couple of
things. The point is that you are
working through the system, point by point, getting things working from the
input to the output.
Run the PIC in the debug mode while a watch window for local
variables is open. You can check the
bits that are being put out on the pins of the PIC by looking at the values of
the local variables in the watch window as you step through the program. You can also check them on the PIC board with
a voltmeter or oscilloscope. There are
some input and output pins on the PIC that can't or shouldn't be changed:
v
The A bus pins are analog input pins. Use A0 for the forward-backward thumbwheel
input and use A1 for the up-down thumbwheel.
If you omit one or both of these thumbwheels from the interface, put it
on the PIC board so that you can control the motor speeds as a setup
adjustment.
v
The PWM outputs are on pins C1 for the up-down
and C2 for the forward-back; this is hard-wired within the PIC and can't be
changed. The up-down toggle signal is on
pin C0 and the forward-back toggle signal is on pin C3, and our wiring examples
on the presentation "Integrating..." show the use of these pins. I believe that the magnet drive output is on
pin C4.
v
In my sample programs, I used the B bus pins for
pushbuttons.
Make sure that the notches on the chips (the end with pins 1
and 14) are pointing away from the eight-connector jack to the H-bridge, and
that you have power on pin 14 and ground on pin 7 of both CMOS chips. On the CD4069 hex inverter, the chip nearest
the eight-pin connector, you should see these signals with an oscilloscope:
v
Pins 3 & 4 should be the complement of each
other, and pin 3 should drive a P channel MOSFET (off is high) and pin 4 should
drive an N channel MOSFET (off is low).
Likewise pins 5 & 6. When you
toggle forward-back, the PWM should switch back and forth from 3 & 4 and 5
& 6. Likewise, 11 & 10 and 9
& 8 are the equivalent pins driving the up-down motor.
v
The hookup of the CMOS inverter to the
eight-connector jack for the H-bridge control is critical. You can use the picture on slide 13 to make
sure that the connections are right.
v When you plug in the H-bridge to the PIC board, make sure that you aren't one pin off one way or the other.
Click here for a PDF file. Press F7 to look at it in Acrobat full-screen mode, similar to PowerPoint’s Slide Show mode.
Click here for the presentation given on April 2 (188 K PowerPoint file).
Click here for the presentation given on April 9 (1.8 MB PowerPoint file) including chip pin outs, wiring diagram, and photos. Updated April 26.
You can use one of these programs as a starting point in the code for the PIC 16F876A for your project.
Click here to download version 01 of quick start baseline PIC software. This version uses pushbuttons to toggle propulsion, lift, and magnet on-off, with key bounce logic. File name is main01.c
Click here to download version 02 of quick start baseline PIC software. This version uses push-and-hold logic; two pushbuttons are used for propulsion, one for forward and one for back, and two pushbuttons are used for lift and lower. A single pushbutton is used with push-and-hold for magnet actuation. File name is main02.c
Click here to download the CCS PIC C compiler manual as a PDF file from the CCS web site. CCS sold us multiple licenses but gave us only one paper manual. But, you can browse the PDF file on your own machine for free.
Click here for the CCS web site page where you can purchase Introduction to PIC C by Nigel Gardner for $29.95 plus shipping.
Click here to see step-by-step instructions on bringing up your in-circuit debugger and programmer for your PIC project board. NOTE: We will have a workstation dedicated to PIC programming in Rowan Hall 237 on April 19.