{{ LPTLockOut.spin BandSwitch Lockout by W3SZ June 18, 2010 Takes arbitrary 4-bit LPT input and outputs 4-bit code to match standard of N3FTI, PackRats Logging Interface Board Will not bandswitch if any of 7 PTT lines is activated Will not activate PTT if bandswitch is occurring Receives Bandswitch signals from Writelog via INA[3..0] Sends Bandswitch signals out via OUTA[11..14] Receives PTT signals from SDRs via INA[10..4] Sends PTT signals out via OUTA[15..25] ' The input signal matrix is as follows: ' Band A B C D ' 50 0 0 0 0 ' 144 1 0 0 0 ' 222 0 1 0 0 ' 432 1 1 0 0 ' 903 0 0 1 0 ' 1296 1 0 1 0 ' 2304 0 1 1 0 ' 3456 1 1 1 0 ' 5760 0 0 0 1 ' 10G 1 0 0 1 ' 24G 0 1 0 1 ' 47G 1 1 0 1 ' ' A = LPT pin 2 Least Significant ' B = LPT pin 7 ' C = LPT pin 8 ' D = LPT pin 9 Most Significant ' Grnd = LPT pin 15 ' The output signal matrix is as follows: ' Band A B C D ' 50 0 0 0 0 ' 144 1 0 0 0 ' 222 0 1 0 0 ' 432 1 1 0 0 ' 903 0 0 1 0 ' 1296 1 0 1 0 ' 2304 0 1 1 0 ' 3456 1 1 1 0 ' 5760 0 0 0 1 ' 10G 1 0 0 1 ' 24G 0 1 0 1 ' 47G 1 1 0 1 ' ' A = LPT pin 2 Least Significant ' B = LPT pin 7 ' C = LPT pin 8 ' D = LPT pin 9 Most Significant ' Grnd = LPT pin 15 LPT Pin 2 connects to Pin 0 LPT Pin 7 connects to Pin 1 LPT Pin 8 connects to Pin 2 LPT Pin 9 connects to Pin 3 Pin 11 connects to LPT Pin 2 out Pin 12 connects to LPT Pin 7 out Pin 13 connects to LPT Pin 8 out Pin 14 connects to LPT Pin 9 out The 74LS75 Latch can go on either input or output }} CON 'set the clock constants _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ 'include at least the Conduit Object vp:"Conduit" VAR long temp[4],freq,oldfreq,stack[22],PTT,tempPTT[7] PUB Main vp.share(@temp,@tempPTT) cognew(toggle(5_000_000), @stack) convlpt PUB toggle(Delay) ' dira[16]~~ ' repeat ' !outa[16] ' waitcnt(Delay + cnt) PUB convlpt dira[11..21]~~ dira[0..10]~ repeat temp:=INA[3..0] tempPTT:=INA[10..4] PTT := tempPTT[0] + (2*tempPTT[1]) + (4*tempPTT[2]) + (8*tempPTT[3]) + (16*tempPTT[4]) + (32*tempPTT[5]) + (64*tempPTT[6]) freq := temp[0] + (2*temp[1]) + (4*temp[2]) + (8*temp[3]) if freq == oldfreq case PTT ' 0: P0 1: P1 2: P2 4: P3 8: P4 16: P5 32: P6 64: P7 ' OTHER: P0 case freq ' 0: F50 1: F144 2: F222 3: F432 4: F903 5: F1296 6: F2304 7: F3456 8: F5760 9: F10G 10: F24G 11: F47G 12: F75G 13: F120G 14: F142G 15: F241G OTHER: F50 elseif PTT == 0 oldfreq:=freq case freq ' 0: F50a 1: F144a 2: F222a 3: F432a 4: F903a 5: F1296a 6: F2304a 7: F3456a 8: F5760a 9: F10Ga 10: F24Ga 11: F47Ga 12: F75Ga 13: F120Ga 14: F142Ga 15: F241Ga OTHER: F50a else PTT:= 0 outA[15..21]:= %0000000 PUB F50 outA[11..14]:= %0000 PUB F144 outA[11..14]:= %1000 PUB F222 outA[11..14]:= %0100 PUB F432 outA[11..14]:= %1100 PUB F903 outA[11..14]:= %0010 PUB F1296 outA[11..14]:= %1010 PUB F2304 outA[11..14]:= %0110 PUB F3456 outA[11..14]:= %1110 PUB F5760 outA[11..14]:= %0001 PUB F10G outA[11..14]:= %1001 PUB F24G outA[11..14]:= %0101 PUB F47G outA[11..14]:= %0110 PUB F75G outA[11..14]:= %0111 PUB F120G outA[11..14]:= %1000 PUB F142G outA[11..14]:= %1001 PUB F241G outA[11..14]:= %1010 PUB F50a outA[11..14]:= %0000 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F144a outA[11..14]:= %1000 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F222a outA[11..14]:= %0100 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F432a outA[11..14]:= %1100 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F903a outA[11..14]:= %0010 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F1296a outA[11..14]:= %1010 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F2304a outA[11..14]:= %0110 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F3456a outA[11..14]:= %1110 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F5760a outA[11..14]:= %0001 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F10Ga outA[11..14]:= %1001 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F24Ga outA[11..14]:= %0101 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F47Ga outA[11..14]:= %0110 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F75Ga outA[11..14]:= %0111 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F120Ga outA[11..14]:= %1000 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F142Ga outA[11..14]:= %1001 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB F241Ga outA[11..14]:= %1010 oldfreq := freq waitcnt(150_500_000 + cnt) PTT:=0 outA[15..21]:= %0000000 PUB P0 outA[15..21]:= %0000000 PUB P1 outA[15..21]:= %1000000 PUB P2 outA[15..21]:= %0100000 PUB P3 outA[15..21]:= %0010000 PUB P4 outA[15..21]:= %0001000 PUB P5 outA[15..21]:= %0000100 PUB P6 outA[15..21]:= %0000010 PUB P7 outA[15..21]:= %0000001