Hi TJF,
It is not the impedance I think, but it was interesting to go back to the normal io example 1.c. The behaviour is different. Output when using that example (but without leftshift):
0 0 0 0 0 0 0 0
C37 13 9B7 5 199 E34 0 1A4
C3B 13 9B7 5 199 E36 0 1A5
C37 12 9BD 5 197 E36 0 1A4
C37 11 9B8 5 199 E34 0 1A5
C38 13 9B7 5 199 E36 0 1A5
C37 13 9BA 4 197 E35 0 1A5
C37 12 9BA 4 197 E35 0 1A5
C37 12 9B7 4 197 E35 0 1A5
C37 12 9B7 5 197 E35 0 1A5
C37 12 9B7 5 197 E35 0 1A5
C37 12 9B7 5 197 E35 0 1A5
C37 12 9B7 5 197 E35 0 1A5
So that is ok!!!
But now, when adapting the syntax and using ringbuffer mode (and I hope I did the syntax ok):
`
#include “stdio.h”
#include “libpruio/pruio.h” // include header
#include <unistd.h>
int main(int argc, char **argv)
{
int i, n;
pruIo *io = pruio_new(PRUIO_DEF_ACTIVE, 4, 0x98, 0);
pruio_adc_setStep(io, 7, 0, 1, 0, 0); //Step 1, AIN-0
pruio_adc_setStep(io, 8, 1, 1, 0, 0); //Step 2, AIN-1
pruio_adc_setStep(io, 9, 2, 1, 0, 0); //Step 3, AIN-2
pruio_adc_setStep(io, 10, 3, 1, 0, 0); //Step 4, AIN-3
pruio_adc_setStep(io, 11, 4, 1, 0, 0); //Step 5, AIN-4
pruio_adc_setStep(io, 12, 5, 1, 0, 0); //Step 6, AIN-5
pruio_adc_setStep(io, 13, 6, 1, 0, 0); //Step 7, AIN-6
pruio_adc_setStep(io, 14, 7, 1, 0, 0); //Step 8, AIN-7
if (pruio_config(io, 220500, 255<<7 , 45352, 0)){ // upload (default) settings, start IO mode
printf(“config failed (%s)\n”, io->Errr);}
if (pruio_rb_start(io)) printf(“rb_start failed (%s)\n”, io->Errr); // start measurement //Starts in rb_mode
printf(“initialized\n”);
usleep(10000);
/* now current ADC samples are available for AIN-0 to AIN-7 in array io->Adc->Value /
for(n = 1; n <= 13; n++) { // print some lines
for(i = 0; i < 8; i++) // all steps
printf(" %4X", io->Adc->Value[i + (8 * n)]); // output one channel in hex
printf(“\n”); // next line
}
/ we’re done /
pruio_destroy(io); / destroy driver structure */
return 0;
}
`
output:
8EF B7 477 F 10F E3F 47 19F
72F A7 357 F 117 E3F 4F 1A3
60F 97 2DF 13 11B E3F 4F 1A3
557 8F 2B7 17 11F E3F 4F 1A7
4DF 8F 2A7 17 11F E3F 4F 1A7
49F 7F 29F 17 127 E3F 4F 1A7
477 7F 29F 17 127 E3F 4F 1A7
45F 7F 29F 17 127 E4F 53 1A7
44F 7F 29F 17 127 E3F 4F 1A7
447 7F 29F 17 127 E3F 4F 1A7
43F 7F 29F 17 127 E3F 53 1A7
43F 7F 29F 1B 127 E3F 53 1A7
43F 7F 29F 17 127 E3F 53 1A7
There are definitely some interesting differences in the output. Loose from the difference in resolution some of the inputs (Ain-0, Ain-1, Ain-2, Ain-6) cause very different output from the values that come from the minimal code ADC example while Ain-3, Ain-4, Ain-5, Ain-7 are more or less the same except for the resolution thing. (Pull-down activated in the minimal example?). The battery is connected to Ain-5 in both situations using a 10kΩ potmeter on that channel, the other channels are floating so maybe we should not pay too much attention to the absolute differences but we do see that the resolution thing seems connected to rb-mode unless my syntax is false.
Looking for a clue…
Best, Hans.