TITLE "SERIAL.ASM - Use a Simulated Serial Interface in 16F84" ; ; SERIAL - This Routine Uses the Specified "Serial" Macro. ; ; ; Myke Predko ; 99.07.05 ; ; ; Hardware Notes: ; Simulated 16F84 Running at 4 MHz (1 usec/instruction) ; PA4 - Input ; PA3 - Output ; LIST P=16F84, R=DEC ERRORLEVEL 0,-305 INCLUDE "p16F84.inc" include "vars.inc" include "nointser.inc" ; include "intser.inc" __CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON ; Variables VarStart 0x0C #define TX PORTA, 3 #define RX PORTA, 4 ; Macros ; Mainline org 0 Mainline ; NRZSerialInit 4000000, 1200, 1, TX, RX, 0, 0, 0 NRZSerialInit 4000000, 1200, 1, TX, RX, 2000 ; TimeOut After 2 Seconds movlw 'A' ; Output an "A" at 1200 BPS call NRZSend Loop ; Loop Forever After Byte Sent call NRZReceive btfsc STATUS, C ; No Character, Skip Over goto NoChar ToUpper: addlw 255 - 'z' ; Get the High limit addlw 'z' - 'a' + 1 ; Add Lower Limit to Set Carry btfss STATUS, C ; If Carry Set, then Lower Case addlw h'20' ; Carry NOT Set, Restore Character addlw 'A' ; Add 'A' to restore the Character call NRZSend goto Loop NoChar ; No Character, Mark with a "." movlw "-" call NRZSend goto Loop NRZSerialRoutines End