Programming the MicroChip PIC16F877/18F452 using CCS "C"
12/08/00 EWJNote: When programming and debugging the robot always make sure the robot wheels are elevated off of the bench.
Overview:
Be sure to read Guide to Robot Hardware before attempting to program.
The PIC16F877/18F452 is a Microprocessor based system, including input and output (I/O) interfaces, on a single integrated circuit. This type of device is called a Microcontroller.
The '877/452 device contains several features that are useful when using the device to control a process. Not all of the features of the '877/452 are available at the same time so when the device is used in an application such as the robot choices must be made as to what features are going to be in the overall design.
Your Program:
The beginning of your program must include the following statement:
#include "yale.h"
Reserved Constants:
All_out
All_in
Robot Functions:
|
Function name |
Description |
Location |
Returns |
||
|
Init_PWM() |
Configure Pin 3 of JP8 as PWM1 Configure Pin 4 of JP8 as PWM2 Set the timer 2 clock for PWM rate |
Yale.h |
None |
||
|
Init _AD() |
Configure A/D clock and set all 8 analog inputs as active |
Yale.h |
None |
||
|
Init_Timer0() |
Initialize timer 0 for interrupt |
Yale.h |
None |
||
|
Clock_isr() |
Interrupt service routine |
350a2005.c |
None |
||
|
LCDmessage(char) |
Builds an array of characters to be sent to display one character at a time at interrupt. |
350a2005.c |
None |
||
Sample Programs
: