Hi Rathin!
Hi TJF,
I had a small gap so I tried your new code, and Its giving me “config fault: sample rate too big”.
I tried changing tSamp, to 2000 but still it doesn’t work So what changes should I make?
tSamp is the number of samples in the file. The final file size will be tSamp * NoStep * 2.
Your error message is about the sampling rate, it reaches a certain limit.
There’s a miss-configuration in version-0.2 in file pruio_adc.bas. The limits for the sampling rate get computed to rigid. You can either use much slower sampling rates, as a workaround for now to get started) like
`
const uint32 tmr = 50000; //!< The sampling rate in ns (50000 → 20 kHz).
`
or fix the code and recompile. Therefor install the FreeBASIC compiler and adapt file pruio_adc.bas in function AdcUdt.configure() around line 133 it should be
`
IF Samp < 2 THEN ’ IO mode
Samples = 1
TimerVal = 0
ELSE
IF r < 1 THEN .Errr = @“no step active” : RETURN .Errr
Samples = Samp * ChAz
IF (Samples SHL 1) > .ESize THEN _
.Errr = @“out of memory” : RETURN .Errr
d = (d * (Conf->ADC_CLKDIV + 1) * 1000) \ 24
IF Tmr <= d ORELSE Tmr < 5000 THEN _
.Errr = @“sample rate too big” : RETURN .Errr
Value = .ERam
TimerVal = Tmr
END IF
`
Then compile and install the new version.
``
and one another query how to extend the same code of 8 ADCs? just to change NoStep??
As mentioned in the code:
const uint32 NoStep = 3; //!< The number of active steps (must match setStep calls and mask).
You have also to adapt the mask variable and the calls to pruio_adc_setSteps()
`
const uint32 NoStep = 8; //!< The number of active steps (must match setStep calls and mask).
…
if (pruio_adc_setStep(io, 9, 0, 0, 0, 0)){ // step 9, AIN-0
printf(“step 9 configuration failed: (%s)\n”, io->Errr); break;}
if (pruio_adc_setStep(io,10, 1, 0, 0, 0)){ // step 10, AIN-1
printf(“step 10 configuration failed: (%s)\n”, io->Errr); break;}
if (pruio_adc_setStep(io,11, 2, 0, 0, 0)){ // step 11, AIN-2
printf(“step 11 configuration failed: (%s)\n”, io->Errr); break;}
if (pruio_adc_setStep(io,12, 3, 0, 0, 0)){ // step 12, AIN-3
printf(“step 12 configuration failed: (%s)\n”, io->Errr); break;}
if (pruio_adc_setStep(io,13, 4, 0, 0, 0)){ // step 13, AIN-4
printf(“step 13 configuration failed: (%s)\n”, io->Errr); break;}
if (pruio_adc_setStep(io,14, 5, 0, 0, 0)){ // step 14, AIN-5
printf(“step 14 configuration failed: (%s)\n”, io->Errr); break;}
if (pruio_adc_setStep(io,15, 6, 0, 0, 0)){ // step 15, AIN-6
printf(“step 15 configuration failed: (%s)\n”, io->Errr); break;}
if (pruio_adc_setStep(io,16, 7, 0, 0, 0)){ // step 16, AIN-7
printf(“step 16 configuration failed: (%s)\n”, io->Errr); break;}
uint32 mask = 255 << 9; //!< The active steps (9 to 16).
…
`
BR