The project as it stands...
I built an OBD reader, calculates everything I want, fuel usage, fuel mileage, etc. In addition to the LCDs, I've added a 'standard' 8 cylinder tachometer (one of the big 5 inch ones) to display MPG instead of RPM by feeding it 12v pulses.
Since the main body of my OBD reader is based an 18F4685 and it's too busy talking to the OBD port and doing calculations, etc., I set up the firmware to output a 0-80ms pulse once in awhile which represents fuel mileage (0-80MPG, as displayed on the tach, 0-8000rpm). I'm doing this the easy way with an 80ms PULSOUT to a 2nd PIC12F683.
I run the PIC12F683 off the internal clock set to 125khz (don't really need accuracy). The firmware in the '683 does a PULSIN on the signal coming in (with a resolution of 320us), does a bit of math and scales that number to convert it to a value to be fed into the PR2 register.
I use the '683s PWM module prescaled by 16 to generate a 50% duty output at between 7.x - 1953Hz and I feed this signal into a 74LS74 set up like a divide-by-4, which gives me an 'RPM' output of between 26-7373 ( <1hz - ~488hz) rpm as displayed on the tach, almost, but not quite full scale, and it gives me the resolution/accuracy I need for a quick look. If I want accuracy, I'll look at the LCD output.
There has to be a better way to trick one or more of the timers/ccp modules on the '4685 into generating a 50% (doesn't have to be 50%, but it seems to be optimal) square between 1-533.3Hz (I'll get my 0hz by just turning it off).
(Side note...I was using a pair of Xicor digital pots controlled by the '4685 connected to a 555 to generate my variable freq signal, but the lookup tables to linearize the output turned out to be too big of a hassle and I never could get it to read the same from day to day anyways, crappy cap's, old 555, I don't know. Anybody following this?)
Bookmarks