; -*- tab-width: 4 -*- ; 19.2Kbps Serial Bitbang Routine ; For use on HOODMICRO PIC12F6XX at 4MHz ; ; Copyright (c) 2005, K9spud LLC. ; http://www.k9spud.com/hoodmicro/ ; ; This program is free software; you can redistribute it and/or ; modify it under the terms of the GNU General Public License ; as published by the Free Software Foundation; either version 2 ; of the License, or (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. processor 12F629 TX_PIN equ 2 STATUS equ 3 Z equ 2 C EQU 0 GPIO equ 5 INTCON equ 0x0B GIE equ 7 global _putch signat _putch,4216 psect text0,local,class=CODE,delta=2 psect text0 ;; ?a_putch+0 - sendbyte ;; ?a_putch+1 - sendbitcount _putch: movwf ?a_putch+0 ; save the byte to send to local data space movlw -9 ; send 8 bits movwf ?a_putch+1 SerialSend: bcf INTCON, GIE ; disable interrupts, timing critical code movf GPIO, w ;; Number of clock cycles (at 1us per clock) for 19.2Kbps serial send: ;; 56us too slow, garbage ;; 54us works ;; 52us works - recommended setting ;; 50us works ;; 48us too fast, garbage ; initially send start bit LowBit: iorlw (1<