;********************************************************************** ; ; Filename: telemetry 147.asm ; Date: 1-15-05 ; File Version: 1 ; Author: j baumeister ; Company: himself ; ;********************************************************************** ; KD5ZUG telemetry transmitter control program. ; All rights reserved ; Notes: This program is designed to modulate a small FM transmitter ; with "beeps" that can be used in radio location. It transmitts a call ; sign after 16 beeps. ;********************************************************************** list p=12F675 ; list directive to define processor #include ; processor specific variable definitions errorlevel -302 ; suppress message 302 from list file __CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT ; '__CONFIG' directive is used to embed configuration word within .asm file. ; The lables following the directive are located in the respective .inc file. ; See data sheet for additional information on configuration word settings. ;******************************************************************** ;Reset Vector ******************************************************* ORG 0x000 ; processor reset vector nop ; Inserted For ICD2 Use goto Init ; go to beginning of program ;***** Assign Constants Value *********************************************** #define BANK1 banksel 0x80 ;Select Bank1 #define BANK0 banksel 0x00 ;Select Bank0 ;****** Reserve Space for Variables (file registers) ******************** org 0x20 ; start at memory location Hex 20 ; assign 1, 8 bit byte of memory to e count res 1 ; used to adjust the delay time Dit res 1 ; dit length Dah res 1 ; dah length Pause res 1 ; pause length count2 res 1 ; number of readings before transmit count3 res 1 ;**************************************************************************** ;Initialization ;**************************************************************************** Init BANK1 ; Switch to Bank1 call 0x3FF ; retrieve factory calibration value movwf OSCCAL ; update register with factory cal value movlw B'11101011' ; pin 5& 3 are outputs and pins 2,4,7,6 are inputs_ movwf TRISIO ;_bit0=7,bit1=6,bit2=5,bit3=4,bit4=3,bit5=2, ;_1=input, 0=output movlw B'11010101' ; set internal clock(5),prescale =1:64 assigned to TIMER0_ movwf OPTION_REG ;_bit0-2=prescale(100=1:32),bit3=prescale=TIMER0 (=0)_ ;_bit4=trailing edge,bit5=internal clock(0) ;_bit6=int (1=rising), bit7=pullups (diabled=1) clrf VRCON ; Vref Off (power off the comparator voltage,saves power) movlw b'01010011' ; Configure pin 7 as anlog, Tad=16us_ movwf ANSEL ;_bit0=7,bit1=6,bit2=5,bit3=3 (1=analog,0=digital) ;_bit4-6= A/D clock osc value (101=16) BANK0 ; BANK 0 clrf TMR0 ; clear TIMER 0 clrf GPIO ;Clear all Ports movlw 0x07 movwf CMCON ; Comparator Off, bit0,1,2=1 (00000111) movlw 0x0f ;number of transmissions before call sign ID movwf count3 ; ;**************************************************************************** ;MAIN - Main Routine ;**************************************************************************** Main call Speed_M ;if pin 4 is high set as 50 WPM. ;*************************************************************** call xmit_on ; turn transmitter on call _dah ; transmit dah call xmit_off call Delay_M decfsz count3,f goto Main ; do it again call xmit_on call C_sign ;transmitt call sign movlw 0x0f ;number of transmissions before call sign ID movwf count3 ; call xmit_off goto Main ;******************************************************************** ; Sub Routines ;******************************************************************** Speed_L ; set at 5 WPM movlw 0x55 movwf Dit movlw 0xff movwf Dah movlw 0x0b movwf Pause return ;******************************************************************* ;******************************************************************* Speed_M movlw 0x20 movwf Dit movlw 0x50 movwf Dah movlw 0x04 movwf Pause return ;*************************************************************** Speed_H ;set at 10 WPM movlw 0x10 movwf Dit movlw 0x30 movwf Dah movlw 0x02 movwf Pause return ;******************************************************************* ;****************************************************************** xmit_on ; Turns transmitter on bsf GPIO,2 ; turn pin5 high, turns transmitter carrier "on" call pause call pause call pause nop nop nop nop nop return ;******************************************************************* xmit_off bcf GPIO,2 ; turns transmitter "off" return ;******************************************************************* dit movf Dit,0 ; load dit duration value movwf count ; load the dit duration time into the countdown file call Tone ; call the tone generation subroutine call pause ; space return ;****************************************************************** dah movf Dah,0 ; load dit duration value movwf count ; load the dit duration time into the countdown file call Tone ; call the tone generation subroutine call pause ; space return ;****************************************************************** pause ; Pause between Morcse characters movf Pause,0 movwf count pause_1 bcf INTCON,2 P_loop btfss INTCON,2 goto P_loop decfsz count,1 goto pause_1 return ;*************************************************************** Tone ; 700 Hertz tone bcf INTCON,2 ;clear timer interupt flag movlw 0xf5 ;f4=640Hz movwf TMR0 bsf GPIO,4 ; start tone modulation, turn pin4 "on" high_ btfss INTCON,2 ; timer 0 overflow interup flag goto high_ ; delay loop bcf INTCON,2 ;clear timer interupt flag movlw 0xf5 movwf TMR0 bcf GPIO,4 ;turn pin4 "off" low_ btfss INTCON,2 ; timer 0 overflow interup flag goto low_ ;delay loop decfsz count,1 goto Tone return ;*************************************************************** Tone2 ; extra tone not used bcf INTCON,2 ;clear timer interupt flag movlw 0xd0 movwf TMR0 bsf GPIO,4 ; start tone modulation, turn pin4 "on" high2_ btfss INTCON,2 ; timer 0 overflow interup flag goto high2_ ; delay loop bcf INTCON,2 ;clear timer interupt flag movlw 0xd0 movwf TMR0 bcf GPIO,4 ;turn pin4 "off" low2_ btfss INTCON,2 ; timer 0 overflow interup flag goto low2_ ;delay loop decfsz count,1 goto Tone2 return ;*************************************************************** Tone3 ; extra tone not used bcf INTCON,2 ;clear timer interupt flag movlw 0xe0 movwf TMR0 bsf GPIO,4 ; start tone modulation, turn pin4 "on" high3_ btfss INTCON,2 ; timer 0 overflow interup flag goto high3_ ; delay loop bcf INTCON,2 ;clear timer interupt flag movlw 0xe0 movwf TMR0 bcf GPIO,4 ;turn pin4 "off" low3_ btfss INTCON,2 ; timer 0 overflow interup flag goto low3_ ;delay loop decfsz count,1 goto Tone3 return ;***************************************************************** Delay_S ; Short delay movlw 0x40 movwf count DS_Delay bcf INTCON,2 DS_loop btfss INTCON,2 goto DS_loop decfsz count,1 goto DS_Delay return ;***************************************************************** Delay_M ; Medium delay movlw 0x80 movwf count DM_Delay bcf INTCON,2 DM_loop btfss INTCON,2 goto DM_loop decfsz count,1 goto DM_Delay return ;***************************************************************** Delay_L ; Long delay movlw 0xff movwf count DL_Delay bcf INTCON,2 DL_loop btfss INTCON,2 goto DL_loop decfsz count,1 goto DL_Delay return ;******************************************************************** Wait ; One minute delay bcf GPIO,2 ; turns transmitter "off" call Delay_L decfsz count2,1 goto Wait return ;******************************************************************* C_sign ; input call sigh characters here call _X call _F call _M call one return ;******************************************************************* ;*************************MORSE Code*********************************** one call dit call dah call dah call dah call dah call pause return two call dit call dit call dah call dah call dah call pause return three call dit call dit call dit call dah call dah call pause return four call dit call dit call dit call dit call dah call pause return five call dit call dit call dit call dit call dit call pause return six call dah call dit call dit call dit call dit call pause return seven call dah call dah call dit call dit call dit call pause return eight call dah call dah call dah call dit call dit call pause return nine call dah call dah call dah call dah call dit call pause return zero call dah call dah call dah call dah call dah call pause return _A call dit call dah call pause return _B call dah call dit call dit call dit call pause return _C call dah call dit call dah call dit call pause return _D call dah call dit call dit call pause return _E call dit call pause return _F call dit call dit call dah call dit call pause return _G call dah ;G call dah call dit call pause return _H call dit ;H call dit call dit call dit call pause return _I call dit ;I call dit call pause return _J call dit ;J call dah call dah call pause return _K call dah ;K call dit call dah call pause return _L call dit ;L call dah call dit call dit call pause return _M call dah call dah call pause return _N call dah call dit call pause return _O call dah call dah call dah call pause return _P call dit call dah call dah call dit call pause return _Q call dah call dah call dit call dah call pause return _R call dit call dah call dit call pause return _S call dit call dit call dit call pause return _T call dah call pause return _U call dit call dit call dah call pause return _V call dit call dit call dit call dah call pause return _W call dit call dah call dah call pause return _X call dah call dit call dit call dah call pause return _Y call dah call dit call dah call dah call pause return _Z call dah ;Z call dah call dit call dit call pause return _dah call dah return _dit call dit return ;************************************************************** END