Are you using the 'Get Voltage' or 'Get Average Voltage'? My guess is that you are using 'Get Average Voltage' with a low sample rate and a high number for the oversample value (like 10). I say this because when you use the the oversample at a value of N, it adds the previous 2^N values together (and does NOT divide by 2^N either!) So that explains the high values. You should be getting outputs in volts. Plus, since you're averaging together a whole bunch of values, there is going to be a big delay while the average value catches up to the new input value. If you have a low sample rate (as determined by the set sample rate vi, not how frequently your loop is running), 2^10 averages could concievably be 20s. I'm pretty sure that the sample rate vi sets the rate for the whole module, so the same rate per channel is 1/8 of that.
Now, if this doesn't help you out, then try this: make a copy of your code and delete everything but the bit about reading the analog value and displaying (i.e. delete all the camera stuff and all the drive stuff and everything). If that fixes it, then add stuff back into until you find the culprit. If not, then post that code here and maybe somebody can spot your error.
/* Daniel */
Quote:
Originally Posted by LinuxMercedes
I've been messing with the analog inputs on both the driver's station and the cRio itself and have noticed a few weird things.
First, it seems to provide values between 0 and 1000. I'm assuming that this is multiplying the actual voltage by 200 since it would be kinda creepy if it was putting 1000 volts through those inputs...
Second, they seem to be mildly inaccurate. A full-open pot reads values between roughly 990 and 1100. This might be just the pot that I was using.
Third, and most importantly, there is a HUGE lag between changing the pot and getting the reading back at the debug console. It's roughly 20 seconds. We've determined that it's not a printf() buffer that's filling up faster than we can read it. Does anyone know why we'd have a delay like that, and how could we fix it?
Thanks!
|