Charles,
Just for an additional example and reference, I posted a 9600 baud half-duplex example on PICLIST several years ago that uses Timer 2 and IOC. I also have a full-duplex demo and another half-duplex demo that uses Timer 0 that shows how to reload a free-running 8 bit timer.
Hope the examples help. Have a great day.
Regards, Mike
Code:
;******************************************************************
;* *
;* Filename: 12F683 Half-Duplex 9600 Demo.asm *
;* Author: Mike McLaren, K8LH (k8lh_at_arrl.net) *
;* Date: 02-Jun-05 (last revision 02-Dec-05) *
;* *
;* Half Duplex Bit-Banged 9600 Baud Serial I/O Demo *
;* (with 16-byte circular receive character buffer) *
;* *
;* ·Uses 12F683 INTOSC running at 8-MHz *
;* ·Bit rate error 0.16% plus or minus 1.0% for INTOSC *
;* ·Bit-banged 9600 baud serial I/O *
;* ·Half Duplex (should not TX and RX simultaneously) *
;* ·TMR2 interrupts at 104-usec intervals (every 208 *
;* instruction cycles) and IOC (interrupt on change) *
;* for RX start bit leading edge detection on RXPIN *
;* ·Circular 16-byte RX character buffer *
;* ·Inverted TX and RX signals (MAX232A or similar *
;* inverting RS-232 interface required) *
;* ·Relatively small - the ISR and the support routines *
;* Init232, Put232, and Get232 use 102 words of code *
;* space at locations 0004 through 0069 *
;* ·Worst case 23% ISR 'overhead' (24-usecs) when a *
;* complete RX character is added to the circular *
;* buffer once every 1.04-msecs while receiving *
;* *
;* MPLab: 7.21 (tabs=8) *
;* MPAsm: 4.02 *
;* *
;******************************************************************
Bookmarks