-
Notifications
You must be signed in to change notification settings - Fork 0
/
Atmega32 + 16x2 Character lcd display.bas
51 lines (37 loc) · 1.21 KB
/
Atmega32 + 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
'======================================================================='
' Title: LCD Display Voltmeter 5-0
' Last Updated : 03.2022
' Author : A.Hossein.Khalilian
' Program code : BASCOM-AVR 2.0.8.5
' Hardware req. : Atmega32 + 16x2 Character lcd display
'======================================================================='
$regfile = "m32def.dat"
$crystal = 1000000
Config Lcdpin = Pin , Rs = Pind.0 , E = Pind.2 , Db4 = Pind.4 , Db5 = Pind.5 , Db6 = Pind.6 , Db7 = Pind.7
Config Lcd = 16 * 2
Cursor Off
Cls
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Dim W As Word
Dim Input_mv As Single
Dim Input_v As Single
'-----------------------------------------------------------
Do
Gosub Read_the_adc
Gosub Display_lcd
Waitms 200
Loop
End
'-----------------------------------------------------------
Read_the_adc:
W = Getadc(7)
Input_mv = W * 4.8828125
Input_v = Input_mv / 1000
Return
''''''''''''''''''''''''''''''
Display_lcd:
Locate 1 , 1 : Lcd "Input: " ; Fusing(input_v , "#.#") ; "V"
Locate 2 , 1 : Lcd "Input: " ; Fusing(input_mv , "#.#") ; "mV"
Return
'-----------------------------------------------------------