Monday, June 4, 2007

Ideas Emerge

After a little brainstorming, I figure I could use the tach output on the MSD 6AL ignition module to track RPMs. It outputs a 12V square wave with a 20% duty cycle. I should be able to monitor the pulses, perform a little math and compute the RPMs over the polling interval. Sub-second would be preferred.



Should I monitor over a serial port, parallel port or USB? After doing some research, I decided that the easiest method would be to use the ACK pin on a parallel port that has "IRQ enable on ACK" configured.



The basic idea is to have a process that sets the parallel port as mentioned above, with an interrupt handler that increments an integer value in a shared memory segment to a maximum of 200 (12000 rpms). I have a 6000 rpm rev-limiting chip in the MSD 6AL, so I really only need it to count to 100, but what the heck, perhaps somebody with an RX-7/8 would like to use this, too. Meanwhile, another process would poll the shared memory segment every 1/n second, record the value and reset it to 0 to start a new cycle. Thinking ahead, the 2nd process would probably be replaced by a forked thread that does the same thing.



Process 1 is currently a simulated tach, an infinite loop with a 0.1 second nanosleep between calls to the function that increments the value in the shared memory segment. Next step is to move the function call out of the for-loop and call it when the interrupt occurs. To do that, I need to drop the 12V signal to 5V and put it to pin 10 on the parallel port. I'm thinking about using the LM2596 (oddly, I have a few laying around from another project) thusly:








My only concern is the response speed of the circuit. Will it be able to handle a 100-200Hz signal? After getting a nice 5V signal at the output, just have wire it though to pin 10 on the parallel port, and modify the code to handle the IRQ on ACK.



Process 2 is doing its job just fine. Future work is to make it a forked thread rather than its own process.

No comments: