, .1. ATtiny2313, (1024 ) .   S1 (). S2 () , S5 () . Ѡ S3 ( ) .

. 1 -

(), HD44780 . ITM1602ATR MT-16S2H. , 1 10 .

1. USB TTL (USB UART), (PLS) X13 X16. 12, 0,5, (5) 78L05. , , DD2 DD2.3, DD2.4 (CD4011B), VT1, HCM 12-12.

, , , 1 , .
Timer.bas :

'
' 1 59 .
' .
' LCD 16*2
$regfile = "attiny2313a.dat" '
$crystal = 1024000 ' 1024
$hwstack = 40
$swstack = 16
$framesize = 32
'$sim

' 1-59
Config Timer1 = Timer , Prescale = 1024 , Clear Timer = 1 '.=1024
Stop Timer1 '
Timer1 = 0
Config Int0 = Falling '
Ddrd = &B00001000 ' , PORTD.3- 𠠠

Portd = &B01110100 ' 2-INT0,PD4-, PD5-, PD6-
Config Debounce = 75 '

' :
Dim Minut As Byte '
Dim Sec As Byte '
Dim Mins As Byte '

Const Count = 1000 ' =1024 =1024, 1000 =1
On Int0 Ustanov ' . . ()
On Compare1a Compare '

Compare1a = Count '

Enable Interrupts '
Enable Int0 '
Enable Compare1a '

Do '

Cls '
Locate 1 , 4 '1- , 4-
Lcd ; Minut ; ":" ; Sec '
Locate 2 , 6 ' 2- , 6-
Lcd "Minutes=" ; Mins
Wait 100 ' 100
Loop

Ustanov: '.. INT0
Do
Waitms 75 '
Stop Timer1
If Portd.4 = 0 Then '
Wait 1 ' 1
Incr Mins '
If Mins => 60 Then '
Mins = 0
End If
End If
If Portd.5 = 0 Then '
Wait 1
Decr Mins '
If Mins =< 0 Then '
Mins = 0
End If
End If
Cls
Lcd "INPUT MINUTES:" ; Mins '
If Portd.6 = 0 Then '
Exit Do
End If
Loop
Sec = 0
Start Timer1 ' 1
Return

Compare: ' .
Stop Timer1 ' 1
Incr Sec '.
If Sec => 60 Then ' .
Sec = 0
Incr Minut
If Minut = Mins Then '
Stop Timer1
Timer1 = 0
Set Portd.3 '
Return
End If
End If
Start Timer1
Return

End 'end program

, , . , . .
Clock.bas:

' , .
' LCD 16*2
$regfile = "attiny2313a.dat" '
$crystal = 1024000 ' =1024
$hwstack = 40
$swstack = 16
$framesize = 32

'Config Portd.3 = Output '
Reset Portd.3
Config Pind.2 = Input '
Set Portd.2
Config Int0 = Falling '
Config Pind.4 = Input ' .
Set Portd.4
Config Pind.5 = Input ' .
Set Portd.5
Config Pind.6 = Input ' .
Set Portd.6
Config Timer1 = Timer , Prescale = 1024 , Clear Timer = 1 '. 1,=1024,
Config Debounce = 75 '

' :
Dim Minut As Byte '
Dim Heoer As Byte '
Dim Sec As Byte '

On Int0 Stand '
On Compare1a Pulse '

Const Count = 1000 '- 1 = 1
Compare1a = Count '

Enable Interrupts '
Enable Int0
Enable Compare1a

Do '
Cls '
Locate 1 , 4 ' , (LCD 16x2)
Lcd ; Heoer ; ":" ; Minut '
Waitms 250 ' 250
Loop

Stand: '. . INT0
Do '
If Portd.4 = 0 Then '
Incr Minut '
If Minut => 60 Then '
Minut = 0
End If
End If
If Portd.5 = 0 Then '
Decr Minut '
If Minut <= 0 Then '
Minut = 0
End If
End If
Cls
Lcd "Input Minutes:" ; Minut '
If Portd.6 = 0 Then '
Exit Do
End If
Loop
Do '
If Portd.4 = 0 Then '
Incr Heoer
If Heoer => 24 Then '
Heoer = 0
End If
End If
If Portd.5 = 0 Then '
Decr Heoer
If Heoer <= 0 Then '
Heoer = 0
End If
End If
Cls
Lcd "Input Heoers:" ; Heoer '
If Portd.6 = 0 Then
Exit Do '
End If
Loop
Sec = 0 '
Start Timer1
Return

Pulse: '. .
Stop Timer1
Incr Sec '
If Sec => 60 Then '
Sec = 0
Incr Minut
If Minut => 60 Then '
Sec = 0
Minut = 0
Incr Heoer
If Heoer => 24 Then '
Sec = 0
Minut = 0
Heoer = 0
End If
End If
End If
Start Timer1
Return

End 'end program

Bascom USB - TTL, . - S1, S5, S3 , .

(Urxc). ʠ , , ( ENTER) . .2.

. 2 -

clockterm.bas :

'
' Bascom
' LCD 16*2
$regfile = "attiny2313a.dat" '
$crystal = 1024000 ' =1024
$hwstack = 40
$swstack = 16
$framesize = 32
'$sim

Config Pind.0 = Output 'UART-RXC
Config Pind.1 = Input 'UART-TXD
Config Timer1 = Timer , Prescale = 1024 , Clear Timer = 1 '. 1, =1024,
Stop Timer1
Timer1 = 0

' :
Dim Minut As Byte '
Dim Heoer As Byte '
Dim Sec As Byte '

On Urxc Stand '
On Compare1a Pulse '

Const Count = 1000 '- 1, = 1
Compare1a = Count '

Enable Interrupts '
Enable Urxc
Enable Compare1a

Do '
Cls '
Locate 1 , 4 ' , (LCD 16x2)
Lcd ; Heoer ; ":" ; Minut '
Waitms 100 ' 100
Loop

Stand: '. .
Stop Timer1
Timer1 = 0
Input " :" , Minut '
Input " :" , Heoer '
Sec = 0 '
Start Timer1
Return

Pulse: '. .
Stop Timer1
Incr Sec '
If Sec => 60 Then '
Sec = 0
Incr Minut
If Minut => 60 Then '
Sec = 0
Minut = 0
Incr Heoer '
If Heoer => 24 Then '
Sec = 0
Minut = 0
Heoer = 0
End If
End If
End If
Start Timer1
Return

End 'end program


(6060 ) PCAD FILE PCAD. Kitchen_Timer_prog.

, , . .. , , . , .

andre