Interpretation of values from the DFB as a high pass filter

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SuMa_296631
Level 5
Level 5
50 replies posted 25 replies posted 10 replies posted

I am trying to come to grips with the DFB, in this case configured as a high pass filter (or band pass) such that there should be no DC component in the output samples.

   

I am feeding the DFB with 12-bit unsigned samples from an ADC (via DMA using the alignment features of the DFB). I am using the 'Filter_Read16()' API function to read the result from the holding registers. The output of that function are 'uint16' values.

   

However I would have thought that a filter that removes the DC component form a signal would then only have the AC component remaining. To me this means that the value should be signed as the filter output can be positive or negative.

   

Q1) Is that correct?

   

I see that the documentation states that the return value is "16-bit filter output value represented inb 2's complement".

   

I suppose I could experiment with this myself but I thought it would be better to get a definitive answer form those 'in the know"!

   

Q2) Does that mean I can safely save the return value directly as a signed 16-bit integer (in which case the top 4 bits should always be the same; either all 0's for a positive value or all 1's for a negative value)? 

   

Q2a) If not then what format will the number (and in particular the negative numbers) take?

   

Susan

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

A1) Yes! Two's complement is your usual signed int. See here.

   

A2) Yes.

   

A2a) Hmm....

   

 

   

Bob 😉

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

A1) Yes! Two's complement is your usual signed int. See here.

   

A2) Yes.

   

A2a) Hmm....

   

 

   

Bob 😉

0 Likes
SuMa_296631
Level 5
Level 5
50 replies posted 25 replies posted 10 replies posted

Thanks (yet again) Bob.

   

I'm very familiar with 2's compliment but that was why I was a bit thrown off course by the API using "unsigned int's" and what the implications of this would be.

   

Susan

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Not easy to write a datasheet and staying simple. Providing to know the word "two's complement" makes the elaborate more valuable than using the term "signed int". And providing a signed result as an unsigned function return is ... well, ... nasty

   

I would suggest you to create a support case to point Cypress to this ambiguity.

   

 

   

Bob

0 Likes