View Single Post
Old 03-10-2011, 12:10 PM   #12 (permalink)
EcoModding Apprentice
Join Date: Jan 2010
Location: Newark, DE
Posts: 143

'91 CRX - '91 Honda CRX DX
90 day: 34.91 mpg (US)
Thanks: 0
Thanked 14 Times in 14 Posts
Originally Posted by dcb View Post
I don't know what liberties you are taking with the schematic or the code [...] please and don't be surprised that making random changes to the code or circuit can break things.
I'm starting from scratch on both counts. I've borrowed a few hardware design elements, but the code is all new as far as the MPGuino project is concerned.
Unlike the MPGuino, I'm using one interrupt input for the injector signal with the interrupt being called when the signal changes (rising or falling edge). The interrupt code then checks whether the pin is high (just hit a rising edge) or low (just hit a falling edge) and executes the appropriate chunk of code to start or complete the pulse width measurement (adding the measurement to the total dispensed if completing), and/or calculate the period of the pulse cycle. Those two bits of data let you calculate total fuel dispensed, engine speed and duty cycle of the injectors (instantaneous flow rate).
The second interrupt input is dedicated to the VSS and only triggers on rising edges. It's code is a good bit simpler, calculating the time period since the last rising edge (used for instantaneous speed) and incrementing the VSS pulse count.

My latest code, now calculating trip and instantaneous MPG:

[edit]scratch that. trip MPG is just sitting at zero. :/
probably some stupid programming bug.[/edit]

Last edited by bobski; 03-10-2011 at 01:52 PM..
  Reply With Quote