Jump to content
  • 0

Analog Discovery 2 - offset adjustment issue


dragonLin

Question

When I adjust the parameter(1.0V) analog in offset. the data is no show after adjustment offset.(FDwfAnalogInStatusData)

But it is showing offset at FDwfAnalogInStatusData16 function.

How can I get data from FDwfAnalogInStatusData function with offset shift.

image.png.5a10460ce050c0070eaaf733db714564.png

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi @dragonLin

The oscilloscope offset is used to shift the input range to fit the input signal, like below -2V to fit 0V-4V signal in -0.5V to 4.5V
The ADC receives shifted voltage, visible in the raw 16bit samples. To obtain the real voltage values use the following (from the manual) :
 rgs16Data[i] * FDwfAnalogInChannelRangeGet / 65536+FDwfAnalogInChannelOffsetGet 
This is applied on the float voltage samples function, FDwfAnalogInStatusData
If you want to have a math operation you should do it in your application, like here M1 is C1 + 2V for each sample.

image.png.ddc4f79552462628fe1366e1d954634f.png

Link to comment
Share on other sites

  • 0

I got data with offset from FDwfAnalogInStatusData16 function. But FDwfAnalogInStatusData is no. is it need to set some parameter to get with offset data at FDwfAnalogInStatusData function?

Edited by dragonLin
Link to comment
Share on other sites

  • 0

Hi @dragonLin

Input signal - Offset -> ADC -> 
-> FDwfAnalogInStatusData16 returns raw data, to convert to voltage samples use: foreach sample[i] = data[i] x Range/65536 +Offset
-> FDwfAnalogInStatusData returns converted to voltage samples
The offset parameter is meant to shift the input range but keeping voltage samples equal to the input signal, so the hardware offset is compensated with the above conversion.

If you want to offset the values compared to the input signal then do it in your application, foreach sample[i] = sample[i] + off

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...