-
Notifications
You must be signed in to change notification settings - Fork 0
/
Atmega8 + 74LS90 + 16x2 Character lcd display.bas
106 lines (83 loc) · 2.05 KB
/
Atmega8 + 74LS90 + 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
'======================================================================='
' Title: LCD Display frequency meter
' Last Updated : 01.2022
' Author : A.Hossein.Khalilian
' Program code : BASCOM-AVR 2.0.8.5
' Hardware req. : Atmega8 + 74LS90 + 16x2 Character lcd display
'======================================================================='
$regfile = "m8def.dat"
$crystal = 11059200
$hwstack = 64
$swstack = 64
$framesize = 64
Config Lcdpin = Pin , Db4 = Pinc.3 , Db5 = Pinc.2 , Db6 = Pinc.1 , Db7 = _
Pinc.0 , E = Pinc.4 , Rs = Pinc.5
Config Lcd = 16 * 2
Cursor Off : Cls
Open "comb.5:9600,8,n,1,inverted" For Output As #1
Print #1 , "serial output test"
Config Pinb.0 = Input
Set Portb.0
Config Timer1 = Counter , Edge = Falling
Config Timer0 = Timer , Prescale = 64
Enable Interrupts
Enable Timer0
Enable Timer1
On Ovf1 Pulse
On Ovf0 Ov0
Dim A As Long
Dim I As Long
Dim B As Byte
Dim C As Single
Cls
Cursor Off
Home : Lcd " Digital"
Lowerline
Lcd "Frequency Meter"
Waitms 500
Start Timer0
'-----------------------------------------------------------
Do
Loop
End
''''''''''''''''''''''''''''''
Ov0:
Incr I
If I = 675 Then
Stop Timer0
A = B * 65536
A = A + Counter1
Cls : Home
If Pinb.0 = 0 Then
Lcd "High: 1MHz-1GHz"
Lowerline
A = A * 12800
C = A / 1000000
Lcd "F= " ; Fusing(c , "#.&&&&&&") ; "MHz"
Print #1 , "~"
Print #1 , "F= " ; Fusing(c , "#.&&&&&&") ; "MHz"
Else
Lcd "Low: 1Hz-1MHz"
Lowerline
If A < 1000 Then
Lcd "F= " ; A ; " Hz"
Print #1 , "~"
Print #1 , "F= " ; A ; "Hz"
End If
If A > 1000 Then
C = A / 1000
Lcd "F= " ; Fusing(c , "#.&&&") ; " KHz"
Print #1 , "~"
Print #1 , "F= " ; Fusing(c , "#.&&&") ; "KHz"
End If
End If
Counter1 = 0 : B = 0 : I = 0
Start Timer0
End If
Return
''''''''''''''''''''''''''''''
Pulse:
Incr B
Counter1 = 0
Return
'-----------------------------------------------------------