TC's PIC Stuff

 
March '04

 

I got interested in doing a little PIC microcontroller programming in early '04 when converting my Stuart RC tank for RC Tank Combat.

I got started cheaply using Celestial Horizon's CH Basic Flash Edition Intrepreter/Compiler in conjunction with Microchip's MPLAB IDE, and the NOPPP (almost no parts) PIC programmer. I then moved into doing some straight assembler. The following are some of my projects.

Feel free to use whatever at your own risk. I would appreciate credit where credit is due if you actually end up using any of my spaghetti code!

As an fyi, I've found the PICLIST to be a great online resource as well as some of the info available via the online version of the PIC Source Book on the Dontronics site.

 

My Projects

21st Century RC Stuart Tank conversion for RC Tank Combat

 
Stuart
Code for a PIC 16F84A to drive two common RC servos. One servo is driven slowly from end- to- end to provide elevation & depression (or any type of movement that requires a precise fixed position for that matter). Input is on two pins, one each for up and down (or left-right, you get the picture). The second servo is cycled from midpoint to end and back in a continuous motion to fire a paintball marker. The HEX version can be directly programmed to a 16F84A.

CH Flash Basic Code

Assembler Code

Hex Code

SteerMixer
After learning a little about driving servos, I decided to try decoding the output from an RC receiver. This code for a PIC 16F84A was to implement a simple skid-steer mixer (to drive a tracked vehicle like a bulldozer with a single stick). The mixer takes two inputs, one for steering and one for throttle and mixes them together to drive two motors in forward and reverse, single speed. The mixer can be implemented directly into the RC Stuart. Check out my Stuart webpage for schematic details.

CH Flash Basic Code

Assembler Code

Hex Code

SteerMixer628
Basically the same as SteerMixer but for the PIC 16F628. This version uses some inline assembler code to make the counting loop more efficient.

CH Flash Basic Code

Assembler Code

Hex Code


LCD Projects

 
RCPulseCnt
Getting a little more confident, I decided to try something in assembly language. I found a great little 8x2 serial LCD on eBay. The display is the Picvue PC-064PYL. Email the seller for info and pricing.. I decided to try a project to use it. When writing the mixer code I found it would have been nice to be able to quickly measure the output of an RC receiver to see what sort of pulse widths made up the PPM signal. This project does just that. It's coded to use the PIC 16F628. It measures single pulsewidth from 0 to 2.5 milliseconds to about +/- .01ms accuracy. Fine for doing rough pulsewidth measurements on an RC receiver or simply testing to see if it works. The only external parts required are the resonator & caps, two 4.7K ohm resistors, and the display.

Assembler Code

Hex Code