Thread Tools
This thread is privately moderated by Jack Crossfire, who may elect to delete unwanted replies.
Jul 24, 2008, 03:15 AM
Registered User
Jack Crossfire's Avatar
Thread OP
Discussion

more PIC progress


Just when U thought the PIC couldn't get any faster, did another round of optimization, got rid of a lot of pointers in the A/D & branches in the rate damping & it's screaming. 24 bit variables are the key.

PICs & Atmels R probably very close in performance. Why would either let themself fall behind if it's just a matter of increasing the clockspeed?

There's a guy selling PICs that generate 24 PWM signals. Wondered how on Earth he did that since our 5 software polled PWMs jitter like crazy & we really need to get on top of the yaw jitter. There aren't 24 timer comparers or hardware PWM generators.

The answer is he probably uses 1 interrupt & 1 timer. He's got a 24 bit mask of pins to lower in the next interrupt & ANDs it with the latches on the next interrupt. Then he calculates when the next pin is going to lower & sets up the next interrupt time.

But multiple pins can come up during the delay between trapping an interrupt & scheduling the next one. Those pins would be missed. Well if this is a realtime fixed clockcyle routine, he can just predict the pins which would come up in the time span of the interrupt handler & mask those too.

But how does he change a PWM duty cycle? If those are updated at 25Hz & interrupts are disabled for every update, there's going to be jitter. He probably double buffers the duty cycle variables. Double buffering doesn't require precise timing, so a polling loop in the same thread as the duty cycle updater waits for all the pins to turn off & swaps the variables then.

Brilliant! Why didn't we think of that?
Sign up now
to remove ads between posts


Quick Reply
Message:
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Build Log Semi Scale Fairey Rotodyne. More pic's including a pic of my micro flaping blade hub gguy Auto Gyros 14 Nov 23, 2006 11:22 AM
More Pic from Thai Vevee Micro Helis 5 Jul 13, 2005 04:32 PM
A few more pic guyg Slope 4 Oct 02, 2004 07:27 PM
more pic papo Motorcycles 2 Jan 27, 2004 03:36 AM