<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Michael,<div><br></div><div>I've looked, but can't find the original reference code I used. But, it does seem similar to:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><a href="http://extremeelectronics.co.in/microchip-pic-tutorials/using-analog-to-digital-converter-">http://extremeelectronics.co.in/microchip-pic-tutorials/using-analog-to-digital-converter-</a>–-pic-microcontroller-tutorial/</div></blockquote></div><div><br></div><div>I think that is either my reference, or some variant of it.</div><div><br></div><div>Regards, Mark.</div><div><br></div><div><div><div>On 23 Feb, 2013, at 6:07 PM, Michael Balzer <<a href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Mark,<br><br>I got some 12V alerts during the last 3 days. Checking the 12V reading after the alerts showed normal level, so I'm trying to figure out if they were false alerts.<br><br>Last alert was about 2 hours ago, alerting about 11.0 V -- my check only a few minutes later showed 12.1 V again...<br><br>I've read into the PIC18 doc on the A/D conversion (chapter 19). AFAIS inputs_voltage() differs from the example in two ways:<br><br>1) the example does not turn off the converter after reading the result (but I understand the ADRES register should keep the result)<br><br>2) the example step 3 says "wait for acquisition time if required", it seems our function currently does not wait.<br><br>"To determine acquisition time, see Section 19.1 “A/D<br>Acquisition Requirements”. After this acquisition<br>time has elapsed, the A/D conversion can be started."<br><br>Section 19.1 contains an equation based on hardware parameters I don't know. Can you please have a look and tell if missing that wait time could lead to false measurements?<br><br>Thanks!<br>Michael<br><br>-- <br>Michael Balzer * Paradestr. 8 * D-42107 Wuppertal<br>Fon 0202 / 272 2201 * Handy 0176 / 206 989 26<br><br><span><dexter.vcf></span>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br></blockquote></div><br></div></body></html>