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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/11/04 13:27
Read: times


 
Msg Score: +2
 +2 Good Answer/Helpful
#82944 - It is supposed to
Responding to: ???'s previous message
From the word "shift square and compare method" for "16bit square root", his method is supposed as follows.

start with
result = 0
shifter = 0x80

loop 1)-3), eight times
1) test = result + shifter
2) compare the square of test (test x test) with the input number
if it is smaller or equal to the input number, replace result with test
3) shift right shifter by one bit

If the fractional numbers is handled as a fixed decimal point number, this method is applicable. Anyway, you can handle the whole calculation as integer operation. Your AD result is 8bit integer number (AD0804).


Do next procedure on every AD conversion.
1) subtract the offset from AD result
2) if the result is negative, convert it to absolute positive number
3) accumulate the square of the result

On each AC cycle
1) shift right the accumulated number by 3 bit (19bit ->16bit).
2) Do "16bit square root" and you get 8 bit result
3) accumulate the result

After 25-30 AC cycle (supposed 0.5 sec refresh rate), multiply the coefficient to the accumulated result and display the result.
Both division to calculate the mean is included in the last coefficient, because the divisors are constant number. Also the coefficient includes a coefficient to convert the result to volt.

Tsuneo

List of 25 messages in thread
TopicAuthorDate
rms value of thyristorised sine wave            01/01/70 00:00      
   thyristorised            01/01/70 00:00      
   rms value of thyristorised sine wave            01/01/70 00:00      
      Calculating RMS            01/01/70 00:00      
   Calculating RMS            01/01/70 00:00      
      Calculating RMS            01/01/70 00:00      
         possible in assembly            01/01/70 00:00      
            re: possible in assembly            01/01/70 00:00      
               Mistake in logic            01/01/70 00:00      
                  Mistake in logic            01/01/70 00:00      
                     ?            01/01/70 00:00      
                        ?????????????            01/01/70 00:00      
                           Fixed Point            01/01/70 00:00      
               Answer is wrong            01/01/70 00:00      
                  Answer is wrong            01/01/70 00:00      
                     Difficult; Laborious - not impossible            01/01/70 00:00      
         Calculating RMS            01/01/70 00:00      
      Russell can you send the file please            01/01/70 00:00      
         Calculating Square Roots            01/01/70 00:00      
         The book was paper!            01/01/70 00:00      
         Russell can you send the file please            01/01/70 00:00      
            It is supposed to            01/01/70 00:00      
               Good Reply            01/01/70 00:00      
                  Thank you            01/01/70 00:00      
   RMS Calculations            01/01/70 00:00      

Back to Subject List