Mini-Programme für ATtiny13
LED-Blinker: ATtiny13
'ATtiny13 driving LEDs
$regfile = "attiny13.dat"
$crystal = 1200000
$hwstack = 8
$swstack = 4
$framesize = 4
Config Portb = Output
Do
Portb.3 = 1
Toggle Portb.4
Waitms 500
Loop
End
Zeitschalter ATtiny13
'Timer 60 s
$regfile = "attiny13.dat"
$crystal = 1200000
$hwstack = 8
$swstack = 4
$framesize = 4
Config Portb.4 = Output
Portb.3 = 1 'Pullup
Do
Do
Loop Until Pinb.3 = 0
Portb.4 = 1
Waitms 60000
Portb.4 = 0
Loop
End
Weicher LED-Blinker
'LED soft flasher
$regfile = "attiny13.dat"
$crystal = 1200000
$hwstack = 8
$swstack = 4
$framesize = 4
Dim I As Byte
Dim D As Integer
Config Portb = Output
Config Timer0 = Pwm , Prescale = 1 , Compare A Pwm = Clear Down
Do
For I = 40 To 215
If I < 128 Then
D = I
D = D * D
End If
If I > 127 Then
D = 255 - I
D = D * D
End If
D = D / 64
Pwm0a = D
Waitms 60
Next I
Waitms 800
Loop
End
Dämmerungsschalter ATtiny13
'Dämmerungsschalter
$regfile = "attiny13.dat"
$crystal = 1200000
$hwstack = 8
$swstack = 4
$framesize = 4
Dim U As Word
Config Adc = Single , Prescaler = Auto
Start Adc
Config Portb = 1 'Output B.0
Do
U = Getadc(3)
If U < 400 Then Portb.0 = 0
If U > 600 Then Portb.0 = 1
Waitms 1000
Loop
End
Dreiphasen-Blinklicht ATiny13
'Dreiphasen-Blinker 1500ms, 0,67 Hz
$regfile = "attiny13.dat"
$crystal = 1200000
$hwstack = 8
$swstack = 4
$framesize = 4
Config Portb = Output
Do
Portb.0 = 1
Waitms 250
Portb.3 = 0
Waitms 250
Portb.4 = 1
Waitms 250
Portb.0 = 0
Waitms 250
Portb.3 = 1
Waitms 250
Portb.4 = 0
Waitms 250
Loop
End