Action
Retrieves the analog value from a 89C2051 or 89C4051.
Syntax
var = GETAD2051()
Remarks
var |
The variable that is assigned with the A/D value |
The GETAD2051() function is only intended for the 89C2051 and 89C4051. It uses the analog comparator of the chip.
Connect the hardware as following :
See also
Example
$regfile = "89c2051.dat"
Dim A As Byte
Do
A = Getad2051()
A = Lookup(a , Dta)
Print A
Loop
End
'this table converts the value into a packed BCD value
'this value can be used to diaplay the value on 2 7-segment displays
Dta:
Data 0 ' 0 0.000
Data 1 ' 1 0.047
Data 1 ' 2 0.093
Data 2 ' 3 0.138
Data 2 ' 4 0.184
Data 3 ' 5 0.229
Data 3 ' 6 0.273
Data 3 ' 7 0.317
Data 4 ' 8 0.361
Data 4 ' 9 0.404
Data 5 ' 10 0.447
Data 5 ' 11 0.489
Data 6 ' 12 0.531
Data 6 ' 13 0.573
Data 6 ' 14 0.614
Data 7 ' 15 0.655
Data 7 ' 16 0.696
Data 8 ' 17 0.736
Data 8 ' 18 0.776
Data 8 ' 19 0.815
Data 9 ' 20 0.854
Data 9 ' 21 0.893
Data &H10 ' 22 0.931
Data &H10 ' 23 0.969
Data &H10 ' 24 1.006
Data &H11 ' 25 1.044
Data &H11 ' 26 1.080
Data &H11 ' 27 1.117
Data &H12 ' 28 1.153
Data &H12 ' 29 1.189
Data &H12 ' 30 1.224
Data &H13 ' 31 1.260
Data &H13 ' 32 1.295
Data &H13 ' 33 1.329
Data &H14 ' 34 1.363
Data &H14 ' 35 1.397
Data &H14 ' 36 1.431
Data &H15 ' 37 1.464
Data &H15 ' 38 1.497
Data &H15 ' 39 1.530
Data &H16 ' 40 1.562
Data &H16 ' 41 1.594
Data &H16 ' 42 1.626
Data &H17 ' 43 1.657
Data &H17 ' 44 1.688
Data &H17 ' 45 1.719
Data &H18 ' 46 1.750
Data &H18 ' 47 1.780
Data &H18 ' 48 1.810
Data &H19 ' 49 1.840
Data &H19 ' 50 1.869
Data &H19 ' 51 1.898
Data &H19 ' 52 1.927
Data &H20 ' 53 1.956
Data &H20 ' 54 1.984
Data &H20 ' 55 2.012
Data &H21 ' 56 2.040
Data &H21 ' 57 2.068
Data &H21 ' 58 2.095
Data &H21 ' 59 2.122
Data &H22 ' 60 2.149
Data &H22 ' 61 2.176
Data &H22 ' 62 2.202
Data &H22 ' 63 2.228
Data &H23 ' 64 2.254
Data &H23 ' 65 2.279
Data &H23 ' 66 2.305
Data &H23 ' 67 2.330
Data &H24 ' 68 2.355
Data &H24 ' 69 2.379
Data &H24 ' 70 2.404
Data &H24 ' 71 2.428
Data &H25 ' 72 2.452
Data &H25 ' 73 2.476
Data &H25 ' 74 2.499
Data &H25 ' 75 2.523
Data &H26 ' 76 2.546
Data &H26 ' 77 2.569
Data &H26 ' 78 2.591
Data &H50 ' 79 5.000
Data &H49 ' 80 4.953
Data &H49 ' 81 4.907
Data &H48 ' 82 4.862
Data &H48 ' 83 4.816
Data &H47 ' 84 4.771
Data &H47 ' 85 4.727
Data &H47 ' 86 4.683
Data &H46 ' 87 4.639
Data &H46 ' 88 4.596
Data &H45 ' 89 4.553
Data &H45 ' 90 4.511
Data &H44 ' 91 4.469
Data &H44 ' 92 4.427
Data &H44 ' 93 4.386
Data &H43 ' 94 4.345
Data &H43 ' 95 4.304
Data &H42 ' 96 4.264
Data &H42 ' 97 4.224
Data &H42 ' 98 4.185
Data &H41 ' 99 4.146
Data &H41 ' 100 4.107
Data &H40 ' 101 4.069
Data &H40 ' 102 4.031
Data &H40 ' 103 3.994
Data &H39 ' 104 3.956
Data &H39 ' 105 3.920
Data &H39 ' 106 3.883
Data &H38 ' 107 3.847
Data &H38 ' 108 3.811
Data &H38 ' 109 3.776
Data &H37 ' 110 3.740
Data &H37 ' 111 3.705
Data &H37 ' 112 3.671
Data &H36 ' 113 3.637
Data &H36 ' 114 3.603
Data &H36 ' 115 3.569
Data &H35 ' 116 3.536
Data &H35 ' 117 3.503
Data &H35 ' 118 3.470
Data &H34 ' 119 3.438
Data &H34 ' 120 3.406
Data &H34 ' 121 3.374
Data &H33 ' 122 3.343
Data &H33 ' 123 3.312
Data &H33 ' 124 3.281
Data &H32 ' 125 3.250
Data &H32 ' 126 3.220
Data &H32 ' 127 3.190
Data &H31 ' 128 3.160
Data &H31 ' 129 3.131
Data &H31 ' 130 3.102
Data &H31 ' 131 3.073
Data &H30 ' 132 3.044
Data &H30 ' 133 3.016
Data &H30 ' 134 2.988
Data &H29 ' 135 2.960
Data &H29 ' 136 2.932
Data &H29 ' 137 2.905
Data &H29 ' 138 2.878
Data &H28 ' 139 2.851
Data &H28 ' 140 2.824
Data &H28 ' 141 2.798
Data &H28 ' 142 2.772
Data &H27 ' 143 2.746
Data &H27 ' 144 2.721
Data &H27 ' 145 2.695
Data &H27 ' 146 2.670
Data &H26 ' 147 2.645
Data &H26 ' 148 2.621
Data &H26 ' 149 2.596
Data &H26 ' 150 2.572
Data &H25 ' 151 2.548
Data &H25 ' 152 2.524
Data &H25 ' 153 2.501
Data &H25 ' 154 2.477
Data &H24 ' 155 2.454
Data &H24 ' 156 2.431
Data &H24 ' 157 2.409