12-1-02
This will document my exploits into using the PIC microcontrollers from Microchip. I hope to eventually create a webpage to share all my newly acquired knowledge with others.
My interest in these devices is their use in music equipment and model rocketry. There may be some sojourns into other projects along the way.
The resources I have so far are:
The PIC16F84 was chosen because it is the one recommended by Dave Benson to learn. It is an EEPROM type device so it can be programmed multiple times. I am interested in creating a remote effects switching system similar to the ones used by professional guitarists on concert stages. I plan to use MIDI as the data bus because it uses current mode which is less susceptible to electrical noise from lights and other sources than a voltage mode bus such as RS-232.
12-21-02
My first step was to assemble the Kit 81 which entailed going to their website for updated instructions and software. It was very easy to download and came with a manual in .pdf format. There was also zipped software for use in Windows. The original kit comes packaged with a 3.5" floppy disc that I believe has software that runs from the DOS command line.
The assembly was fairly easy although the kit was old and had oxidation on the printed circuit board. I tried soldering some components and ended up with some cold solder joints for my effort. I used solder wick to remove these and then had a couple of lifted pads. This is a lesson in electronic kit building that for some reason I had forgot. I then washed the board with alcohol and a copper pot scrubber. The rest of the assembly went well after that and I just added a jumper wire to repair the damage I had originally caused.
The next step was to wire up a power source which can be either an 18 volt DC or a 13 volt AC type. The rectifier and regulators are built into the Kit 81. I chose the 13 volt AC route because I had a transformer in my box of parts. I mounted the Kit 81 and the transformer to a block of wood and hooked up the parallel cable borrowed from my photo scanner.
I then followed their instructions to program the PIC16F84 to flash an LED and then moved it to the test socket. It worked the first time. The Kit 81 provides a test socket that has five LED’s attached to the PIC output pins. This is handy to do some initial verification when first starting out. I also tried some of the other test programs that came with the kit. These flash the LED’s in different patterns. I will add a proto-board to the wood block to start experimenting with more advanced circuits.
First, I will have to load a version of MPLAB on my computer. This is software from the PIC’s manufacturer, Microchip, that has an assembler and will create the .hex files that the programmer uses when "burning" the microcontroller. The Myke Predko book I have came with a CD ROM that has a version of MPLAB on it.
I am planning on loading it on my old 486 PC and dedicating that computer for experimenting. I have already used it when I was experimenting with BASIC Stamps. The Stamp is a PIC based microcontroller that programs in a BASIC type language and needs no programmer to use. I also run a powerful DOS based circuit simulator called Berkley SPICE.
12-28-02
I decided to load the MPLAB onto my more modern MII Cyrix 266 (P2 clone) personal computer since I would have had to crawl under the desk everytime I wanted to switch over to the 486 and run PIC applications and plug the monitor into the 486. I had heard of a switcher box that would allow the use of two different PC’s with the same peripherals (monitor, keyboard, mouse etc.) but at $100 and another $40 in cables made that an unattractive alternative.
I loaded MPLAB from the CD ROM provided in Myke Predko’s book into a separate folder from the Kit 81 software. I did this because if I had to unload it, I didn’t want to be guessing which files belonged with which application. I figured I would try moving the ‘assembled’ files (.hex) into the programmer directory as needed. It turned out this was not necessary and I could run the programmer and use the .hex file from the MPLAB directory. I quickly modified the flashing LED program to use different patterns and programmed my PIC16F84 with my own version of this simple program.
My next task is to assemble an ’84 ON A BOARD as detailed in Dave Benson’s book, Easy PIC’n. This is a test board that provides all the input/output devices needed to run the experiments in that book and his next, PIC’n Up The Pace. I’ll build the circuit on the proto-board I added to my programmer.
01-05-03
I have been busy setting up a test circuit for my PIC micro- controller. I found a 4MHz clock module at Fry's Electronics, but they don't provide the pinout details so I have few clues on how to connect it. It is manufactured by Fox Electronics so I looked for a data sheet on their web site. The module I have wasn't listed and is probably obsolete so I hooked it up like the modules they produce now. This also was the way my Easy PIC'n book showed to hook it up. Unfortunately, it didn't work. I guess I'll try and contact their Tech support and see if I can get it working.
Meanwhile, I went back to using the RC (resistor/capacitor) type oscillator and started trying out different routines to flash my LED's. This involves learning the different commands that can be used by the assembler to operate on the different registers in the microcontroller and sending the results to an output port where the LED's are connected.
I was not able to find a ZIF (zero insertion force) socket for the microcontroller chip. During the experimental stage, I have to often move it from the programming socket to the test circuit socket which could result in bent pins. I am using extra sockets on top of other sockets so if I damage a pin, it will only be a 35 cent socket and not my microcontroller chip.
01-12-03
Fox Electronics came through for me! They had to go into their archives to find the information and then they sent it to me in .pdf format. It turns out that the chip I bought was not a self contained clock generator, but a crystal. The part had been obsolete for 16 years. I needed to find two 20 pF capacitors to go with it and then change the configuration command and reprogram my PIC. It worked the first time so now I am able to use a highly accurate 4Mhz clock for my experiments.
I am next going to interface the PIC with a dual 7-segment display I found in my parts box. That will entail taking a binary coded decimal (BCD) number and calculating the correct output pattern to display that digit on the 7-segment display. Since it is a two digit display and the PIC16F84 only has 13 output pins, it would not be able to drive the entire display. That would take 14 outputs for the display segments. Instead, I am going to use a multiplexing routine which I can do with nine output pins; Seven for the segments and two enables. The two 7-segment displays will never be on at the same time, but the human eye will not notice that except for a slight flicker.
I am then going to use the dual 7-segment circuit to select Power Ball numbers. That will mean having to randomize the digits that are output without duplicating the first group of numbers and then put out a random Power Ball number. I will probably use a pushbutton that can be pressed to sequence the numbers. The pick will be cycling through the numbers waiting for the button to be pushed and then will display the number it was currently on. This will give pretty good randomization because of the human factor of pushing the button. I have noticed that letting the lottery machines pick the numbers gives a somewhat unrandom result since their algorithm is computer based.
11-15-03
Well you may have noticed that I have not done any work on PICS in a while. All my attention has been on my amplifier projects so please check it out.
Home Page