AVT5333 Panelméter
Re: AVT5333 Panelméter
Ez nem kifogás: "Sajna már én ötven felé nem igen fogom elsajátítani a programozás rejtelmeit"
Csak akarni kel tanulni!
Ha számolsz kicsit én már 69-felé járok!
És találtam 1 programot a hálón, ami kezeli a hőmérődet.
Az még nem jelenti, hogy azt is csinálja, amit te szeretnél!
Ez a szép a programozásban, hogy szépen megtanuljuk megoldani a feladatott!
Csak akarni kel tanulni!
Ha számolsz kicsit én már 69-felé járok!
És találtam 1 programot a hálón, ami kezeli a hőmérődet.
Az még nem jelenti, hogy azt is csinálja, amit te szeretnél!
Ez a szép a programozásban, hogy szépen megtanuljuk megoldani a feladatott!
Re: AVT5333 Panelméter
Akkor nem megoldható a feladat, legalább is az én számomra!
Sajna soha nem foglalkoztam a programozással!!
Köszönöm az eddigi segítségedet is!!!!
Sajna soha nem foglalkoztam a programozással!!
Köszönöm az eddigi segítségedet is!!!!
Re: AVT5333 Panelméter
Ha lesz rá időm? Nézvissza később!
Re: AVT5333 Panelméter
Nagyon szépen köszönöm!! Örök hálám ha meg tudod csinálni!!!!!
Re: AVT5333 Panelméter
Kívánságod szerint:
Config 1wire = Portc.3
Az új kód:
És a hex:
Remélem jó lessz?
Config 1wire = Portc.3
Az új kód:
Kód: Egész kijelölése
''----------------------------------------------------------------------------'' ''
'' ''
'' Multimetr ©2012 Piotr Rosenbaum ''
'' mail: piotr.rosenbaum@gmail.com ''
'' ''
'' ''
''----------------------------------------------------------------------------'' ''
''----------------------------------------------------------------------------''
$regfile = "M8def.dat"
$crystal = 1000000
Config Adc = Single , Prescaler = Auto , Reference = Internal 'konfiguracja wewnętrznego przetwornika ADC
Start Adc 'uruchomienie przetwornika ADC
'--------------------DEKLARACJA ZMIENNYCH--------------------------------------'
Dim Wart_ac As Word
Dim V As Single , I As Single , Vv As Single , Ia As Single
Dim Wart_pr As String * 3 , Wart_nap As Word
Dim Wart_str As String * 3 , W As Single
Dim Wart_wat As String * 3
'------------------------KONFIGURACJA DALLAS DS18B20--------------------------------------'
Declare Sub Init
Declare Sub ConvAllT ' Convert T on ALL sensors
Declare Function Decigrades(BYVAL sc(9) as byte) as integer
Config 1wire = Portc.3 '0,1,2 NOP 3,4,5,6,7 works good ON MY Equipment
'------------------------KONFIGURACJA LCD--------------------------------------'
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
'Temp variables
Dim B As Byte
Dim Wo As Word
'Program variables
'Implicit Err created by compiler
Dim Dg As Integer 'DECIgrades, I call it, cause I have no space for commas on the display....
Dim Min1 As Integer
Dim Min2 As Integer
Dim Max1 As Integer
Dim Max2 As Integer
Dim Dsid1(8) As Byte 'Dallas ID 64 bits incl CRC
Dim DsId2(8) As Byte
'When used like this : DsId(1) = 1wread(8)
'DsId(1) = family code 'Ds1820 10h, DS18B20 28h, Ds18s20 10h
'DsId(2) '48 Bits Serial, LSB
'DsId(3)
'DsId(4)
'DsId(5)
'DsId(6)
'DsId(7) '48 Bits Serial, MSB
'DsId(8) '8 CRC
Dim Sc(9) as byte 'Scratchpad 0-8 72 bits incl CRC, explanations for DS18b20
'Sc(1) 'Temperature LSB
'Sc(2) 'Temperature MSB
'Sc(3) 'TH/user byte 1 also SRAM
'Sc(4) 'TL/user byte 2 also SRAM
'Sc(5) 'config also SRAM x R1 R0 1 1 1 1 1 - the r1 r0 are config for resolution - write FF to byte for 12 bit - others dont care
'Sc(6) 'res
'Sc(7) 'res
'Sc(8) 'res
'Sc(9) '8 CRC
'DALLAS DS18B20 ROM and scratchpad commands''''''''''''''''''''''''''1wwrite....
'&H 33 read rom - single sensor
'&H 55 match rom, followed by 64 bits
'&H CC skip rom
'&H EC alarm search - ongoining alarm >TH <TL
'&H BE read scratchpad
'&H 44 convert T
'------------------------KONFIGURACJA LCD--------------------------------------'
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Cls
Cursor Off
Lcd ; Spc(3) ; "Multimetr"
Lowerline
Lcd ; Spc(3) ; "by Peter507" 'wyświetlanie ekranu początkowego
Wait 2
Cls
' Init DS18B20
lcd "This is a DS18B20 thermometer"
locate 2,1
lcd " by gote@sys-op.com"
wait 1
for b = 1 to 20
shiftlcd left
waitms 500
next
wait 2
cls
Wo = 1wirecount()
' Getting the two sensors IDs.
DsId1(1) = 1wsearchfirst()
' If displayed, everything went well.
' First sensor identified and stored in variable
if dsid1(8) = crc8(DsId1(1), 7) then ' Control that the received CRC match the calculated
locate 1,1
lcd "CRC OK Sensor 1 ID"
wait 1
locate 1,1
for B=1 to 8
lcd Hex(DsId1(b))
next
end if
wait 1
cls
Init
'------------------------POCZĄTEK PĘTLI GŁÓWNEJ--------------------------------'
Do
Wart_ac = Getadc(0) 'pobranie wartości mierzonego napięcia
Wart_nap = Getadc(1) 'pobranie wartości mierzonego napięcia do obliczenia prądu
V = Wart_nap * 0.0025 'unormowaanie zmierzonego napięcia i napięcia do pomiaru prądu
Vv = Wart_ac * 0.025
I = V / 0.1 'dzielenie zmierzonego spadku napięcia na rezystorze (prawo Ohma)
W = I * Vv
Wart_str = Fusing(vv , "#.&&")
Wart_pr = Fusing(i , "#.&&&") 'zaokrląglanie do dwóch miejsc po przecinku wartości wyświetlanych na LCD
Wart_wat = Fusing(w , "#.&&")
Home Upper
Lcd "U" ; Wart_str ; "V" ; Spc(1) ; "I" ; Wart_pr ; "A" ; Spc(1)
Lowerline
Lcd "P" ; Wart_wat ; "W" ; Spc(9) 'wyświetlanie pomierzonych wartości
' Read DS18B20, write LCD
ConvAllT ' "Convert ALL T on the 1w-bus"
Waitms 20 'if you use 2-wire, could be reduced to 200ms
1wverify DsId1(1) 'Issues the "Match ROM "
locate 2,8 ' move curzor X,Y ?????????
if err = 1 then
lcd "Err " 'Err = 1 if something is wrong
elseif err = 0 then 'lcd " Sensor found"
1wwrite &HBE
Sc(1) = 1wread(9) 'read bytes into array
if sc(9) = crc8(sc(1),8) then
DG = DeciGrades(sc(9))
'if min1 > dg then min1 = dg
'if max1 < dg then max1 = dg
lcd dg : lcd "C" ': locate 2,7 : lcd min1 : locate 2,12 : lcd max1
end if
end if
Wait 1
Loop
End
'----------------------------KONIEC PĘTLI GŁÓWNEJ------------------------------'
'Sets variables and LCD for further use'''''''''''''''''''''''''''''''''''''''''
Sub Init
Cls
Lcd " Min Max"
locate 2,1
Lcd " Min Max"
Min1 = 999 ' to get a real value from start
Min2 = 999
end sub
'Makes the Dallas "Convert T" command on the 1w-bus configured in "Config 1wire = Portb. "
'WAIT 200-750 ms after issued, internal conversion time for the sensor''''''''''
'SKIPS ROM - so it makes the conversion on ALL sensors on the bus simultaniously
'When leaving this sub, NO sensor is selected, but ALL sensors has the actual
'temperature in their scratchpad ( within 750 ms )
Sub ConvAllT
1wreset ' reset the bus
1wwrite &HCC ' skip rom
1wwrite &H44 ' Convert T
End sub
'Makes a integer value of the first two bytes in scratchpad'''''''''''''
'Works on DS18 B 20 , observe "B". The R0 and R1 in Sc(5) tells you how many bits are accurate
function Decigrades(Byval Sc(9) as byte)
Decigrades = 0
Decigrades = Makeint(Sc(1) , Sc(2))
Decigrades = Decigrades * 10
Decigrades = Decigrades / 16
end function
' If you have DS1820 or DS18 S 20 , you can use this algo instead:
' Observe that DsId1(1) contains the info value of which sensor is used.
'(
Function Decigrades(byval Sc(9) As Byte)
Dim Tmp As Byte , T As Integer , T1 As Integer
Tmp = Sc(1) And 1 ' 0.1C precision
If Tmp = 1 Then Decr Sc(1)
T = Makeint(sc(1) , Sc(2))
'Print Hex(t)
'Print T
T = T * 50 'here we calculate the 1/10 precision like
T = T - 25 'DS18S20 data sheet
T1 = Sc(8) - Sc(7)
T1 = T1 * 100
T1 = T1 / Sc(8)
T = T + T1
Decigrades = T / 10
'As integer, this routine gives T*10, with 1/10 degree precision
End Function
')
Nincs meg a kellő jogosultságod a hozzászóláshoz csatolt állományok megtekintéséhez.
Re: AVT5333 Panelméter
Bárcsak minden kívánságom így teljesülne!Nagyon köszönöm és nagyon hálás vagyok érte, hogy sikerült megoldanod ügyes vagy nagyon!!!
Még egy kívánságom lehetne? Csak annyi, hogy a tizedes pontot nem lehetne a kijelzőre varázsolni? Meg eltolni a hőfok kijelzését jobbra 1 digittel? Valahogy így ahogy a képen berajzoltam, ha megoldható akkor teljesen fullos lenne és kész!
Nagyon köszönöm ha sikerülne. Most a hőmérő szépen mér tizedes pontossággal, tökéletes!
Nincs meg a kellő jogosultságod a hozzászóláshoz csatolt állományok megtekintéséhez.
Re: AVT5333 Panelméter
Bele raktam: ( lcd "°C") Bár nem tudom, hogy a fok jelet feltudja e dolgozni a bascom ?
Kód: Egész kijelölése
''----------------------------------------------------------------------------'' ''
'' ''
'' Multimetr ©2012 Piotr Rosenbaum ''
'' mail: piotr.rosenbaum@gmail.com ''
'' ''
'' ''
''----------------------------------------------------------------------------'' ''
''----------------------------------------------------------------------------''
$regfile = "M8def.dat"
$crystal = 1000000
Config Adc = Single , Prescaler = Auto , Reference = Internal 'konfiguracja wewnętrznego przetwornika ADC
Start Adc 'uruchomienie przetwornika ADC
'--------------------DEKLARACJA ZMIENNYCH--------------------------------------'
Dim Wart_ac As Word
Dim V As Single , I As Single , Vv As Single , Ia As Single
Dim Wart_pr As String * 3 , Wart_nap As Word
Dim Wart_str As String * 3 , W As Single
Dim Wart_wat As String * 3
'------------------------KONFIGURACJA DALLAS DS18B20--------------------------------------'
Declare Sub Init
Declare Sub ConvAllT ' Convert T on ALL sensors
Declare Function Decigrades(BYVAL sc(9) as byte) as integer
Config 1wire = Portc.3 '0,1,2 NOP 3,4,5,6,7 works good ON MY Equipment
'------------------------KONFIGURACJA LCD--------------------------------------'
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
'Temp variables
Dim B As Byte
Dim Wo As Word
'Program variables
'Implicit Err created by compiler
Dim Dg As Integer, Tg As Integer 'DECIgrades, I call it, cause I have no space for commas on the display....
'(
Dim Min1 As Integer
Dim Min2 As Integer
Dim Max1 As Integer
Dim Max2 As Integer
')
Dim Dsid1(8) As Byte 'Dallas ID 64 bits incl CRC
'Dim DsId2(8) As Byte
'When used like this : DsId(1) = 1wread(8)
'DsId(1) = family code 'Ds1820 10h, DS18B20 28h, Ds18s20 10h
'DsId(2) '48 Bits Serial, LSB
'DsId(3)
'DsId(4)
'DsId(5)
'DsId(6)
'DsId(7) '48 Bits Serial, MSB
'DsId(8) '8 CRC
Dim Sc(9) as byte 'Scratchpad 0-8 72 bits incl CRC, explanations for DS18b20
'Sc(1) 'Temperature LSB
'Sc(2) 'Temperature MSB
'Sc(3) 'TH/user byte 1 also SRAM
'Sc(4) 'TL/user byte 2 also SRAM
'Sc(5) 'config also SRAM x R1 R0 1 1 1 1 1 - the r1 r0 are config for resolution - write FF to byte for 12 bit - others dont care
'Sc(6) 'res
'Sc(7) 'res
'Sc(8) 'res
'Sc(9) '8 CRC
'DALLAS DS18B20 ROM and scratchpad commands''''''''''''''''''''''''''1wwrite....
'&H 33 read rom - single sensor
'&H 55 match rom, followed by 64 bits
'&H CC skip rom
'&H EC alarm search - ongoining alarm >TH <TL
'&H BE read scratchpad
'&H 44 convert T
'------------------------KONFIGURACJA LCD--------------------------------------'
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Cls
Cursor Off
Lcd ; Spc(3) ; "Multimetr"
Lowerline
Lcd ; Spc(3) ; "by Peter507" 'wyświetlanie ekranu początkowego
Wait 2
Cls
' Init DS18B20
lcd "This is a DS18B20 thermometer"
locate 2,1
lcd " by gote@sys-op.com"
wait 1
for b = 1 to 20
shiftlcd left
waitms 500
next
wait 2
cls
Wo = 1wirecount()
' Getting the two sensors IDs.
DsId1(1) = 1wsearchfirst()
' If displayed, everything went well.
' First sensor identified and stored in variable
if dsid1(8) = crc8(DsId1(1), 7) then ' Control that the received CRC match the calculated
locate 1,1
lcd "CRC OK Sensor 1 ID"
wait 1
locate 1,1
for B=1 to 8
lcd Hex(DsId1(b))
next
end if
wait 1
cls
'Init
'------------------------POCZĄTEK PĘTLI GŁÓWNEJ--------------------------------'
Do
Wart_ac = Getadc(0) 'pobranie wartości mierzonego napięcia
Wart_nap = Getadc(1) 'pobranie wartości mierzonego napięcia do obliczenia prądu
V = Wart_nap * 0.0025 'unormowaanie zmierzonego napięcia i napięcia do pomiaru prądu
Vv = Wart_ac * 0.025
I = V / 0.1 'dzielenie zmierzonego spadku napięcia na rezystorze (prawo Ohma)
W = I * Vv
Wart_str = Fusing(vv , "#.&&")
Wart_pr = Fusing(i , "#.&&&") 'zaokrląglanie do dwóch miejsc po przecinku wartości wyświetlanych na LCD
Wart_wat = Fusing(w , "#.&&")
Home Upper
Lcd "U" ; Wart_str ; "V" ; Spc(1) ; "I" ; Wart_pr ; "A" ; Spc(1)
Lowerline
Lcd "P" ; Wart_wat ; "W" ; Spc(9) 'wyświetlanie pomierzonych wartości
' Read DS18B20, write LCD
ConvAllT ' "Convert ALL T on the 1w-bus"
Waitms 20 'if you use 2-wire, could be reduced to 200ms
1wverify DsId1(1) 'Issues the "Match ROM "
locate 2,9 ' move curzor X,Y ?????????
if err = 1 then
lcd "Err " 'Err = 1 if something is wrong
elseif err = 0 then 'lcd " Sensor found"
1wwrite &HBE
Sc(1) = 1wread(9) 'read bytes into array
if sc(9) = crc8(sc(1),8) then
DG = DeciGrades(sc(9))
Tg = Dg MOD 10 ' 1 Tizedes jegy
Dg = Dg / 10 ' Egész érték
'if min1 > dg then min1 = dg
'if max1 < dg then max1 = dg
lcd dg : lcd "." : lcd Tg : lcd "°C"
end if
end if
Wait 1
Loop
End
'----------------------------KONIEC PĘTLI GŁÓWNEJ------------------------------'
'(Sets variables and LCD for further use'''''''''''''''''''''''''''''''''''''''''
Sub Init
Cls
Lcd " Min Max"
locate 2,1
Lcd " Min Max"
Min1 = 999 ' to get a real value from start
Min2 = 999
end sub
')
'Makes the Dallas "Convert T" command on the 1w-bus configured in "Config 1wire = Portb. "
'WAIT 200-750 ms after issued, internal conversion time for the sensor''''''''''
'SKIPS ROM - so it makes the conversion on ALL sensors on the bus simultaniously
'When leaving this sub, NO sensor is selected, but ALL sensors has the actual
'temperature in their scratchpad ( within 750 ms )
Sub ConvAllT
1wreset ' reset the bus
1wwrite &HCC ' skip rom
1wwrite &H44 ' Convert T
End sub
'Makes a integer value of the first two bytes in scratchpad'''''''''''''
'Works on DS18 B 20 , observe "B". The R0 and R1 in Sc(5) tells you how many bits are accurate
function Decigrades(Byval Sc(9) as byte)
Decigrades = 0
Decigrades = Makeint(Sc(1) , Sc(2))
Decigrades = Decigrades * 10
Decigrades = Decigrades / 16
end function
' If you have DS1820 or DS18 S 20 , you can use this algo instead:
' Observe that DsId1(1) contains the info value of which sensor is used.
'(
Function Decigrades(byval Sc(9) As Byte)
Dim Tmp As Byte , T As Integer , T1 As Integer
Tmp = Sc(1) And 1 ' 0.1C precision
If Tmp = 1 Then Decr Sc(1)
T = Makeint(sc(1) , Sc(2))
'Print Hex(t)
'Print T
T = T * 50 'here we calculate the 1/10 precision like
T = T - 25 'DS18S20 data sheet
T1 = Sc(8) - Sc(7)
T1 = T1 * 100
T1 = T1 / Sc(8)
T = T + T1
Decigrades = T / 10
'As integer, this routine gives T*10, with 1/10 degree precision
End Function
')
Nincs meg a kellő jogosultságod a hozzászóláshoz csatolt állományok megtekintéséhez.
Re: AVT5333 Panelméter
Nagyon szépen köszönöm!!
De sajna nem tudom hiba nélkül lefordítani! A 2.0.7.7-es bascomot honnan tudom letölteni??
Azt írtad azzal lefordul gond nélkül, vagy felraknád a hexet?
Köszi!!!
De sajna nem tudom hiba nélkül lefordítani! A 2.0.7.7-es bascomot honnan tudom letölteni??
Azt írtad azzal lefordul gond nélkül, vagy felraknád a hexet?
Köszi!!!
Re: AVT5333 Panelméter
Jaj! Elnéztem!
Nincs meg a kellő jogosultságod a hozzászóláshoz csatolt állományok megtekintéséhez.
Re: AVT5333 Panelméter
Szia!
Tökéletes lett minden oké csak a celsius fokot nem tudja a kijelző megjeleníteni!(14.5-C így írja ki)
Már csupán csak annyi lenne a kérésem, hogy azt a mínusz(-) elő jelet el kellene tüntetni valahogy!
Vagy helyette egy pontot rakni ahogy a celsius kijelzés van!
Köszönöm előre is!!
Tökéletes lett minden oké csak a celsius fokot nem tudja a kijelző megjeleníteni!(14.5-C így írja ki)
Már csupán csak annyi lenne a kérésem, hogy azt a mínusz(-) elő jelet el kellene tüntetni valahogy!
Vagy helyette egy pontot rakni ahogy a celsius kijelzés van!
Köszönöm előre is!!
Nincs meg a kellő jogosultságod a hozzászóláshoz csatolt állományok megtekintéséhez.
Re: AVT5333 Panelméter
A szám után a mínusz jelet sikerült eltüntetnem!!!
( hex-ben szóközt írtam a helyére Pony prog)
( hex-ben szóközt írtam a helyére Pony prog)