piclist 2001\06\12\120053a >
Thread: Phase angle algorithm needed
www.piclist.com/techref/microchip/devices.htm?key=pic
flavicon
face BY : Kevin Blain email (remove spam text)



XOR 'em together Bob, then

the 1's represent when the two signals are different, and the 0's when they
are the same

Count the time that it's a 1
Count the time that it's a 0

the sum of the two times is the period......therefore gives frequency
the ratio of the two times gives phase angle 0 through 180 degrees

To get 180 to 360 degrees, you'll need to start counting it when say, A goes
up, and if B is already a 1, then B is leading A, so this is a minus lag if
you prefer. I would personally prefer to use a range -180 to +180, but
whatever!

A hardware XOR would allow you to use the CCP peripheral to do some timing,
or do the XOR in s/w. At 120Hz, a degree is about 23 microseconds, so
there's a reasonable amount of time to play with.


does this help?

Regards, Kevin

{Original Message removed}
<00ae01c0f357$0aa2a730$b802a8c0@bob> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Phase angle algorithm needed

month overview.

new search...