' FILE NAME: StnPro_code_01_27_2011.bs2 (Version 2.2M) ' Written by Jim Garland W8ZR email: w8zr@arrl.net ' All rights reserved, although program may be freely copied or modified for non-commercial use. ' {$STAMP BS2} BS2 Stamp directive - required statement ' {$PBASIC 2.5} Enable PBASIC v.2.5 enhanced features ' Changes in v2.2: (1) Bug in swap button code fixed to prevent an off-line indication when ' swap pressed after powerup. (2)Amp bypass mode now remembered when different TRX ' is selected. (3) "SP" in morse code at startup deleted to save program space. ' Changes in v2.2M: On powerup, the previous amplifier choice is recalled. LCD no longer reads "No Amp." Note that ' amp bypass & lockout mode is cancelled at powerup. '=====================================================+=============================== ' Port Definitions & INPUT/OUTPUT Status ' P0 TRX1SW IN TRX1 select button ' OUT TRX1 LED ' P1 TRX2SW IN TRX2 select button ' OUT TRX2 LED ' P2 TRX3SW IN TRX3 select button ' OUT TRX3 LED ' P3 AMP1SW IN AMP1 select button ' OUT AMP1 LED ' P4 AMP2SW IN AMP2 select button ' OUT AMP2 LED ' P5 AMP3SW IN AMP3 select button ' OUT AMP3 LED ' P6 SWAPSW IN swap current & prev. TRX & AMP selection ' BEEP OUT beep out TO speaker ' P7 TUNUPSW IN amp 2-tone/pulser select switch ' OUT 2-tone/pulser LED (blinks on pulser) ' P8 ELAPSW IN elapsed time switch ' OUT 2-tone/pulser audio TO Mic+ ' P9 REMOUT OUT relay control TO remote IN/OUT Jacks ' ' P10 REMSNSE IN READ on-line pulse from remote stns. ' OUT WRITE on-line pulse from local stn. ' P11 RLYENA OUT enable TRX & AMP relays ' P12 AMPADD1 OUT amplifer select address Bit 1 ' P13 AMPADD2 OUT amplifier select address Bit 2 ' P14 TRXADD1 OUT transceiver select address Bit 1 ' P15 TRXADD2 OUT transceiver select address Bit 2 ' SOUT SOUT OUT serial data out to program port ' LCDDATA OUT serial data out to LCD '===================================================================================== ' OWNER SUPPLIED DATA ' PART 1 -- enter your station equipment below and fill out with spaces to ' make all descriptions exactly 15 characters. Note that quotation marks around ' each description are required DATA @$010, "AMP-1 " 'Enter AMP1 Info in quotes DATA @$020, "AMP-2 " 'Enter AMP2 Info in quotes DATA @$030, "AMP-3 " 'Enter AMP3 Info in quotes DATA @$040, "TRX-1 " 'Enter TRX1 Info in quotes DATA @$050, "TRX-2 " 'Enter TRX2 Info in quotes DATA @$060, "TRX-3 " 'Enter TRX3 Info in quotes ' PART 2 -- For each transceiver listed above, enter below any amplifiers ' you wish to be locked out.(A locked out amplifier cannot be selected by the ' specified transceiver.) You lock out an amplifier by replacing a "1" by a "0" in the ' following three DATA statements. The first of the three digits after the % symbol ' in each line corresponds to AMP-1, the second digit to AMP-2, the third to AMP-3. ' Thus to lock out AMP-3 whenever TRX-2 is selected, the middle line should read ' "DATA @$00E, %110 'TRX-2 Amplifier lockout data." ' By default no amplifiers are locked out, so if you want to mix and match ' any amplifier with any transceiver then don't change anything. DATA @$00D, %111 'TRX-1 Amplifier lockout data DATA @$00E, %111 'TRX-2 Amplifier lockout data DATA @$00F, %111 'TRX-3 Amplifier lockout data ' ================================================================================== ' STOP! DO NOT CHANGE ANYTHING BELOW THIS LINE DATA @$070, " AMP BYPASS " 'Do not change this line DATA @$080, " ** NO AMP ** " 'Do not change this line DATA @$090, " ** OFF LINE **" 'Do not change this line DATA @$0A0, " ** LOCKOUT ** " 'Do not change this line ' ================================================================================== ' OTHER READ/WRITE DATA IN EEPROM -- preload to 0 DATA @$005,3 'stores amp=3 (AMP1)in $005 (added v2.2M) DATA @$006,3 'stores oldamp=3 (AMP1) in $006 (added v2.2M) ' memory locations of stored variables ' $000 trx ' $001 oldtrx ' $002 mins ' $003 hrs.LOWBYTE ' $004 hrs.HIGHBYTE ' $005 amp new in v2.2M ' $006 oldamp new in v2.2M ' ================================================================================== ' SYMBOL TABLE bpflag VAR Bit 'bypass flag =1 when amp bypassed timerflag VAR Bit 'timerflag=1 when elapsed time mode engaged autoflag VAR Bit 'timer auto flag = 1 when 10 min timer in autorepeat mode remflag VAR Bit 'remflag=1 if controller is off-line '----------------------------------------------------------------- trx VAR Nib 'values 0=trx1, 1=trx2, 2=trx3 amp VAR Nib 'values 3=amp1, 4=amp2, 5=amp3 oldtrx VAR Nib 'previous value of trx oldamp VAR Nib 'previous value of amp '----------------------------------------------------------------- btnwk0 VAR Byte 'TRX1 button variable btnwk1 VAR Byte 'TRX2 button variable btnwk2 VAR Byte 'TRX3 button variable btnwk3 VAR Byte 'AMP1 button variable btnwk4 VAR Byte 'AMP2 button variable btnwk5 VAR Byte 'AMP3 button variable btnwk6 VAR Byte 'SWAP button variable btnwk7 VAR Byte 'AMP TUNE button variable btnwk8 VAR Byte 'ELAPSED TIME button variable mins0 VAR Byte 'ten minute timer variable mins VAR Byte 'long term minutes variable,mod 10 add VAR Byte 'trx and amp data address x VAR Byte 'gen purpose counter y VAR Byte 'gen purpose counter '---------------------------------------------------------------- hrs VAR Word 'long term hours m VAR Word 'minutes counter (0 to cal1) '---------------------------------------------------------------- N24 CON $418C 'LCD 2400 baud I CON 254 'LCD instruction toggle CLR CON 1 'LCD clear display cal0 CON 1946 'calibration constant: 1 minute LOOP COUNT, bpflag=0 cal1 CON 370 'calibration constant: 1 minute loop count, bpflag=1 DIRS=%1111110000000000 'P0-P9 set to input, P10-P15 set to output LOW '====================================================================================== 'Program Note: On powerup, amp=0 and oldamp=0. When AMP1,2,3 button is pressed, then amp=3,4,5, 'but oldamp doesn't change until a second AMP is selected. ' PROGRAM BEGINS HERE 'Read input data, initialize LCD, display flash screen, set startup flag IF IN3=0 THEN GOSUB resettime 'resets timer TO zero IF AMP1 BUTTON pressed at startup READ $003,hrs.LOWBYTE 'set hrs to previous stored value READ $004,hrs.HIGHBYTE READ $002,mins 'set mins to previous stored value (=10,20,30,etc.) READ $000,trx 'read TRX and prior trx selection at previous powerdown READ $001,oldtrx READ $005,amp 'read amp and oldamp selection at previous powerdown (added v2.2M) READ $006,oldamp ' added v2.2M PAUSE 1000 'allow LCD to wake up - added in v 2.2M HIGH 6 'leave High to avoid conflict with swap buton - added v.2.2M SEROUT 16,N24,[I,CLR] 'clear LCD IF IN8=0 THEN GOSUB elapsetme 'display hrs, mins if timer button pressed at pwr-on SEROUT 16,N24,[" StationPro II",I,194,"Rev. 2.2M"] 'display flash screen on LCD PAUSE 2000 'wait 2 secs and GOSUB beeplong 'send three-tone beep SEROUT 16,N24,[I,CLR] 'clear LCD HIGH 11 GOTO rempulse 'pulse P10 to grab control '================================ Main Body of Program Follows ========================== startup: ON trx GOSUB trx1sel,trx2sel,trx3sel 'recall TRX (trx=0 calls trx1sel, etc.) ON (amp-3) GOSUB amp1sel,amp2sel,amp3sel 'recall previous amp selection, added v2.2M ' the following sets "NO AMP" mode and then scans buttons (NO AMP mode is deleted in v2.2M) LOW 9 'grab control by closing stn.select relay ' HIGH 12 'set ampadd1 and ampadd2 to bypass mode ' HIGH 13 LOW 11 'enable relays ' SEROUT 16,N24,[I,2] 'move cursor to beginning of first line ' add=$080 'address of "** NO AMP ** " string ' GOSUB stringout 'send string to LCD & beep 'set default oldamp and then scan buttons '====================================================================================== ' rd_buttons scans the buttons. Each port (P0 through P7) is used both as an input ' port port and an output port. As the program loops, the "low trx" AND "low ' amp" commands change the specified port to output and light the LED. The BUTTON ' command then changes it back to input. The duty cycle is increased by ' "PAUSE 20" command, which increases the brightness of the LED. rd_buttons: 'Note BUTTON automatically changes its port to INPUT mode IF IN10=0 AND remflag=0 THEN Offline 'if on-line and remote pulse is detected, go off-line GOSUB loopcnt '10 min timer BUTTON 0,0,255,0,btnwk0,1,trx1 'trx1 button BUTTON 1,0,255,0,btnwk1,1,trx2 'trx2 button BUTTON 2,0,255,0,btnwk2,1,trx3 'trx3 button BUTTON 3,0,255,0,btnwk3,1,amp1 'amp1 button BUTTON 4,0,255,0,btnwk4,1,amp2 'amp2 button BUTTON 5,0,255,0,btnwk5,1,amp3 'amp3 button BUTTON 6,0,255,0,btnwk6,1,swap 'swap button BUTTON 7,0,255,0,btnwk7,1,tuneup 'amp tuneup button BUTTON 8,0,10,255,btnwk8,1,timer 'elapsed time button (two functions) IF remflag=1 THEN jmp1 'don't turn on LEDs if off-line LOW trx 'change trx port to output,light TRX LED IF amp=0 THEN jmp1 'amp=0 until amp button is pressed, do nothing LOW AMP 'change amp port to output, light AMP LED IF bpflag=1 THEN blinkled 'go to amp bypass mode and blink amp LED jmp1:PAUSE 20 'pause 20msec to increase LED duty cycle GOTO rd_buttons 'loop '==================================================================================== blinkled: 'blink amp LED in bypass mode PAUSE 90 '90ms pause to catch 100ms remote pulse IF IN10=0 AND remflag=0 THEN Offline 'catch 100ms remote pulse if it arrives during blink time HIGH amp 'turn off selected amp LED PAUSE 50 'wait 50 msec GOTO rd_buttons '********************************************************************************** '* THIS SECTION ENABLES THE SELECTED TRANSCEIVER (TRX1,TRX2,TRX3) * '********************************************************************************** trx1: oldtrx=trx 'updtate oldtrx trx=0 'set new TRX IF trx=oldtrx THEN rd_buttons 'if repeating same button press, do nothing GOSUB trxsel 'if different button press, select TRX relay GOTO rd_buttons trx2: oldtrx=trx 'updtate oldtrx trx=1 'set new TRX IF trx=oldtrx THEN rd_buttons 'if repeating same button press, do nothing GOSUB trxsel GOTO rd_buttons trx3: oldtrx=trx 'updtate oldtrx trx=2 'set new TRX IF trx=oldtrx THEN rd_buttons 'if repeating same button press, do nothing GOSUB trxsel GOTO rd_buttons trxsel: WRITE $000,trx 'store trx AND oldtrx in eeprom memory WRITE $001,oldtrx ON trx GOSUB trx1sel,trx2sel,trx3sel 'choose selected relay GOSUB lockouttest 'test for amplockout, return with y=0, bpflag=1 OR y=1,bpflag=0 IF y=1 THEN ampenable 'if amp is enabled,then select amp and scan buttons IF amp>0 THEN GOSUB amplockout 'if not at startup and amp is unlocked, then lock it RETURN ampenable: IF bpflag=1 THEN ampbypass 'bug fixed, v 2.2 ON amp-3 GOSUB amp1sel,amp2sel,amp3sel RETURN 'returns from GOSUB trxsel if y=1 amplockout: 'select ampifier lockout mode bpflag=1 'turn on blinking Amp LED when amp locked out HIGH 11 'open amp/trx relays(P11)(v2.0) HIGH 12 'set ampadd1 and ampadd2 to bypass mode HIGH 13 PAUSE 20 'pause 20msec to allow relays to open fully (v2.0) LOW 11 'enable relays SEROUT 16,N24,[I,2] 'move cursor to beginning of first line add=$0A0 'point stringout subroutine to "LOCKOUT" string GOSUB stringout 'send string to LCD RETURN '==================================================================================== trx1sel: 'subroutine -- set relays and LCD display for TRX1 HIGH 11 'disable amp/trx relays(P11) (v2.0) LOW 14 'set trxadd1 (P14)to L LOW 15 'set trx1add2 (P15) to L PAUSE 20 'pause 20msec to allow relays to open fully (v2.0) LOW 11 'enable relays (P11), TRX1 selected SEROUT 16,N24,[I,192] 'move cursor to beginning of second line add=$040 'go to trx1 data GOSUB stringout 'display TRX1 on LCD RETURN '==================================================================================== trx2sel: 'subroutine -- set relays and LCD display for TRX2 HIGH 11 'disable amp/trx relays(P11) (v2.0) HIGH 14 'set trxadd1 to H LOW 15 'set trxadd2 to L, PAUSE 20 'pause 20msec to allow relays to open fully (v2.0) LOW 11 'enable relays (P11),TRX2 selected SEROUT 16,N24,[I,192] 'move cursor to beginning of second line add=$050 'go to trx2 data GOSUB stringout 'display TRX2 on LCD RETURN '==================================================================================== trx3sel: 'subroutine -- set relays and LCD display for TRX3 HIGH 11 'disable amp/trx relays(P11) (v2.0) LOW 14 'set trxadd1 to H HIGH 15 'set trxadd2 to L, PAUSE 20 'pause 20msec to allow relays to open fully (v2.0) LOW 11 'enable relays (P11),TRX3 selected SEROUT 16,N24,[I,192] 'move cursor to beginning of second line add=$060 'go to trx3 data GOSUB stringout 'display TRX3 on LCD RETURN ' ------------------------END OF SECTION---------------------------------- '********************************************************************************** '* THIS SECTION IMPLEMENTS THE AMPLIFIER SELECT FUNCTION * '********************************************************************************** amp1: IF amp>0 THEN oldamp=amp 'update oldamp,except at startup when amp=0 amp=3 'set amp to new value (amp=3) IF oldamp=amp THEN amp11 'update selection if pressed button is a repeat GOTO amp12 'update selection if a new button is pressed amp11: 'respond if button is a repeat press GOSUB lockouttest 'ck amp lockout status IF y=0 THEN rd_buttons 'do nothing if amp locked out bpflag = ABS (bpflag-1) 'otherwise,toggle bpflag ON bpflag GOSUB amp1sel,ampbypass 'toggle bypass mode on or off GOTO rd_buttons amp1sel: 'subroutine -- set relays and LCD display for AMP1 bpflag=0 'turn off bypass flag & select Amp rlys HIGH 11 'disable amp/trx relays(P11) LOW 12 'set ampadd1 to L LOW 13 'set ampadd2 to L PAUSE 20 'pause 20msec to allow relays to open fully LOW 11 'enable relays (P11), AMP1 selected SEROUT 16,N24,[I,2] 'move cursor to beginning of first line add=$010 'go to AMP1 string GOSUB stringout 'display AMP1 string on LCD RETURN amp12: 'respond if button selects a new amp WRITE $005,amp 'new in 2.2M WRITE $006, oldamp 'new in 2.2M GOSUB lockouttest 'ck if new amp is locked out(y=0) or enabled (y=1) ON y GOSUB amplockout, amp1sel 'and branch ' GOTO rd_buttons '==================================================================================== amp2: IF amp>0 THEN oldamp=amp 'update oldamp except at startup amp=4 'set amp to new value (amp=4) IF oldamp=amp THEN amp21 'update selection if pressed button is a repeat GOTO amp22 'update selection if a new button is pressed amp21: 'respond if button is a repeat press GOSUB lockouttest 'ck amp lockout status IF y=0 THEN rd_buttons 'do nothing if amp locked out bpflag = ABS (bpflag-1) 'otherwise,toggle bpflag ON bpflag GOSUB amp2sel,ampbypass 'toggle bypass mode on or off GOTO rd_buttons amp2sel: 'subroutine -- set relays and LCD display for AMP2 bpflag=0 'turn off bypass flag HIGH 11 'disable amp/trx relays(P11) HIGH 12 'set ampadd1 to H LOW 13 'set ampadd2 to L PAUSE 20 'pause 20msec to allow relays to open fully LOW 11 'enable relays (P11), AMP2 selected SEROUT 16,N24,[I,2] 'move cursor to beginning of first line add=$020 'go to AMP2 string GOSUB stringout 'display AMP2 string on LCD RETURN amp22: 'respond if button selects a new amp WRITE $005,amp 'new in 2.2M WRITE $006, oldamp 'new in 2.2M GOSUB lockouttest 'ck if new amp is locked out(y=0) or enabled (y=1) ON y GOSUB amplockout, amp2sel 'and branch ' GOTO rd_buttons '==================================================================================== amp3: IF amp>0 THEN oldamp=amp 'update oldamp, except at startup amp=5 'set amp to new value (amp=5) IF oldamp=amp THEN amp31 'update selection if pressed button is a repeat GOTO amp32 'update selection if a new button is pressed amp31: 'respond if button is a repeat press GOSUB lockouttest 'ck amp lockout status IF y=0 THEN rd_buttons 'do nothing if amp locked out bpflag = ABS (bpflag-1) 'otherwise,toggle bpflag ON bpflag GOSUB amp3sel,ampbypass 'toggle bypass mode on or off GOTO rd_buttons amp3sel: 'subroutine -- set relays and LCD display for AMP3 bpflag=0 'turn off bypass flag HIGH 11 'disable amp/trx relays(P11) LOW 12 'set ampadd1 to L HIGH 13 'set ampadd2 to H PAUSE 20 'pause 20msec to allow relays to open fully LOW 11 'enable relays (P11), AMP3 selected SEROUT 16,N24,[I,2] 'move cursor to beginning of first line add=$030 'go to AMP3 string GOSUB stringout 'display AMP3 string on LCD RETURN amp32: 'respond if button selects a new amp WRITE $005,amp 'new in 2.2M WRITE $006, oldamp 'new in 2.2M GOSUB lockouttest 'ck if new amp is locked out(y=0) or enabled (y=1) ON y GOSUB amplockout, amp3sel 'and branch ' GOTO rd_buttons '==================================================================================== ampbypass: 'select ampifier bypass mode HIGH 11 'open amp/trx relays(P11) HIGH 12 'set ampadd1 and ampadd2 to bypass mode HIGH 13 PAUSE 20 'pause 20msec to allow relays to open fully LOW 11 'enable relays SEROUT 16,N24,[I,2] 'move cursor to beginning of first line add=$070 'point stringout subroutine to "amp bypass" string GOSUB stringout 'send string to LCD RETURN '==================================================================================== lockouttest: 'subroutine -- tests for locked out amp whenever TRX or AMP button pressed. 'Returns y=0 if amp locked out, y=1 if amp is enabled. IF remflag=1 THEN rempulse 'if off-line send pulse to remote port to grab control ON trx GOTO trx1_data, trx2_data, trx3_data 'retrieve y = trx1,trx2, or trx3 amp lockout data from EEPROM trx1_data: READ $00D, y 'trx1 lockout data stored at $00D GOTO mask_ampbit trx2_data: READ $00E, y 'trx2 lockout data stored at $00E GOTO mask_ampbit trx3_data: READ $00F, y 'trx3 lockout data stored at $00F mask_ampbit: 'select lockout bit for amp1,amp2, or amp3 ON amp-3 GOTO amp1_mask, amp2_mask,amp3_mask 'amp-3 corrects for amp = 3,4,5 amp1_mask: y = y >> 2 'select AMP1 & rotate amp1 bit into LSB GOTO mask_lsb: amp2_mask: y = y >> 1 'select AMP2 & rotate amp2 bit into LSB GOTO mask_lsb amp3_mask: 'leave AMP 3 in LSB if AMP1 and AMP2 skipped mask_lsb: y = y & %1 'mask everything but LSB (0 or 1) 'Return with y=0 (amp locked out) or y=1 (amp enabled) RETURN ' ------------------------------------------------------------------------- rempulse: 'output a 100 msec pulse to the remote output line to grab control HIGH 10 'set P10 to output high PULSOUT 10,50000 '100 msec pulse low (output state returns to high when done) INPUT 10 'set P10 to INPUT remflag=0 'set remflag to ON-LINE ' amp=0 'set startup mode GOTO startup ' ------------------------END OF SECTION---------------------------------- '************************************************************************************* '* This section implements the TRX and Amp "SWAP" function * '************************************************************************************* swap: IF remflag=1 THEN Offline 'skip if off-line x=trx 'interchange trx and oldtrx values trx=oldtrx oldtrx=x GOSUB trxsel 'select previous trx ' 'now swap amplifers IF amp=0 THEN rd_buttons 'skip amp swap if no amp button yet pressed bpflag = ABS (bpflag-1) 'toggle bpflag ON oldamp-3 GOTO amp1,amp2,amp3 'recall previous amp selection GOTO rd_buttons 'bugfix v2.2 ' ------------------------END OF SECTION---------------------------------- '====================================================================================== '===================================================================================== offline: 'take controller off-line when low pulse seen on P10 IF remflag=1 THEN rd_buttons 'skip if already off-line, conrinue if not HIGH 9 'deselect (turn off) remote relay port HIGH 11 'disable relays remflag=1 'turn on off-line flag SEROUT 16,N24,[I,CLR] 'clear LCD SEROUT 16,N24,[I,2] 'move cursor to beginning of first line add=$090 'address of "** OFF LINE ** " string GOSUB stringout 'send "** OFF LINE **" to LCD GOTO rd_buttons 'back to buttons,P10 still in INPUT state '===================================================================================== '====================================================================================== ' Toggle timer flag bit on/off, send audible cw confirmation, and ' display "*" (single mode) or "#" (auto repeat mode)on LCD when 10min timer enabled. timer: IF remflag=1 THEN Offline 'skip if off-line mins0=0 'reset timer minutes variable SEROUT 16,N24,[I,207] 'move cursor TO END of second line IF btnwk8=255 AND timerflag=1 THEN GOTO autorepeat ON timerflag GOSUB timer1,timer2 'test timerflag=0 or 1 and branch GOTO rd_buttons 'scan buttons when done timer1: 'if timerflag is off (=0) timerflag=1 'toggle timerflag bit on SEROUT 16,N24,["*"] 'display "*" on LCD if timer enabled GOSUB CWID 'send ID in cw RETURN timer2: 'if timerflag is on (=1) timerflag=0 'toggle timerflag bit off autoflag=0 'toggle autoflag bit off SEROUT 16,N24,[" "] 'blank LCD timer indication GOSUB CWK 'send K in cw RETURN autorepeat: autoflag=1 'set ten minute timer flag to auto repeat GOSUB beep 'confirm with beep SEROUT 16,N24,["#"] 'display "#" on LCD to indicate automatic repeat mode GOTO rd_buttons ' Note: this subroutine checks status of Elapsed Time button, P8. The button loop counter ' btnwk8=10 when the button is pressed briefly. With a brief press, the routine toggles ' the timerflag, indicates the timer on/off status on the LCD, and sends "ID" in CW ' to show timer is on. If the button is held down, the button status is checked again ' after a delay. Now, the loop counter btnwk8=255, and the autorepeat flag is set to ' autoflag=1. The auto timer status is confirmed with a (1kHz) beep and a different ' character (#) on the LCD. Either the auto timer mode or single timer mode can be ' cancelled with a brief button press. '===================================================================================== ' Count program loops as the buttons are scanned and keep track of the ' elapsed minutes and hours. If timerflag=1, then send cw "ID" ' after 10 minutes, blank the LCD timer indicator, and turn off timer flag. ' Note that CAL1 and CAL0 adjust for the different loop transit times, ' depending on whether the controller is in amplifier bypass mode or not. loopcnt: m=m+1 'increment m for each loop IF bpflag=1 AND m=cal1 THEN GOSUB loopcnt1 'branch IF amp bypass mode is enabled IF m=cal0 THEN GOSUB loopcnt1 'cal0 loops = 1 min with bpflag=0 RETURN loopcnt1: m=0 'reset m=0 after 1 minute mins=mins+1 'increment minutes ' GOSUB beep 'UNCOMMENT for 1 min beeps to adjust cal0 & cal1 IF mins//10=0 THEN GOSUB strmins 'store mins in ten minute blocks mins0=mins0+1 'increment timer minutes IF timerflag=1 AND mins0//10=0 THEN GOSUB IDtimer 'branch every 10 mins RETURN strmins: IF mins=60 THEN GOSUB addhrs WRITE $002,mins 'update mins (ten minute blocks) RETURN addhrs: mins=0 'reset mins hrs=hrs+1 'update hrs WRITE $003, hrs.LOWBYTE 'and store WRITE $004, hrs.HIGHBYTE RETURN IDtimer: GOSUB CWID 'send "ID" in cw (after ten minutes) IF autoflag=0 THEN GOSUB IDtimer1 'branch if auto repeat mode is off RETURN IDtimer1: timerflag=0 'turn off timer flag SEROUT 16,N24,[I,207] 'move LCD cursor to end of second line SEROUT 16,N24,[" "] 'blank LCD timer indicator RETURN '===================================================================================== elapsetme: 'display elapsed time if timer button pressed at power-on GOSUB beep SEROUT 16,N24,[I,2,"Hrs = ",DEC hrs," "] 'disp hours top line SEROUT 16,N24,[I,192,"Mins = ",DEC mins," "] 'disp minutes 2nd line PAUSE 4000 'wait 4 secs SEROUT 16,N24,[I,CLR] 'clear LCD GOSUB beep RETURN '===================================================================================== resettime: 'reset elapsed time to zero if swap button pressed at power-on WRITE $002,0 'resets mins to 0 WRITE $003,0 'resets hrs.LOWBYTE to 0 WRITE $004,0 'resets hrs.HIGHBYTE to 0 PAUSE 1000 SEROUT 16,N24,[I,2," **RESET TIME** ",DEC hrs," "] 'disp hours top line PAUSE 4000 'wait 4 secs SEROUT 16,N24,[I,CLR] 'clear LCD GOSUB beeplong RETURN '===================================================================================== tuneup: 'Send tuneup tone bursts to microphone input for 10 secs IF remflag=1 THEN Offline 'skip if off-line GOSUB tuneup1 GOTO rd_buttons 'scan buttons when through tuneup1: OUTPUT 7 'change tuneup button (P7) to output GOSUB beep 'mark start of pulse tones FOR x = 1 TO 100 'output 50msec 1000Hz bursts to Mic for 10sec IF IN10=0 THEN offline 'exit and go offline if another controller grabs control FREQOUT 8,50,1000 LOW 7 'turn on LED for 50 msec, each loop PAUSE 50 BUTTON 7,0,255,1,btnwk0,1,exittune 'set P7 to input, exit tuneup if pressed NEXT exittune: HIGH 7 'leave P7 HIGH GOSUB beeplong 'mark end of pulse tones RETURN '==================================================================================== stringout: 'Subroutine -- send TRX and AMP strings to LCD READ add,x 'read address of data string IF x <>0 THEN cont1 'look for zero at end of string GOTO cont2 'and end if zero found cont1: SEROUT 16,N24,[x] add=add+1 GOTO stringout cont2: 'Send short beep (Can't use -- exceeds limit of 4) FREQOUT 6,120,1000 'send beep (1000Hz for 120 msec to P6) HIGH 6 'Leave P6 HIGH to avoid conflict with swap button RETURN '===================================================================================== CWK: 'Subroutine - send "K" in CW (900 Hz) FREQOUT 6,180,900 PAUSE 50 FREQOUT 6,70,900 PAUSE 50 FREQOUT 6,180,900 HIGH 6 'leave P6 HIGH to avoid conflict with swap button RETURN '==================================================================================== ' CWSP: 'Subroutine - Send "SP" in CW (900 Hz) -deleted 2.2M ' FREQOUT 6,70,900 'deactivated in v2.2 to free program memory ' PAUSE 60 ' FREQOUT 6,70,900 ' PAUSE 60 ' FREQOUT 6,70,900 ' PAUSE 240 ' FREQOUT 6,70,900 ' PAUSE 60 ' FREQOUT 6,180,900 ' PAUSE 60 ' FREQOUT 6,180,900 ' PAUSE 60 ' FREQOUT 6,70,900 ' PAUSE 1000 'added in v2.2 to initialize LCD - deleted 2.2M ' HIGH 6 'leave P6 HIGH to avoid conflict with swap button -deleted 2.2M ' RETURN ' deleted 2.2M '===================================================================================== CWID: 'Subroutine - Send "ID" in CW (900 Hz) FREQOUT 6,70,900 PAUSE 50 FREQOUT 6,70,900 PAUSE 160 FREQOUT 6,180,900 PAUSE 50 FREQOUT 6,70,900 PAUSE 50 FREQOUT 6,70,900 HIGH 6 'leave P6 HIGH to avoid conflict with swap button RETURN '===================================================================================== beep: 'Subroutine -- short 2 KHz beep FREQOUT 6,120,1000 'send 1000Hz for 120 msec to P6 HIGH 6 'Leave P6 HIGH to avoid conflict with swap button RETURN '==================================================================================== beeplong: 'Subroutine -- long (4-tone) beep FREQOUT 6,60,2000 'send 2000 Hz for 60 msec to P6 FREQOUT 6,60,2500 'send 2500 Hz for 60 msec to P6 FREQOUT 6,100,3000 'send 3000 Hz for 100 msec to P6 HIGH 6 'leave P6 HIGH to avoid conflict with swap button RETURN '==================================================================================== ' * * * * END OF PROGRAM * * * *