View Single Post
Old 01-07-2009, 04:14 PM   #143 (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,368
Thanked 1,202 Times in 765 Posts
It could be made to work on the fly. The max current in the program is saved in the variable maxCurrent. You could just monitor those other A/D inputs maybe only 100 times a second (like the other slow changing stuff: throttle position and aluminum heat spreader temperature). You would just compute the new value for maxCurrent at that time. If you read 0v from the A/D converter, that would mean the maxCurrent should be set to the minimum value(whatever that should be), and if you read 5v, set it to whatever the largest safe maxCurrent, and something between 0v and 5v means you just set the maxCurrent to the appropriate value between the minimum maxCurrent and the maximum maxCurrent. That would be nice to have it on the dashboard too! It would be sort of worthless having the knob sitting in the engine compartment. hehe

The code for it would take about 5 minutes, and the extra circuitry would be really simple too! Identical to the throttle! But instead of reading it and setting the PWM pulse width, you would do that other stuff above.
__________________
kits and boards
  Reply With Quote