Difference between revisions of "PIC Microcontrollers with C18 Compiler"

From Mech
Jump to navigationJump to search
 
Line 1: Line 1:
__TOC__
==PIC Microcontroller==
==PIC Microcontroller==
The microcontroller used for this project is the PIC18F4431 made by [http://www.microchip.com Microchip]. This is an 8-bit microcontroller with motor PWM generators, a quadrature encoder interface (QEI), and other "peripherals". The microcontroller uses an external 40MHz oscillator.

The microcontroller controls two wheel motors with PWM driving external H-bridges. The H-bridges draw their power directly from the batteries, not regulated power.

Each of the wheels also has a quadrature encoder. The left wheel encoder is connected to the PIC's QEI via a schmitt trigger buffer. The right wheel encoder is wired to a U.S. Digital LS7183 chip (because the PIC only has 1 QEI) which outputs pulses on one of two pins, depending on whether the wheel is spinning backwards or forwards. The two pins are then each connected to a counter on the PIC, which keeps track of the number of pulses. The location of the wheel can be determined by subtracting the reverse-pulse counter from the forward-pulse counter.

The PIC is interfaced with the XBee modem via the RS-232 serial interface.

==Programming the PIC==
==XBee==
==Code==
==PCB==

Revision as of 18:19, 5 July 2007

PIC Microcontroller

The microcontroller used for this project is the PIC18F4431 made by Microchip. This is an 8-bit microcontroller with motor PWM generators, a quadrature encoder interface (QEI), and other "peripherals". The microcontroller uses an external 40MHz oscillator.

The microcontroller controls two wheel motors with PWM driving external H-bridges. The H-bridges draw their power directly from the batteries, not regulated power.

Each of the wheels also has a quadrature encoder. The left wheel encoder is connected to the PIC's QEI via a schmitt trigger buffer. The right wheel encoder is wired to a U.S. Digital LS7183 chip (because the PIC only has 1 QEI) which outputs pulses on one of two pins, depending on whether the wheel is spinning backwards or forwards. The two pins are then each connected to a counter on the PIC, which keeps track of the number of pulses. The location of the wheel can be determined by subtracting the reverse-pulse counter from the forward-pulse counter.

The PIC is interfaced with the XBee modem via the RS-232 serial interface.

Programming the PIC

XBee

Code

PCB