mataston
If you have the pulse already and it is 5VDC, you can use the PBP to read that port (make it an input) and debouce it (hard way). I have been told PBP has interrupts. So the best way, is to use the hall effect device to trigger an interrupt pin on the PIC and your interrupt routine to count the turns, when you hit the mile number, you increment the mile counter and clear the hall effect counter. You will have to find a mile road, run down it and get the count for when you reach a mile for your base number.
Last, you will want to write the number (of miles and if you want to be closer on real miles, save the current hall effect count) in the EEPROM of the pic chip. Then you can kill the power and the numbers (miles and last faction of a mile) will be there next power up. So when you power up you will want to read them back, and keep adding to the counter and the miles counter.
Do you have the schematic for this items. I would be happy to look at it and help.
Also, you only have so many write to the EEPROM, and on the PIC it is fair, not great but a big number (maybe 100,000 writes). You also need to determine when to write the number to the EEPROM. I would say everytime you are not moving (no pulse for so many seconds), and set a variable so you only write it only once until you are moving again.
Bookmarks