**************************************************** * * * www.eeng.biz - PIC16F887 experimental board. * * * * rev. 1.0 (october 2007) * * * **************************************************** DISCLAIMER - All the code is provided 'as-is' with no warranty express or implied. The code and the documentation can't be re-distributed without permission of the authors. e00.asm Before starting an assembly language program, we can begin with a template. The e00.asm template reminds the basic settings required to write a program for the PIC16F887 experimental board. The '__CONFIG' directive is used to embed configuration data within asm file. The internal oscillator circuit is used to generate the device clock (fosc = 4 MHz by default). RA0, RA2, RA3 are configured as analog inputs; RC0/3, RA6 and RA7 will be used to control an LCD; two LEDs are connected to RB4, RB5. RB6, RB7, RB3 are seserved for ICSP programming. RC6 and RC7 are used as the EUSART port. Adding other parts requires configuring ports/registers properly. e01a.asm A blinking LED is the equivalent 'Hello world!' project for microcontrollers. This program blinks LED1 and LED2 alternately at a rate of about 1 Hz. Delays are generated by software loops. e02a.asm This program shows how to configure the EUSART module. A step-by-step guide can be found in the datasheet of the PIC16F887. Hyperterminal must be configured for the desired COM port at 9600 baud and 8N1 (data bits = 8, parity = none, stop bits = 1). e02b.asm With this experiment we evaluate a novel feature of the PIC16F887. This microcontroller supports auto-baud detection. Once the calibration is finished, SPBRGH and SPBRG are loaded with proper values. To appreciate this feature, try sending data at *any* baud rates (19200 baud max.). e02c.c Serial communication with C (HI-TECH PICC LITE). e03a.asm With this experiment the state of LED1 and LED2 are changed each time a button is pressed. The switch is polled and 'de-bounced'. Note that an internal pull-up resistor is used. e03b.asm Same as e03.asm, but each time the switch changes its state an interrupt occurs. e04a.asm An analog temperature sensor (LM335) is connected to RA0. We will give you an example experiment that samples the analog voltage with 8-bit resolution and sends the result via RS-232. e05a.asm This is a basic program that initializes an hd44780-based LCD and writes a message. e05b.asm This programs shows the result of A/D conversions on the display.