09-01-2014، 09:56 PM
S1.zip (اندازه 17.73 KB / تعداد دانلود: 2)
کد پیاچپی:
$regfile = "M8def.dat"
$crystal = 1000000
Config Portd = Input
Config Portb = Output : Portb = 0
Config Pinc.0 = Output : S1 Alias Portc.0 : Set S1
Config Pinc.1 = Output : S2 Alias Portc.1 : Set S2
Config Pinc.2 = Output : S3 Alias Portc.2 : Set S3
Config Pinc.3 = Output : S4 Alias Portc.3 : Set S4
Dim A As Word
Dim Aa As Word
Dim I As Byte
Dim T As Word : T = 1
Declare Sub Show(byval A As Word)
Do
A = Pind
'A = 4321
Call Show(a)
Loop
End
'//////////////////////////// End Program //////////////////////////////
'******************************************* Show
Sub Show(a As Word)
Do
Incr I
Aa = A Mod 10
Select Case I
Case 1:
Portb = Lookup(aa , Annode_display)
Set S1 : Waitms T
Case 2:
Portb = Lookup(aa , Annode_display)
Set S2 : Waitms T
Case 3:
Portb = Lookup(aa , Annode_display)
Set S3 : Waitms T
Case 4:
Portb = Lookup(aa , Annode_display)
Set S4 : Waitms T
End Select
Reset S1 : Reset S2 : Reset S3 : Reset S4
A = A \ 10 : If A = 0 Then Exit Do
Loop
I = 0
Reset S1 : Reset S2 : Reset S3 : Reset S4
End Sub
'_____________________________ For Annode Display
Annode_display:
Data 192 , 249 , 164 , 176 , 153 , 146 , 130 , 248 , 128 , 144 , 191 , 127 , 199 , 143
'CHAR 0 1 2 3 4 5 6 7 8 9 - dp L +
' 0 1 2 3 4 5 6 7 8 9 10 11 12 13