' *** EOSS DF Beacon / Cudown Command Receiver *** ' *** Parallax Basic Stamp I source code *** ' *** Completely fills all available EEPROM space! *** ' Mike Manes W5VSI - w5vsi@arrl.net ' 'cutbcn44.BAS 9/26/00 from EOSBCN43.BAS by W5VSI 'Added comments to clarify I/O for others 7/24/03 'CD22203 DTMF decoder used for tone decoder on p.0 - p.4. 'P.4 fed by '203 DAV via 240K and '203 ED via K of 1n4148. '2n7000 FETs used on p.5 & p.6 to drive cutter relay coils. 'TONE output on p.7 drives 100K/0.82K/100nF attenuator for mic AF 'and 1n4148/1 uF/1 meg peak detector to feed 2n7000 FET/15K PTT on 'mic line for DJ-C1 xcvr. ' 'Added 2nd cutdown channel to EOSS-43 CW/Cutdown. Changed 'PTT to use VOX on TONE (pin 14), freeing pin 13 for Cut_2. 'Used 3-key command preamble (Cut1 - Cut3), with 4th cmd '"A" for Cut_1 and "B" for Cut_2. 'EOSS 1 lb T&R beacon CW IDer. First used on EOSS-43. 'Uses EEPROM to store CW message one char per byte per 'MORSE.BAS, with one variation: if Character = CW_EOM (End Of Msg), 'msg pointer is cleared and DF_Time cycle begins. Beacon cycle begins 'with CW msg for MsgDur sec, then steady tone DF_Time secs, then QRT for 'rest of Cycle secs. ' CONSTANTS ' CW Message is set up in module Pwr-up. ' Timing parms Symbol DF_time = 20 'Steady tone duration to aid DFing, sec. Symbol Listen = 20 'Command listen timer; Beacon silent period ' Symbol MsgDur - CW msg duration, sec; set in Pwr-up 'This table maps '203 DTMF decoder Hex out to std DTMF keys 'Key Mark -> 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, *, #, A, B, C, D '203 Code -> $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F $0 ' Cutdown command code Symbol Cut1 = $3 'DTMF hex for key "3" Symbol Cut2 = $6 ' " " " " "6" Symbol Cut3 = $9 ' " " " " "9" Symbol Cut41 = $D ' " " " " "A" Symbol Cut42 = $E ' " " " " "B" ' CW params Symbol Tone = 116 '1 KHz Symbol Quiet = 0 Symbol Dit_length = 15 'About 5 WPM Symbol Dah_length = 45 Symbol Space = 60 '*** Max to keep VOX alive ' RAM Variables Symbol Status = b0 'Status byte Symbol KeyNG = Bit0 Symbol CmdOK = Bit1 Symbol Msg_Ptr = b1 ' EEPROM address pointer Symbol Timer = b2 ' GP timer Symbol Char = b3 ' CW char & DTMF key Symbol Index1 = b4 ' GP pointer Symbol Elements = b6 ' CW dahs, length Symbol DTMF = b7 ' IO ASSIGNMENTS & Init Input 0:Input 1:Input 2:Input 3:Input 4 Output 6 Low 6 'Cut A relay off ASAP! Output 5 Low 5 'Cut B relay off Symbol DAV = Pin4 'DTMF DAV, high = P.0-.3 DTMF data valid Symbol CUT_1 = 5 'High activates cutdown #1 Symbol CUT_2 = 6 'High activates cutdown #2 Symbol PTT = 7 ' Same as CW line, high = on. Output 7 Low 7 ' PTT off Symbol CW = 7 ' CW audio on pin 7 ' Morse characters Symbol Cw_A = %01000010 ' "A" Symbol Cw_B = %10000100 ' "B" Symbol Cw_C = %10100100 ' "C" Symbol Cw_D = %10000011 ' "D" Symbol Cw_E = %00000001 ' "E" Symbol Cw_F = %00100100 ' "F" Symbol Cw_G = %11000011 ' "G" Symbol Cw_H = %00000100 ' "H" Symbol Cw_I = %00000010 ' "I" Symbol Cw_J = %10000100 ' "J" Symbol Cw_K = %10100011 ' "K" Symbol Cw_L = %01000100 ' "J" Symbol Cw_M = %11000010 ' "M" Symbol Cw_N = %10000010 ' "N" Symbol Cw_O = %11100011 ' "O" Symbol Cw_P = %01100100 ' "P" Symbol Cw_Q = %11010100 ' "Q" Symbol Cw_R = %01000011 ' "R" Symbol Cw_S = %00000011 ' "S" Symbol Cw_T = %10000001 ' "T" Symbol Cw_U = %00100011 ' "U" Symbol Cw_V = %00010100 ' "V" Symbol Cw_W = %01100011 ' "W" Symbol Cw_X = %10010100 ' "X" Symbol Cw_Y = %10110100 ' "Y" Symbol Cw_Z = %11000100 ' "Z" Symbol Cw_0 = %11111101 ' "0" Symbol Cw_1 = %01111101 ' "1" Symbol Cw_2 = %00111101 ' "2" Symbol Cw_3 = %00011101 ' "3" Symbol Cw_4 = %00001101 ' "4" Symbol Cw_5 = %00000101 ' "5" Symbol Cw_6 = %10000101 ' "6" Symbol Cw_7 = %11000101 ' "7" Symbol Cw_8 = %11100101 ' "8" Symbol Cw_9 = %11110101 ' "9" Symbol Cw_sp = %00000110 ' space Symbol Cw_comma = %10010101 ' comma Symbol Cw_ar = %01010101 ' /AR Symbol Cw_EOM = %00000111 ' End of msg delimiter Pwr_up: 'Cutdown EEPROM strings Symbol CmdCode = 0 eeprom 0,(Cut1,Cut2,Cut3) ' DTMF cutdown preamble (0-2) Symbol CmdEnd = 2 Symbol CW_OK = 3 eeprom 3,(Cw_O,Cw_K,Cw_EOM) ' "OK" - cutdown confirmation (3-5) Symbol CW_NG = 6 eeprom 6,(Cw_N,Cw_G,Cw_EOM) ' "NG" - bad cutdown cmd (6-8) 'CW msg string Symbol CW_Msg = 9 eeprom 9,(Cw_D,Cw_E,Cw_sp,Cw_W,Cw_5,Cw_V,Cw_S,Cw_I,Cw_EOM)'DE_W5VSI_(9-17) 'eeprom 18,(Cw_ar,Cw_EOM) 'AR (18-19) 'Symbol MsgDur = 15 ' Duration of this CW msg, sec. Start: Status = 0 pause 500 'Ensure 0.5 sec keyup per cycle to let DJ-C1 start let Msg_ptr = CW_Msg 'Point to CW msg start in eeprom Send_Msg: high PTT 'pause 1500 ' 1.5 sec dead air SM1: read Msg_ptr, Char 'Get next CW char if Char = Cw_EOM then DFTone gosub Morse let Msg_ptr = Msg_ptr + 1 goto SM1 DFTone: 'let Timer = Timer - MsgDur if Status <> 0 then QRT ' Skip DF tone if decoder msg for Index1 = 1 to DF_Time 'steady tone for DF_Time sec sound CW,(Tone,100) ' 100 -> approx 1 sec next Index1 'let Timer = Timer - DF_Time QRT: low PTT 'if Timer < 4 then Start Decoder: Timer = Listen 'Init listening timer Status = 0 Msg_Ptr = CmdCode DC1: gosub WaitKey if KeyNG = 1 then SendNG if CmdOK = 1 then Cutdown 'Preamble OK - get 4th key Timer = Timer - 2 'Countdown loop time if Timer > 2 then DC1 goto Start WaitKey: Index1 = 40 ' 2 sec key process loop WK1: if DAV = 1 then ReadKey nap 1 '36 ms Index1 = Index1 - 1 if Index1 <> 0 then WK1 return ReadKey: if DAV = 0 then ProcKey ' Wait for key drop DTMF = Port & $0F ' Get DTMF key code goto ReadKey return ProcKey: read Msg_Ptr, Char if CmdOK = 1 then PK1 'Got 4th key for Cutdown if DTMF <> Char then BadKey if Msg_Ptr = CmdEnd then GoodCmd Msg_Ptr = Msg_Ptr + 1 PK1: return BadKey: let KeyNG = 1 return GoodCmd: let CmdOK = 1 return SendNG: Msg_Ptr = CW_NG goto Send_Msg Cutdown: gosub WaitKey 'Get 4th key if DTMF = Cut41 then CD1 if DTMF <> Cut42 then SendNG high CUT_2 'Start burner 2 (A) goto CD3: CD1: high Cut_1 'Start burner 1 (B) CD3: sound CW,(90,200) ' 2 sec low tone to confirm good burn command pause 8000 ' Let wire burn 10 sec low CUT_1 low CUT_2 Msg_Ptr = CW_OK ' Confirm end of burn, OK for next command goto Send_Msg Morse: let Elements = Char & %00000111 if Elements > 5 then Word_Sp Bang_Key: for Index1 = 1 to Elements if Char >= 128 then Dah goto Dit Reenter: let Char = Char * 2 next gosub Char_sp return Dit: sound CW,(Tone,Dit_length) sound CW,(Quiet,Dit_length) goto Reenter Dah: sound CW,(Tone,Dah_length) sound CW,(Quiet,Dit_length) goto Reenter Char_sp: sound CW,(Quiet,Dah_length) return Word_sp: sound CW,(Quiet,Space) return end