$regfile = "m8535.dat"
$crystal = 4000000
$baud = 9600
$hwstack = 32
$swstack = 8
$framesize = 24
'===============================================================================
Config Graphlcd = 240 * 64 , Dataport = Portb , Controlport = Portc , Ce = 5 , Cd = 4 , Wr = 6 , Rd = 7 , Reset = 4 , Fs = 1 , Mode = 8
Config Adc = Single , Prescaler = Auto , Reference = Internal
Dim X As Byte , Y As Byte , I As Integer , G As Integer
Dim W As Word , A(4) As Single , B(4) As String * 5 , C(4) As Single , D(4) As Integer , E(4) As Integer , D1 As Integer , D2 As Integer , D3 As Integer , D4 As Integer
'===============================================================================
Start Adc
Cls
Waitms 100
Cursor Off Noblink
Waitms 100
Showpic 240 , 0 , Logo
Wait 2
'===============================================================================
Main:
Do
Gosub Getvalue
Gosub Displaytext
Gosub Displaybar
Gosub Sendserial
Loop
'===============================================================================
Getvalue:
For I = 1 To 4 Step 1
W = Getadc(i)
E(i) = W
C(i) = W * 0.0537109375
A(i) = W * 0.0048828125
Waitms 100
Next I
Return
'===============================================================================
Displaytext:
Locate 1 , 50 : Lcd "1="
Waitms 100
B(1) = Fusing(a(1) , "#.##")
Locate 1 , 52 : Lcd B(1)
Waitms 100
Locate 1 , 56 : Lcd "V"
Waitms 100
'===========================
Locate 3 , 50 : Lcd "2="
Waitms 100
B(2) = Fusing(a(2) , "#.##")
Locate 3 , 52 : Lcd B(2)
Waitms 100
Locate 3 , 56 : Lcd "V"
Waitms 100
'===========================
Locate 5 , 50 : Lcd "3="
Waitms 100
B(3) = Fusing(a(3) , "#.##")
Locate 5 , 52 : Lcd B(3)
Waitms 100
Locate 5 , 56 : Lcd "V"
Waitms 100
'===========================
Locate 7 , 50 : Lcd "4="
Waitms 1000
B(4) = Fusing(a(4) , "#.##")
Locate 7 , 52 : Lcd B(4)
Waitms 100
Locate 7 , 56 : Lcd "V"
Waitms 100
Return
Displaybar:
For I = 1 To 4 Step 1
D(i) = 53 - Round(c(i))
If D(i) = 0 Then
D(i) = 53
Elseif D(i) =< 9 Then
D(i) = 9
Else
D(i) = D(i)
End If
D1 = D(1)
D2 = D(2)
D3 = D(3)
D4 = D(4)
Next I
'======================================
Boxfill(24 , 9) -(39 , 53) , 0
Waitms 100
Boxfill(24 , D1) -(39 , 53) , 1
Waitms 100
'======================================
Boxfill(56 , 9) -(71 , 53) , 0
Waitms 100
Boxfill(56 , D2) -(71 , 53) , 1
Waitms 100
'======================================
Boxfill(87 , 9 ) -(102 , 53 ) , 0
Waitms 100
Boxfill(87 , D3 ) -(102 , 53 ) , 1
Waitms 100
'======================================
Boxfill(120 , 9) -(135 , 53) , 0
Waitms 100
Boxfill(120 , D4) -(135 , 53) , 1
Waitms 100
Return
Sendserial:
For I = 1 To 4 Step 1
Print E(i)
Waitms 100
Next I
Return
End
Logo:
$bgf "kordinat.bgf"