Simple RPM detection?
Is there any simple way to read an RPM signal from a cam angle sensor for a 4 cylinder? I am hoping to be able to hook up the RPM signal wire to the SX chip and be able to use the RPM's to change certain variables in my existing program or call functions at a preset RPM. I have read up on the COUNT and PULSIN commands, but I am lost when it comes to math like this. I have no idea how to measure the frequency of what is coming from the RPM signal wire on the car. I can hook up a meter to the wire and it will show about 1v at idle and about 3v to 4v at 5k rpm +, but if I hook a transistor and a relay to it, it hums when I rev it up instead of latch. I just basically need a function that will read the signal and output the proper RPM into a variable that i can use in other parts of my existing program. Thanks for the help in advance!
Comments
This task might be a little tricky if you're new to programming or computer math. A better solution would be to find an RPM signal wire. Many PCM's use the crank angle sensor and camshaft position sensor as inputs, then calculate the RPM and output an RPM signal to the stock tachometer in the gauge cluster. These signals are much more straightforward and easy to read as they don't have any information about orientation encoded in them. You could very easily use the COUNT command in this case, though the results depend a lot on the specific car and how the PCM outputs the RPM signal.
When you attach a voltmeter to the CAS signal wire, you're only seeing an averaged reading of the pulses since they're being output faster than the meter can react and faster than your eyes could possibly see without an oscilloscope. The same goes for the transistor/relay combination you proposed: the pulses are being output much faster than the switching frequency of the relay (usually around 150Hz or less). In this case the relay armature is simply floating between its two positions since it's being forced to operate on such a high frequency. Remember, in any four stroke engine, the camshaft rotates twice as fast as the crankshaft.
If possible, I recommend finding a technical information manual for your car (usually sold with or similarly to the factory service manual [noparse][[/noparse]FSM], from your dealer). This manual should have all relevant information including RPM signal wires and format.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Paul
RPM_signal VAR RB.4
RPM VAR Byte
COUNT RPM_signal, 30, RPM
IF RPM < 1 THEN
RC = %00110000
ELSEIF RPM = 1 THEN
RC = %01101110
ELSEIF RPM = 2 THEN
RC = %01111010
ELSEIF RPM = 3 THEN
RC = %00110011
ENDIF
I actually need to get it to read to the thousands. I just need a variable to be equal to the exact value + - 100 RPM so I can use it in other areas of my program. The program I have shown above will display a 1 if it is under 1000, 2 if it is under 2000, a 3 if it is under 3000 and so on. I need it to read at least 500 RPM increments. The only problem I have now is that as I rev up the engine, the numbers will bounce back and forth when it reaches a close value for the next digit to be displayed. I have no way of showing what RPM would be equal to while the engine is revving up.
RPM (n) = (Hertz X 120) / Rotor Poles
If I am not mistaken, my car has 4 poles. How would I use the COUNT command to insert the proper hertz for the equation?
What clock speed will the SX be running at ?
10,000 RPM is only 167 pulses per second (times pulses per revolution). Pretty tame numbers.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uhhhm, that was on fire when I got here...
www.iElectronicDesigns.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Paul
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Paul