Coming from SX to Prop need some advice.
I have been using the SX for a few years now and i have a few commercial products using them right now, my supply is getting low on the SX's and i have already started to port my code from the SX over to the Prop .
My device talks to a automotive dash through serial and that part works fine on the prop now i need it to read 2 analog signals 0-5v range , on the SX i use Analogin but i havent found a similar example on the prop , my analog signals have pullups on there lines and as they move through there range the get closer to ground.
I seen RCtime in the examples but i dont think that will work ( or will it) ?
Does PropBasic have a equivalent to ANALOGIN ?
My device talks to a automotive dash through serial and that part works fine on the prop now i need it to read 2 analog signals 0-5v range , on the SX i use Analogin but i havent found a similar example on the prop , my analog signals have pullups on there lines and as they move through there range the get closer to ground.
I seen RCtime in the examples but i dont think that will work ( or will it) ?
Does PropBasic have a equivalent to ANALOGIN ?
Comments
Have You considered the "MCP3202".? It may be something You could use.
pub readpot(p) '' Reads RC circuit on pin p '' -- takes about 2ms '' -- assumes 10K + 0.01uF ctra := (%01000 << 26) | p ' ctra in pos detect mode frqa := 1 outa[p] := 1 ' charge cap dira[p] := 1 waitcnt((clkfreq >> 10) + cnt) ' ~1ms @100MHz phsa := 0 ' clear counter dira[p] := 0 ' allow discharge waitcnt((clkfreq >> 10) + cnt) ctra := 0 ' disable ctra return (phsa >> 4) <# 500 ' return discharge time
Note that the last line divides the result down and limits it to 500 -- this worked for my program.
I, too, am a fan of the MCP320x family and have used it in several projects.
One last question before i dive in , will the 220ohm series resistor in the RCtime circuit be sufficient to protect the input pin from my 0-5v analog sensor since the prop is a 3.3v chip?
-- http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp8.pdf