نام کلوب :آموزشگاه میكروكنترلر
نام انگلیسی : avr_mcu_lab
تاسیس : 3 شهریور 1385
216 عضو ، 55 بحث ، 5 آلبوم ، 7 مقاله

آموزشگاه میكروكنترلر AVR

تبلیغات

__
عنوان بحث
ساعت دیجیتالی
13 آذر 86 - 19:17

سلام اینجا كسی می تونه بهم كمك كنه

من میخوام با میكروكنترلر در keil و proteous ساعت دیجیتالی بنویسم كسی اگه در این مورد كمكم كنه ممنون می شم

پاسخ ها
ترتیب پاسخ ها : از اولین پاسخ
1
26 آذر 1386 ساعت 22:39
in barname ba bascom neveshtam , omidvaram be dardet bokhore




$regfile = "m32def.dat"
$crystal = 1000000
'******************************************
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdpin = Pin , Db4 = Portd.2 , Db5 = Portd.3 , _
Db6 = Portd.4 , Db7 = Portd.5 , E = Portd.7 , Rs = Portd.6
'******************************************
Config Kbd = Portc , Debounce = 100
Config Porta = Output
'******************************************
Sound Porta.0 , 50 , 1000
'******************************************
Dim A As Long , I As Long , B As Byte
Dim C As Byte
Dim D As Byte
Dim E As Byte
Dim F As Byte
Dim G As Byte
Dim H As Byte
Dim M As Byte
Dim S As Byte
Dim Z As Byte
Dim U As Byte
Dim Y As Word
Y = 1386
'******************************************
Readeeprom M , 0
Readeeprom H , 1
Readeeprom D , 2
Readeeprom U , 3
Readeeprom Y , 4
Main:
Cursor Off
Cls
'CCCCCCCllllllllllllooooooooooocccccckkkkkk
Clock:
Deflcdchar 0 , 32 , 32 , 32 , 32 , 21 , 31 , 32 , 32        ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 4 , 4 , 4 , 4 , 7 , 32 , 32             ' replace ? with number (0-7)
Deflcdchar 2 , 32 , 32 , 7 , 4 , 4 , 31 , 32 , 32           ' replace ? with number (0-7)
Deflcdchar 3 , 32 , 32 , 10 , 32 , 17 , 31 , 32 , 32        ' replace ? with number (0-7)
'********************************
Deflcdchar 4 , 8 , 9 , 10 , 8 , 9 , 15 , 32 , 32            ' replace ? with number (0-7)
Deflcdchar 5 , 32 , 32 , 1 , 1 , 2 , 4 , 8 , 16             ' replace ? with number (0-7)
Deflcdchar 6 , 32 , 32 , 32 , 2 , 30 , 32 , 20 , 32         ' replace ? with number (0-7)
Deflcdchar 7 , 4 , 32 , 14 , 18 , 7 , 8 , 8 , 7             ' replace ? with number (0-7)
'********************************
S = 0
Cls
Lcd Chr(3)
Lcd Chr(2)
Lcd Chr(1)
Lcd Chr(0)
Lcd ":"
Locate 1 , 7
Lcd H
Lcd ":"
Lcd M
Locate 1 , 12
Lcd ":"
Locate 2 , 1
Lcd Chr(7)
Lcd Chr(6)
Lcd Chr(5)
Lcd Chr(4)
Lcd ":"
Locate 2 , 7
Lcd Y
Lcd "/"
Lcd U
Lcd "/"
Lcd D
For B = 1 To 60
Locate 1 , 13
Lcd S
Waitms 915
Incr S
A = Getkbd()
If A = 14 Then Display On
If A = 15 Then Display Off
'If A = 2 Then Goto Amir
'If A = 3 Then Goto Game
'If A = 1 Then Goto Freq
If A = 4 Then Goto Pakhche
If A = 5 Then Goto Asghar
If A = 6 Then Goto Bagher
If A = 7 Then Goto Akbar
If A = 8 Then Goto Ghasem
If A = 9 Then Goto Ghader
If A = 10 Then Goto Susk
If A = 11 Then Goto Jamshid
Next
'********************************
S = 0
Incr M
Writeeeprom M , 0
If M < 60 Then Goto Clock
'********************************
M = 0
S = 0
Incr H
Writeeeprom H , 1
If H < 25 Then Goto Clock
'********************************
M = 0
S = 0
H = 0
Incr D
Writeeeprom D , 2
If D < 31 Then Goto Clock
'********************************
M = 0
S = 0
H = 0
D = 0
Incr U
Writeeeprom U , 3
If U < 13 Then Goto Clock
'********************************
S = 0
M = 0
H = 0
D = 0
U = 0
Incr Y
Writeeeprom Y , 4
Goto Clock
'********************************
Asghar:
S = 0
Incr M
Writeeeprom M , 0
If M < 60 Then Goto Clock
M = 0
Goto Clock
'********************************
Bagher:
Incr H
Writeeeprom H , 1
If H < 25 Then Goto Clock
H = 0
Goto Clock
'********************************
Akbar:
Incr D
Writeeeprom D , 2
If D > 31 Then Goto Clock
D = 0
Goto Clock
'********************************
Ghasem:
Incr U
Writeeeprom U , 3
If U < 13 Then Goto Clock
U = 0
Goto Clock
'********************************
Ghader:
Y = Y + 1
Writeeeprom Y , 4
Goto Clock
'********************************
Pakhche:
S = 0
Goto Clock
'********************************
Susk:
Decr Y
Writeeeprom Y , 4
Goto Clock
'********************************
Jamshid:
S = 0
M = 0
H = 0
D = 0
U = 0
Y = 1386
Writeeeprom M , 0
Writeeeprom H , 1
Writeeeprom D , 2
Writeeeprom U , 3
Writeeeprom Y , 4
Goto Clock
End                                                         'end program
__