title "Roger v.1.1 - created by OK1MPE" list P=12F508, F=INHX8M INCLUDE __config 0FEAH ; _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF ; --------------------------------------------------------------------- ; ; This software is free for private usage. It was created for HAM radio ; community members. Commercial exploatation is allowed only with ; permission of author. ; ; (C) Petr Bittnar, OK1MPE (ok1mpe@qsl.net), CZ, www.qsl.net/ok1mpe ; ; --------------------------------------------------------------------- ; ; History: ; 27.07.10 procesor 12F508 add "K" ; 25.03.01 * v.1.1 - add on/off function ; 19.03.99 * v.1.0 - first public version ; ; --------------------------------------------------------------------- ; ;********************************************************************** ;* RC int., Tcpu=1us, 12F508 MPASM 2.30 25.3.01 * ;********************************************************************** ; ; Vdd -| U |- Vss ; ptti -| |- D0 ; ptto -| |- D1 ; D2 -| |- mod c equ 0 ;def. c,dc,z - status dc equ 1 z equ 2 d0 equ 0 ;def. GPIO d1 equ 1 d2 equ 3 mod equ 2 ptto equ 4 ptti equ 5 ;definition RAM (registers): rtcc equ 1 pc equ 2 status equ 3 fsr equ 4 osccal equ 5 gpio equ 6 freq equ 10 delay equ 11 temp equ 12 ;********************************************************************** ;* M A C R O * ;********************************************************************** ton macro freq_,delay_ movlw freq_ ;settings parameters (freq and delay) movwf freq ; movlw delay_ ; movwf delay ; call gen_ton ;call subrutine for generation wave endm org 0 ;reset vector movwf osccal ;calibration value for RC osc. ;********************************************************************** ;* settings ports, prescaler ... * ;********************************************************************** ;ports: 0-output, 1-input start movlw b'00101011' ;settings GPIO tris gpio ; clrf gpio movlw b'10000111' ;ps 1:256, pull-up option ; ------------------------ on/off function ---------------------------- movlw .80 ;timer 2s movwf temp ;(80 x 25) onoff btfsc gpio,ptti ;release PTT key? goto main ;yes goto main call wait ; decfsz temp ;timer overflow? goto onoff ;no repeat roger_off goto roger_off ;yes turn permanently off ; ------------------------ main rutine ------------------------------- main btfsc gpio,ptti ;wait for PTT key (press) goto $-1 ; call wait ;wait a moment btfss gpio,ptti ;wait for PTT key (release) goto $-1 ; bsf gpio,ptto ;PTT output = H (TX on) call wait ; call wait ;wait 100ms call wait ; call wait ; clrf temp btfss gpio,d0 ;read input pins D0-D2 bsf temp,0 ; btfss gpio,d1 ; bsf temp,1 ; btfss gpio,d2 ; bsf temp,2 ; movfw temp addwf pc goto typ1 ;typ 1 goto typ2 ;typ 2 goto typ3 ;typ 3 goto typ4 ;typ 4 goto typ5 ;typ 5 goto typ6 ;typ 6 goto typ7 ;typ 7 goto typ8 ;typ 8 typ1 ton .208,.56 ;800Hz, 70ms goto quit typ2 ton .119,.98 ;1400Hz, 70ms goto quit typ3 ; "K" ton .167,.90 ;1000Hz, 90ms call wait ; ton .167,.40 ;1000Hz, 40ms call wait ; ton .167,.90 ;1000Hz, 90ms goto quit typ4 ton .100,.60 ;1200Hz, 50ms ton .228,.37 ;700Hz, 50ms ton .167,.50 ;1000Hz, 50ms goto quit typ5 ton .167,.70 ;1000Hz, 70ms ton .83,.141 ;2000Hz, 70ms goto quit typ6 ton .83,.141 ;2000Hz, 70ms ton .167,.70 ;1000Hz, 70ms goto quit typ7 ton .208,.40 ;800Hz, 50ms ton .167,.50 ;1000Hz, 50ms ton .139,.60 ;1200Hz, 50ms goto quit typ8 ton .139,.60 ;1200Hz, 50ms ton .167,.50 ;1000Hz, 50ms ton .208,.40 ;800Hz, 50ms goto quit quit call wait ;wait a moment bcf gpio,ptto ;PTT output L (TX off) call wait ; goto main ;********************************************************************** ;* S U B R U T I N E S * ;********************************************************************** ;subrutine: generation wave gen_ton movfw freq ;set temp from freq movwf temp ; bsf gpio,mod ;modulation = H loop_hi decfsz temp ;repeat while temp>0 goto loop_hi ; movfw freq ;set temp from freq movwf temp ; bcf gpio,mod ;modulation = L loop_lo decfsz temp ;repeat while temp>0 goto loop_lo ; decfsz delay ;repeat while delay>0 goto gen_ton ; retlw 0 ;---------------------------------------------------------------------- ;subrutine: wait 25ms wait movlw .158 ;(256-158)x256us movwf rtcc ;rtcc=25ms movfw rtcc ;read rtcc btfss status,z ;overflow? goto $-2 ;no repeat retlw 0 ; end