Skip to main content
Associate III
January 18, 2024
Question

Subtract offset voltage

  • January 18, 2024
  • 2 replies
  • 3182 views

I have converted an analog signal with offset voltage through ADC to digital. Now I have an array of 1024 integer values. To edit this signal further, I need to convert the integer values to float. Then make this signal offset-free (by q15). I would appreciate it if someone would help me with this.

This topic has been closed for replies.

2 replies

TDK
January 18, 2024

Duplicate:

https://community.st.com/t5/stm32cubeide-mcus/make-digital-signal-offset-free/td-p/628642

 

I'm not quite sure what you're asking here. Surely you can do subtraction between values. What have you done so far?

"If you feel a post has answered your question, please click ""Accept as Solution""."
SaxAuthor
Associate III
January 18, 2024

for (int i = 0; i<= adcBufferSize; i++)

{

adc_buffer_float[i] = (float)adc_buffer [i];

fir_in_arm [i] = (adc_buffer_float[i]-2048)/2048;

 

}

I tried to convert the integer values to float with casting. Then I should use the Q1.15 format to make the signal offset-free.

Unfortunately, the casting does not convert the values to the float and the subsequent steps do not work properly.

My adc_buffer values are between 0 and 4096 and buffersize is 1024.