Hello All,
I am trying to measure resistance quite accuratly, i did some research and found that the POT Command can be used to measure resistance but i can't seem to get the resolution i need. Wheni output the data the difference between 10k(output value of 16), 20k(output value of 17) and an open circuit(output value of 20) is to small.
Does anyone know how to improve my code or have any better ideas?
<code>
INCLUDE "modedefs.bas"
@ DEVICE PIC12f629, XT_OSC
@ DEVICE PIC12f629, WDT_OFF
@ DEVICE PIC12f629, PWRT_ON
@ DEVICE PIC12f629, MCLR_OFF
@ DEVICE PIC12f629, BOD_ON
@ DEVICE PIC12f629, CPD_OFF
Define OSC 4
CMCON = 7
RXPIN Var GPIO.1 'Input PIN
TXPIN VAR GPIO.2 'Output PIN
SCALE CON 255 'Scale Value
B0 VAR BYTE 'Pin Value
rx:
POT RXpin,scale,B0
serout txpin,n2400,["Value= ",#b0,10,13]
Pause 2000
goto rx
end
</code>
Regards,
Jeremy
Bookmarks