電流調整VRと電圧調整VRがある。
VIメータのプログラムと全く同一である。
' AVR VI_meter(BASCOM AVR)
' 2013.04.13 JA2GQP
'
'
' Vref=2.5V
' shunt=0.1 OHM
'
'Update
' 2013.06.09 Average processing voltage and current
' 2013.10.24 Voltage over flow bug FIX
'
'**********************************************************
$regfile = "m88adef.dat"
$crystal = 1000000
Config Lcdpin = Pin , Db4 = Portd.3 , Db5 = Portd.2
Config Lcdpin = Pin , Db6 = Portd.1 , Db7 = Portd.0
Config Lcdpin = Pin , E = Portd.4 , Rs = Portd.5
Config Lcd = 16 * 2
Config Adc = Single , Prescaler = Auto , Reference = Aref
Dim A As Word
Dim B As Dword
Dim V1 As Single
Dim V2 As String * 4
Dim Cnt As Byte
Cursor Off
Cls
Locate 1 , 10
Lcd "JA2GQP"
Start Adc
Do
A = 0
B = 0 'Measurement Voltage
For Cnt = 1 To 100
A = Getadc(5)
B = A + B
Next Cnt
B = B / 100
V1 = B * 0.02685546875 'A*2.5V/1024*11
V2 = Fusing(v1 , "#.##")
V2 = Format(v2 , " 000")
Locate 1 , 2
Lcd V2 ; "V"
A = 0
B = 0 'Mesurement Current
For Cnt = 1 To 100
A = Getadc(4)
B = A + B
Next Cnt
B = B / 100
V1 = B * 0.002219460227 'A*2.5V/1024/11*10
V2 = Fusing(v1 , "#.##")
V2 = Format(v2 , " 000")
Locate 2 , 2
Lcd V2 ; "A"
Wait 1
Loop
End