'------------------------------------ 'Project: ALC 2 'Date: 5.5.2002 'Copyright: Rudi Slejkovec 'Home page: www.avr.4mg.com 'Device: ATMEL AVR mikrokontroler 'Compiler: Bascom AVR '------------------------------------ $regfile = "attiny2313.dat" $crystal = 1000000 Dim W As Byte , S As Byte Alarm Alias Portb.7 Ready Alias Portb.6 Beep Alias Portb.5 D1 Alias Pinb.3 D2 Alias Pinb.2 D3 Alias Pinb.1 D4 Alias Pinb.0 Key Alias Pind.6 S1 Alias Pind.5 S2 Alias Pind.4 Ddrb = &B11110000 Ddrd = &B10001111 Portb = 0 Portd = 0 Set Portb.3 Set Portb.2 Set Portb.1 Set Portb.0 Set Portd.6 Set Portd.5 Set Portd.4 Set Alarm Set Ready Start1: Do If Key = 0 Then Wait 1 End If If Key = 1 Then Wait 30 Reset Ready Goto Begin End If Loop Begin: Do If S1 = 1 Then Gosub Pause Wait W Reset Alarm Gosub Piezzo End If If S2 = 1 Then Reset Alarm Gosub Piezzo End If If Key = 0 Then Set Ready Set Alarm Goto Start1 End If Loop Pause: W = 0 If D1 = 0 Then W = W + 2 End If If D2 = 0 Then W = W + 4 End If If D3 = 0 Then W = W + 6 End If If D4 = 0 Then W = W + 8 End If W = W + 1 Return Piezzo: Set Beep For S = 0 To 119 If Key = 0 Then Set Ready Set Alarm Reset Beep Goto Start1 End If Wait 1 Next S Reset Beep Return