View Single Post
Old 05-25-2009, 06:25 PM   #1407 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,362
Thanked 1,202 Times in 765 Posts
Eric, you are funny! I tried out a completely new ISR with a separate timer that runs at 2 kHz. It went really really bad. hehe. I sampled the current in that ISR, still did the rolling average and even tried to do a rolling average for the throttle, just because I was messing around, and I wanted to see what would happen. Each second, it would be a pulse that was almost as if the motor was being shut down. It would drive normal for almost a second, and then that pulse again! Weird!

Good point about the usart stuff. That DEFINITELY doesn't belong in any ISR.

I think I need to sample the current during each pwm period, which is kind of bad because it eats up so much of the system resources. That's 2/3 of all computing time gone! But I guess it's worth it. Throttle is only needed at maybe 1kHz frequency or perhaps 500Hz. Maybe inside that ISR, I could take turns with current and throttle? Maybe skip a current sample every 16 times, to allow time for throttle? And then every 32000 times or so, skip both current and throttle to take temperature? Then, there should be 1/3 of the processing time avalailable for "other things..." Duh Duh Duhhhhhhh!

If I do throttle and temp outside, maybe that would be fine! Maybe just set a flag inside the ISR that says "timeToReadThrottle", and then I get to it when I get to it? I would have to disable the interrupts when I got to the throttle conversion moment so nothing weird would happen, but that's OK! I might try that! heck ya dude! You can't teach that, it's instinct! hahaha!

YO, STEINER! I think that would be really really helpful! I'll write out the directions for the etching and drill hole coordinates and drill hole diameters and etching width and who knows what!?
__________________
kits and boards
  Reply With Quote