PICAXE

CW S a PSV metr pro FT897

Program pro 08M2, kompletní výpis


  Symbol TX = pinC.1
  Symbol CW = pinC.3
  Symbol Ton = pinC.4

Main:
  b1=8       ; tečka
  b2=105       ; ton
  b3=b1*3       ; carka
  pause 60       ; ceka na vybiti Smetru
  readadc C.2,b0       ; cte napeti na C2

      ; PTT aktivni
  if TX=0 and b0>96 then Gosub ALARM       ; varovani PSW >3
  if TX=0 and CW=0 and Ton=1 then CWSWR       ; SWRmetr prevod na CW
  if TX=0 and CW=1 and Ton=0 then TSM       ; SWRmetr tonovy
      ; RX aktivni
  if TX=1 and CW=0 and Ton=1 then SMTR       ; Smetr prevod na CW
  if TX=1 and CW=1 and Ton=0 then TSM       ; Smetr tonovy
  GoTo Main

ALARM:
  pause 60       ; ceka se na vybiti Smetru
  readadc C.2,b0       ; znovu cte napeti na C2
  if TX=0 and b0>96 then       ; poplach pro PSW >3
  Sound C.0,(90,20,110,20,90,20,110,20,90,20,110,20,0,30)
  endif
  Return

TSM:
  readadc C.2,b4       ; cte napeti na C2
  b4=b4/3      
  b4=b4+40       ; prizpusobeni rozsahu pro ton indikaci
  Sound C.0,(b4,30)       ; prevod napeti na tony
  if CW=1 and Ton=1 then TSM      
  GoTo Main

CWSWR:          ; prevod napeti na cisla SWR
  Select Case b0
      case 0 to 3
      Gosub Jedna: Gosub Cela: Gosub Nula
      case 4 to 7
      Gosub Jedna: Gosub Cela: Gosub Dva
      case 8 to 14
      Gosub Jedna: Gosub Cela: Gosub Pet
      case 15 to 27
      Gosub Dva: Gosub Cela: Gosub Nula
      case 28 to 50
      Gosub Dva: Gosub Cela: Gosub Dva
      case 51 to 78
      Gosub Dva: Gosub Cela: Gosub Pet
      case 79 to 96
      Gosub Tri: Gosub Cela: Gosub Nula
      case 97 to 113
      Gosub Tri: Gosub Cela: Gosub Pet
      case 114 to 126
      Gosub Ctyri: Gosub Cela: Gosub Nula
      case 127 to 144
      Gosub Pet: Gosub Cela: Gosub Nula
      case 145 to 180
      Gosub Jedna: Gosub Nula
      case 181 to 250
      Gosub Moc: Gosub Moc
      endselect
    GoTo Main

SMTR:            ; prevod napeti na cisla Smetru
   Select Case b0
      case 0 to 5
      Gosub Jedna
      case 6 to 17
      Gosub Dva
      case 18 to 34
      Gosub Tri
      case 35 to 51
      Gosub Ctyri
      case 52 to 68
      Gosub Pet
      case 69 to 85
      Gosub Sest
      case 86 to 103
      Gosub Sedm
      case 104 to 120
      Gosub Osm
      case 121 to 138
      Gosub Devet
      case 139 to 155
      Gosub Jedna: Gosub Nula
      case 156 to 173
      Gosub Dva: Gosub Nula
      case 174 to 190
      Gosub Tri: Gosub Nula
      case 191 to 212
      Gosub Ctyri: Gosub Nula
      case 213 to 230
      Gosub Pet: Gosub Nula
      case 231 to 254
      Gosub Sest: Gosub Nula
    endselect
  GoTo Main

Nula:
Sound C.0,(b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b3)
Return
Jedna:
Sound C.0,(b2,b1,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b3)
Return
Dva:
Sound C.0,(b2,b1,0,b1,b2,b1,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b3)
Return
Tri:
Sound C.0,(b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b3,0,b1,b2,b3,0,b3)
Return
Ctyri:
Sound C.0,(b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b3,0,b3)
Return
Pet:
Sound C.0,(b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b3)
Return
Sest:
Sound C.0,(b2,b3,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b3)
Return
Sedm:
Sound C.0,(b2,b3,0,b1,b2,b3,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b3)
Return
Osm:
Sound C.0,(b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b1,0,b1,b2,b1,0,b3)
Return
Devet:
Sound C.0,(b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b1,0,b3)
Return
Cela:
Sound C.0,(b2,b3,0,b1,b2,b3,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b3,0,b1,b2,b3,0,b3)
Return
Moc:
Sound C.0,(b2,b3,0,b1,b2,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,0,b1,0,b1,b2,b1,0,b1,b2,b1,0,b1,0,b1,0,b1,b2,b3,0,b1,b2,b3,0,b1,b2,b3,0,b3)
Return


 

©   Jaroslav Skalník    -    15.5.2014  
 Home