سلام
برنامه زیر برا یه سون سگمنت 4تایی نوشته شده برا اینکه تبدیلش کنم به سون سگمنت های تکی چه تغیراتی باید بدهم؟
ممنون
$regfile = "M8def.dat"
$crystal = 1000000
Config Adc = Single , Prescaler = Auto
Config Pinc.5 = 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
Dim A As Word
Dim Aa As Word
Dim I As Byte
Dim T As Word : T = 1
Dim W As Single
Declare Sub Show(byval A As Word)
Do
Start Adc
A = Getadc(5)
Stop Adc
If A < 205 Then
A = 0
Else
A = A - 205
W = A / 2.72
A = W
End If
Call Show(a)
Loop
End
'******************************* 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
End Select
Reset S1 : Reset S2 : Reset S3
A = A \ 10 : If A = 0 Then Exit Do
Loop
I = 0
Reset S1 : Reset S2 : Reset S3
End Sub
'_____________________________ For Annode Display
Annode_display:
Data 192 , 249 , 164 , 176 , 153 , 146 , 130 , 248 , 128 , 144
'CHAR 0 1 2 3 4 5 6 7 8 9
$crystal = 1000000
Config Adc = Single , Prescaler = Auto
Config Pinc.5 = 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
Dim A As Word
Dim Aa As Word
Dim I As Byte
Dim T As Word : T = 1
Dim W As Single
Declare Sub Show(byval A As Word)
Do
Start Adc
A = Getadc(5)
Stop Adc
If A < 205 Then
A = 0
Else
A = A - 205
W = A / 2.72
A = W
End If
Call Show(a)
Loop
End
'******************************* 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
End Select
Reset S1 : Reset S2 : Reset S3
A = A \ 10 : If A = 0 Then Exit Do
Loop
I = 0
Reset S1 : Reset S2 : Reset S3
End Sub
'_____________________________ For Annode Display
Annode_display:
Data 192 , 249 , 164 , 176 , 153 , 146 , 130 , 248 , 128 , 144
'CHAR 0 1 2 3 4 5 6 7 8 9
دیدگاه