7 years, 8 months ago.

FDRM-KL25Z AnalogIn gives 0.0 to 0.166 (due to dumb mistake, plese delete this question! Jim

normal wiring AnalogIn ain0(PTC1); 1-2M throt curx AnalogIn ain1(PTC2); 1-4M throt cury AnalogIn ain2(PTB3); 1-6M throt bk_out AnalogIn ain3(PTB2); 1-8M AnalogIn ain4(PTB1); 1-10M AnalogIn ain5(PTB0); 1-12M

AnalogIn *aio[6] =

{ &ain0, &ain1, &ain2, &ain3, &ain4, &ain5 };

main() {

float ainf[6]; int g_samples=0;

stime(_sample_time); this stores current Usec clock for (xx = 0; xx < 6; xx++) ainf[xx]= 0.0; clear float array while(etime(_sample_time) < 15000 etime(_sample_time) returns time since stime() in Usec { for (xx = 0; xx < 6; xx++) { read channels 0-5 ainf[xx] += (aio[xx]->read()) ; 0-1.0 g_samples++; this was my stupid mistake } g_samples++; when put here it all works correctly, please delete this dumb question Jim Spruell }

pc.printf("#samp=%d 0=%f 1=%f 2=%f 3=%f 4=%f 5=%f (%s) \r\n", g_samples,ainf[0]/g_samples,ainf[1]/g_samples,ainf[2]/g_samples, ainf[3]/g_samples,ainf[4]/g_samples,ainf[5]/g_samples, st_run_time()); string of runtime in Usec }

prints 0.0 thru 0.1667 for 0-3.3 volts not 0.0 to 1.0 ?????????????

Please use <<code>> and <</code>> to make it readable. Also how are you interfacing your signal? I don't really understand your comments.

posted by Erik - 31 Jul 2016
Be the first to answer this question.