PROCESSOR 16F84 include "P16F84.inc" __config _CP_OFF & _PWRTE_ON & _WDT_ON & _XT_OSC radix dec ; decimal numbers by default cur_reg set 0x0c ; first general-purpose register register macro name name equ cur_reg cur_reg set cur_reg + 1 endm MY_CIV_ADDR equ 0x22 ; should not conflict with the address of any ICOM radio CIV_PREAMBLE equ 0xfe CIV_EOM equ 0xfd CONTROLLER_CIV_ADDR equ 0xe0 CIV_OK equ 0xfb CIV_NG equ 0xfa WRITE_RELAY_CMD equ 0x05 READ_RELAY_CMD equ 0x03 ; after 120 seconds without a relay-setting command, ; we time out and turn them all off. TIMEOUT_CONST = (120 * 1000000 / 65536) - 1 CIV_BIT equ 4 ; Bit 4 (of port B) is the CIV interface line LED_BIT equ 5 ; Bit 5 (of port B) is connected to a LED ; Bits 6 and 7 of port B are reserved for in-circuit programming ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; org 0 reset: goto start ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; register cur_cmd register cur_src_addr register cur_dest_addr register cur_arg register cur_tmp register cur_arg_cnt register timeout_counter_msb register timeout_counter_lsb register timeout_flag ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; org 5 start: bsf STATUS,RP0 ;switch to bank 1 ; Options: 1:256 prescaler on timer, driven by internal clock movlw 1<