欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
BASCOM-8051寫的單片機(jī)開發(fā)板4位led時(shí)鐘仿真附帶串口輸出程序
[打印本頁]
作者:
hotpet
時(shí)間:
2020-4-22 23:55
標(biāo)題:
BASCOM-8051寫的單片機(jī)開發(fā)板4位led時(shí)鐘仿真附帶串口輸出程序
用BASCOM-8051寫的4位led時(shí)鐘,帶串口輸出。附源碼,hex文件,protues仿真文件。
代碼較粗燥,只是為了驗(yàn)證軟硬件功能。
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
LEDx4-8051.JPG
(312.73 KB, 下載次數(shù): 40)
下載附件
2020-4-22 23:45 上傳
單片機(jī)源程序如下:
$crystal = 11059000
$baud = 9600
Dim Ct As Byte
Dim H As Byte
Dim H1 As Byte
Dim H2 As Byte
Dim M As Byte
Dim M1 As Byte
Dim M2 As Byte
Dim S As Byte
Dim S1 As Byte
Dim S2 As Byte
Dim Led0 As Bit 'LED is a Bit variable since it will turn on and
Dim Led1 As Bit
Dim Point As Byte
Dim K As Byte
Dim A(10) As Byte
A(1) = Not &H06
A(2) = Not &H5B
A(3) = Not &H4F
A(4) = Not &H66
A(5) = Not &H6D
A(6) = Not &H7D
A(7) = Not &H07
A(8) = Not &H7F
A(9) = Not &H6F
A(10) = Not &H3F
Config Timer0 = Timer , Gate = Internal , Mode = 1
'Timer0 = counter : timer0 operates as a counter
'Gate = Internal : no external gate control
'Mode = 2 : 8-bit auto reload (default)
'Mode = 1 : 16-bit reload
On Timer0 Timer_0_int
Load Timer0 , 0 'when the timer reaches 100 an interrupt will occur
Enable Interrupts 'enable the use of interrupts
Enable Timer0 'enable the timer
Rem Setting Of Priority
Priority Set Timer0 'highest priority
Start Timer0
Led0 = 1
Led1 = 0
P2 = &HFF
Do
K = Inkey()
If K = 48 Then
M = M + 1
If M = 60 Then
M = 0
End If
Elseif K = 49 Then
M = M - 1
If M = 255 Then
M = 59
End If
End If
P2.0 = 0
P0 = A(m1)
Waitms 2
P2.0 = 1
Waitms 3
P2.1 = 0
If Point = 1 Then
P0 = A(m2) + &H80
Else
P0 = A(m2)
End If
Waitms 2
P2.1 = 1
Waitms 3
P2.2 = 0
P0 = A(s1)
Waitms 2
P2.2 = 1
Waitms 3
P2.3 = 0
P0 = A(s2)
Waitms 2
P2.3 = 1
Waitms 3
Loop
End
Rem The Interrupt Handler For The Timer0 Interrupt
Timer_0_int:
If Ct = 13 Then
Ct = 0
P1.1 = Led1
P1.0 = Led0
Led0 = Not Led0
Led1 = Not Led1 'invert LED value
H1 = H / 10
H2 = H Mod 10
M1 = M / 10
M2 = M Mod 10
S1 = S / 10
S2 = S Mod 10
Point = S Mod 2
Print "Time is:" ; H1 ; H2 ; ":" ; M1 ; M2 ; ":" ; S1 ; S2 '; (Second / 10) ;
If M1 = 0 Then
M1 = 10
End If
If M2 = 0 Then
M2 = 10
End If
If S1 = 0 Then
S1 = 10
End If
If S2 = 0 Then
S2 = 10
End If
S = S + 1
If S = 60 Then
S = 0
M = M + 1
If M = 60 Then
M = 0
H = H + 1
If H = 24 Then
H = 0
End If
End If
End If
Else
Incr Ct
End If
Return
復(fù)制代碼
所有資料51hei提供下載:
QXmini51.zip
(612.65 KB, 下載次數(shù): 8)
2020-4-22 23:39 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
富貴竹
時(shí)間:
2020-7-22 22:52
hotpet 你好,看到你發(fā)的BASCOM 貼我很高興,希望能加你 QQ
作者:
富貴竹
時(shí)間:
2020-7-22 22:52
hotpet 你好,看到你發(fā)的 BASCOM 貼很想和你聯(lián)系一下 請(qǐng)加我QQ 976086284
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1