$regfile = "m16def.dat" : $crystal = 1000000
Config Portb = Output , Portd = Output
Config Adc = Single , Prescaler = Auto , Reference = Internal
Dim A As Word , W As Word , C As Word
Dim First As Word , Secend As Word , Thirt As Word
Start Adc
Do
A = Getadc(7) : A = A * 25
If A > 10000 Then :
First = 10 : Secend = 10 : Thirt = 10
Else :
First = A / 1000 : W = First * 1000
A = A - W : Secend = A / 100
W = Secend * 100 : A = A - W : Thirt = A / 10
If First = 0 Then First = 14
End If
For C = 0 To 50
Set Portd.1
Set Portd.2
Reset Portd.0
Portb = Lookup(first , Digits)
Reset Portb.7
Waitms 10
Set Portd.0
Set Portd.2
Reset Portd.1
Portb = Lookup(secend , Digits)
Set Portb.7
Waitms 10
Set Portd.0
Set Portd.1
Reset Portd.2
Portb = Lookup(thirt , Digits)
Reset Portb.7
Waitms 10
Next
Loop
End
'******** Data **********************************
Digits:
Data 63 , 6 , 91 , 79 , 102 , 109 , 125 , 7 , 127 , 111 , 64 , 128 , 56 , 70 , 00
' 0 1 2 3 4 5 6 7 8 9 - dp L +
'************************************************