01-19-2017 08:03 AM
Are you using that array later in the program? I am just thinking your code could be simplified to this:
for(i=0; i<=99; i++) { printf("%f\n", read_adc()*5.0/256.0); }
01-19-2017 08:10 AM
@crossrulz wrote:
Are you using that array later in the program? I am just thinking your code could be simplified to this:
for(i=0; i<=99; i++) { printf("%f\n", read_adc()*5.0/256.0); }
Yeah I use the array to find the amplitude, and frequency. And also to graph the waveform.
01-19-2017 08:18 AM
@JÞB wrote:
That explains a bit.
printf("\r\n%f", (array[i]*(5.0)/(255.0)))
should be
printf("%f\n", (array[i]*(5.0)/(256.0)+(5.0)/(512.0))) //Assuming Vref=5V and 8 bit ADC (yes, you need to a 1/2lsb!) and printf now ENDs with the expected termination character rather than having it in the middle like that.
So I made the changes and did notice a few things. I have 2 read palletes in my code and the first one is for the array of values and the second one is for the amplitude, and frequency. So when the first read is executed, the array still only stores around 46 values. After that the second array with the amplitude and frequency is executed. After that is completed the values in just the second array disappear after a few seconds and when i try to flip the boolean switch to stop the program i get a "timeout experied before operation completed" error.
01-19-2017 08:36 AM
@engineerbeginner wrote:
@crossrulz wrote:
Are you using that array later in the program? I am just thinking your code could be simplified to this:
for(i=0; i<=99; i++) { printf("%f\n", read_adc()*5.0/256.0); }Yeah I use the array to find the amplitude, and frequency. And also to graph the waveform.
Inside of the pic? That analysis should be done in your LabVIEW code.