'Sparrow_TX300.bas
'adjust freq by S1 and S2
$regfile = "attiny13.dat"
$crystal = 9600000
$hwstack = 8
$swstack = 4
$framesize = 4
Led1 Alias Portb.1
Led2 Alias Portb.3
S1 Alias Pinb.0
S2 Alias Pinb.2
Config Portb = &B000011010
Dim F As Byte
Clkpr = 128 '4.8 MHz
Clkpr = 1
Clkpr = 1
Declare Sub Tx
Do
Portb.4 = 0
Tx
F = Osccal
If S1 = 0 Then 'S1 F-
If F > 10 Then F = F - 1
Osccal = F
Waitms 100
Do
Loop Until S1 = 1
Waitms 100
End If
If S2 = 0 Then 'S2 F+
If F < 120 Then F = F + 1
Osccal = F
Waitms 100
Do
Loop Until S2 = 1
Waitms 100
End If
Loop
Sub Tx '250 kHz ...500 kHz
Do
Portb.1 = 1
sbis pinb , 0
rjmp Ende
nop
nop
nop
Portb.1 = 0
sbis pinb , 2
rjmp Ende
nop
nop
nop
Loop
Ende:
End Sub
End