Skylar
- 23rd May 2009, 12:10
Hi,
I'm using pulsin to measure the high time of a squarewave created by the engine control unit to drive the tachometer. I'm using a 16F877a with a 20MHz osc.
At 1000 rpm or 16.667Hz, my LCD screen shows 950-1050 (hightime is around 1500counts). All is well, I thought.
So I rev the engine to 2000rpm, my screen only shows 1333, and 1500 at 3000rpm. hightime is around 1079 at 3000rpm, it should be 750.
Checking the same wire with the frequency function on my multimeter, it reads 32-33Hz at 1000rpm and 66Hz at 2000rpm. This wire should have a squarewave at the engine speed. So my multimeter is reading twice this rate but it at least proves that the output is linear.
I think the problem is with pulsin. I was previously using count to measure the number of rising edges in 500ms and multiplying this by 60. This worked but it was slow to update and the resolution wasn't as good as I wanted it.
Any thoughts on why the PIC isn't interpreting the wave properly?
I'm using pulsin to measure the high time of a squarewave created by the engine control unit to drive the tachometer. I'm using a 16F877a with a 20MHz osc.
At 1000 rpm or 16.667Hz, my LCD screen shows 950-1050 (hightime is around 1500counts). All is well, I thought.
So I rev the engine to 2000rpm, my screen only shows 1333, and 1500 at 3000rpm. hightime is around 1079 at 3000rpm, it should be 750.
Checking the same wire with the frequency function on my multimeter, it reads 32-33Hz at 1000rpm and 66Hz at 2000rpm. This wire should have a squarewave at the engine speed. So my multimeter is reading twice this rate but it at least proves that the output is linear.
I think the problem is with pulsin. I was previously using count to measure the number of rising edges in 500ms and multiplying this by 60. This worked but it was slow to update and the resolution wasn't as good as I wanted it.
Any thoughts on why the PIC isn't interpreting the wave properly?