回路図を示す。電圧と電流の取込み位置を含めてた全体のイメージを書いてある。
プリントパターン 38×81
BASOM AVR Program
'**********************************************************
' 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
加算平均処理でオーバーフローする事があり、不具合修正した。
返信削除修正した箇所は、変数 AとBの部分。
mersi de trimetere si pe mine ma pasioneaza constructiile electronice desi am 71 de ani incerc sa fiu la curent
返信削除salut puteti sami trimeteti fisierul hex sa fac si eu montajul respectiv imi place cum e facut cablajul foarte simplu cu salutari 73 88 yo3bzw op radu
返信削除