Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/24/07 07:23
Read: times


 
#146121 - Works in unsigned integer, too:
Responding to: ???'s previous message
It's just the way I've done it, note Dti will always be positive in my code and therefore adc_last=adc_last+Dti....charging, whilst adc_last=adc_last-Dti.... discharging.
But you are correct, integers/longs and FP's carry sign, I will modify my code forthwith and save some bytes.


This is exactly one of the points where the form

Adc_out_new = ( 1 - (t_sample / fil_time) ) * Adc_out_old + (t_sample / fil_time) * Adc_in_new 


of the equation has a big advantage over the other form: The above also works with unsigned numbers. (And the '51 is a lot better with unsigned integers than with signed integers). None of the partial results of the above equation will be negative, provided that your Adc_in_new is positive (which depends on the ADC you are using - for this reason, some of them do use numbers with an integer offset, i.e. 0x8000 would be a "zero" mesurement, 0x0000 a "negative saturation" and 0xFFFF a "positive saturation").

Actually, if memory serves me correctly, I was using it with a SAR adc which had a positive common mode voltage, so I was using word(+16bit) data types and biasing half way on a 16 bit word, thus I didn't have an automatic sign.

A DC offset can be subtracted before or after a lowpass filter, provided that you know the DC gain of the filter (should be 1 in most cases). So, you can feed the "unmodified" ADC values into the filter without having to care about the offset at that point.

You have got to admit, that makes more sense, for me at least anyway, thanks for that,

Depends. Back at the university, I had classes in both simulation engineering and signal processing, and the professors made a point of explaining why some things that are good for one of these (4th order ODE solvers are nice for precise simulations ...) will fail miserably when used on the other (... but 4th order ODE solvers require results at fractions of the step size, which you don't have in a signal processing application). Likewise, you won't see a lot of z domain stuff when you're designing simulations, since you're going to do stuff in the simulations (change the "sampling rate" / simulation step size, even dynamically while the simulation is ongoing, for example, or dealing with nonlinear equations) which the z domain analysis is fairly badly suited for.

It's all a matter of choosing the right set of tools for the job at hand.

List of 64 messages in thread
TopicAuthorDate
ADC last digit stability            01/01/70 00:00      
   DVM            01/01/70 00:00      
      DVM's only 10 bits?            01/01/70 00:00      
         Frequency response            01/01/70 00:00      
            Typically twice or more the sampling frequency            01/01/70 00:00      
               Missing the point            01/01/70 00:00      
   You usually don\'t _want_ a stable last digit.            01/01/70 00:00      
      Result            01/01/70 00:00      
         Hm.            01/01/70 00:00      
      Averaging/DSP/FIR filters            01/01/70 00:00      
         Math lecture ?            01/01/70 00:00      
            Can't use average-too slow            01/01/70 00:00      
               Analysis            01/01/70 00:00      
               already stated            01/01/70 00:00      
               Derivation            01/01/70 00:00      
                  The nitty gritty stuff            01/01/70 00:00      
                     Simulate using a spreadsheet            01/01/70 00:00      
                        Hi Russ and thanks for that            01/01/70 00:00      
                           My spreadsheet vs. your spreadsheet            01/01/70 00:00      
                              Unit test !            01/01/70 00:00      
                     As I said...            01/01/70 00:00      
                        Calibration?            01/01/70 00:00      
                           Horsefeathers            01/01/70 00:00      
                              Longs?            01/01/70 00:00      
                                 A long is more "accurate" than a float.            01/01/70 00:00      
                                    Yes it is, but....            01/01/70 00:00      
                                       _Known_ transfer functions.            01/01/70 00:00      
                                          FP pitfalls            01/01/70 00:00      
                                             The compiler isn't going to take care of that.            01/01/70 00:00      
                                                Mantissa fields            01/01/70 00:00      
                                                   Misunderstandings ?            01/01/70 00:00      
                                                      Adding FP's accurately            01/01/70 00:00      
                                 can you not read ?            01/01/70 00:00      
                           Nonsense ...            01/01/70 00:00      
                              Calculator?            01/01/70 00:00      
                     If you're really curious ...            01/01/70 00:00      
                        Climax time            01/01/70 00:00      
                           OOPS!!....            01/01/70 00:00      
                           Equations            01/01/70 00:00      
                              Quantisation            01/01/70 00:00      
                                 Works in unsigned integer, too:            01/01/70 00:00      
                                    Abstract?            01/01/70 00:00      
                                       Useful abstractions.            01/01/70 00:00      
                                          Nice talking with you, Christoph.            01/01/70 00:00      
                           What are the actual requirements ?            01/01/70 00:00      
                              re filters            01/01/70 00:00      
                              And moving forward            01/01/70 00:00      
               You can not due to Dither            01/01/70 00:00      
         Clueless ?            01/01/70 00:00      
            Just dump the LSB            01/01/70 00:00      
               Don't forget proper rounding.            01/01/70 00:00      
            Speaking of DSP            01/01/70 00:00      
         Fluke stability            01/01/70 00:00      
   Oh yes they do!            01/01/70 00:00      
   my take on this            01/01/70 00:00      
      Walk, don't run            01/01/70 00:00      
         :)            01/01/70 00:00      
      Hello Erik            01/01/70 00:00      
         have fun, Jason            01/01/70 00:00      
            I am having fun            01/01/70 00:00      
               Ok, you are aware of this            01/01/70 00:00      
                  He's learning            01/01/70 00:00      
                  Assumptions            01/01/70 00:00      
                     and I ...            01/01/70 00:00      

Back to Subject List