Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Opt('ExpandVarStrings',1)
- $hdll = DllOpen("K8055D.dll");
- DllCall($hdll,"int","OpenDevice","int",0);
- $rac = DllCall($hdll,"int","ReadAnalogChannel","int",1)
- ; the interesting part starts here
- $a1_value = $rac[0] ; Value optained from call to ReadAnalogChannel
- $a1_max = 255
- $Vin = 5.06; 5V from A2 (5.06 says multimeter)
- $Vout = $Vin / $a1_max * $a1_value ; = 1.012 (multimeter says 1.028)
- $r1 = 3300; 3.3 kOhm - the 'known' resistor, and its correct (says mr multimeter)
- $r2 = $r1 / (($Vin/$Vout) -1) ; = 825 but multimeter says 1083
- ; 1083 Ohm = 21.3 °C, probably correct
- ; 1000 Ohm = 0 °C, for reference...
- ; 825 Ohm = below 0 °C, and i'm not freezing...
- ; output stuff...
- ConsoleWrite("a1_value = $a1_value$, Vout = $Vout$, r2 = $r2$" & @CRLF)
Advertisement
Add Comment
Please, Sign In to add comment