Guest User

Untitled

a guest
Nov 28th, 2011
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.75 KB | None | 0 0
  1. Opt('ExpandVarStrings',1)
  2. $hdll = DllOpen("K8055D.dll");
  3. DllCall($hdll,"int","OpenDevice","int",0);
  4. $rac = DllCall($hdll,"int","ReadAnalogChannel","int",1)
  5.  
  6. ; the interesting part starts here
  7. $a1_value = $rac[0] ; Value optained from call to ReadAnalogChannel
  8. $a1_max = 255
  9. $Vin = 5.06; 5V from A2 (5.06 says multimeter)
  10. $Vout = $Vin / $a1_max * $a1_value ; = 1.012 (multimeter says 1.028)
  11. $r1 = 3300; 3.3 kOhm - the 'known' resistor, and its correct (says mr multimeter)
  12. $r2 = $r1 / (($Vin/$Vout) -1) ; = 825 but multimeter says 1083
  13.  
  14. ; 1083 Ohm = 21.3 °C, probably correct
  15. ; 1000 Ohm = 0 °C, for reference...
  16. ; 825 Ohm = below 0 °C, and i'm not freezing...
  17.  
  18. ; output stuff...
  19. ConsoleWrite("a1_value = $a1_value$, Vout = $Vout$, r2 = $r2$" & @CRLF)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment