-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAtmega16 + 16x2 Character lcd display .bas
76 lines (56 loc) · 1.16 KB
/
Atmega16 + 16x2 Character lcd display .bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
'======================================================================='
' Title: LCD Display Ohm Meter
' Last Updated : 01.2022
' Author : A.Hossein.Khalilian
' Program code : BASCOM-AVR 2.0.8.5
' Hardware req. : Atmega16 + 16x2 Character lcd display
'======================================================================='
$regfile = "m16def.dat"
$crystal = 1000000
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , _
Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Lcd = 16 * 2
Config Adc = Single , Prescaler = Auto
Config Portb = Input
Dim A As Word
Dim B As Byte
Dim I As Single
Dim R As Single
Dim V1 As Single
Dim V2 As Single
Start Adc
Cursor Off
Locate 1 , 6
Lcd "PLEASE"
Locate 2 , 3
Lcd "SELECT RANGE"
'*****************************************
Do
Main:
A = Getadc(0)
V2 = A * 0.004887
V1 = 5 - V2
I = V1 / 1000
R = V2 / I
B = Pinb
Select Case B
Case Is = &B00000001
Cls
Home
Lcd " Ohm"
Lowerline
Lcd " R =" ; R
Waitms 100
Goto Main
Case Is = &B00000010
R = R / 1000
Cls
Home
Lcd " Kilo Ohm"
Lowerline
Lcd " R =" ; R
Waitms 100
Goto Main
End Select
Loop
End