adc_input_driver differential mode question
max72
Posts: 1,155
I'm playing with the object
http://obex.parallax.com/objects/488/
I'm using the 4 channel ADC and it works in single mode with no problems, but I'm not able to correctly set up the differential mode.
In the code I cannot find a relevant comment.
Any suggestion is appreciated.
Thanks in advance,
Massimo
http://obex.parallax.com/objects/488/
I'm using the 4 channel ADC and it works in single mode with no problems, but I'm not able to correctly set up the differential mode.
In the code I cannot find a relevant comment.
Any suggestion is appreciated.
Thanks in advance,
Massimo
Comments
Have you already tried that, or are you talking about something else?
I haven't tried differential mode in a while, I can't imagine why it would be broken, but I'll be able to try it in an hour or so when I get back from lunch.
I found the switch option, but I had problems getting and understanding data.
I cross checked with another object and re-read the datasheet and I found differential mode uses either channel to indicate the sign.
Moreover I have a funny effect with readings jumping and not evenly scaled in single mode, that is not present with the other object, so I'm probably missing something.
So at the moment I have the setup working with the slower object, but doing funny reading with yours. I had not time to test the protocol, but I'll do it as soon as I'll have time.
In this case the sheer power of the ADC driver is not necessary, but for sure it will prove useful in other projects.
Massimo
Are you running the object with FastMode enabled or not? If it is enabled, disable it, and it will likely fix the problem. The fast mode gathers data from the ADC faster than the datasheet specifies (though I've found most ADCs I have tested can outpace the datasheet specifications by a significant margin). If the ADC is powered at 5V (instead of, say, 3.3V), it increases the leniency of the speed. Non-fast mode is still quite fast, but maintains speeds below the max specifications, much closer to the ADC's specifications at 3V.
I couldn't find my MCP3204 (I'm guessing this is the 4-channel ADC you are trying to use), but I'm about to test my MCP3208, which has the same protocol as the 4-channel variant. So I'll let you know if there's any problems with the information in single or differential mode and/or fast or slow mode.
I also have a slightly improved version of the ADC driver object that I will likely be releasing soon anyway. Maybe you can try it out and see if it fixes your problem.
But in slow mode, both single and differential worked great.
I'm using MCP3204 with 5V supply, and slow mode.
Nonetheless I had a linearity problem. I'm using and add on board with a resistor on the data pin. So bit skip could still be related to my setup.
JonnyMac's driver works, and it is spin only, so bit skip could be related to my setup.
I'll test it with my logic analyzer to see if this is the problem.
Massimo
I tested with the logic analyzer both objects.
I'll report the clock timing:
Your object with slow option: high 41ns, low 0.25us
Spin only: high 7.4us, low 26us.
So it appears the linearity problem is related to my setup, causing bit skipping.
Thanks again,
Massimo