Your sprintf result buffer str is quite too small, so you will overwrite some data.
Your WaveDAC8 is running at 500 Hz, the sample rate of ADC at 4x that, 2 Khz.
Should they be in exact sync you would get 4 repetitive samples, yet you are only
reporting 2 ? That seems odd. Just for drill make either component at some non
related rate, see if that affects your output.
Place an additional pin and look at the sine you are digitizing, to make sure its
what you expect. Look at WaveDAC8 out both buffered and un-buffered. Although
as you observed values do not change as you are using the input buffer of ADC.
Note that using ADC buffer limits input common mode range per the graphic in
the properties configurator, eg. 100 mV off the ground rail.
In this line of code -
ADCVolts = ADC_CountsTo_Volts(ADC_GetResult32());
ADCVolts is a float, but the return from the function is int32, maybe you should cast it
ADCVolts = (float) ADC_CountsTo_Volts(ADC_GetResult32());
Hi Bob and Dana,
Just increase the size of str, made it 20, i see improvement, also changed the ADC resolution to 17 bits, Input Range to Vssa to 2.048V, Buffer Mode to Bypass Buffer. I had test this configuration with 5 000 sps and 10 000 sps, it seems better, i take the data printed on the terminal and make a graph with it, it looks like a sine wave now!!
return value of ADC_CountsTo_Volts() is float32, just check it on the component datasheet. Just ADC_CountsTo_mVolts() and ADC_CountsTo_uVolts() returns integers.
Attached the project, maybe you can see any improvement.
waveTest.cywrk_.Archive01.zip 554.7 K
Thanks Carlos for pointing out my error, must have done post with my
Bypass buffer mode yields true R-R input performance.