Tachometer module description
The hardware consists of a Microchip PIC16F628 microcontroller and an LM393 comparator to set the threshold level to suit
different types of tachometer sensing device. (Optical, Hall effect etc.)
The software design is based round a 32 bit counter which is incremented every 0.4uS. The lower 16 bits are formed by TIMER1 and
the top 16 bits are two bytes that are incremented every time TIMER1 overflows. The input from the tacho sensor
triggers the capture of the count in TIMER1 (To the capture register.) The top 16 bits are captured with software.The
difference between the captured 32 bit value at the start of the timing and the current 32 bit value is calculated.
The tacho pulse counter is also incremented. This continues until the first time the calculated difference represents
more than 500 mS. At this point this difference is divided by the number of tacho pulses since the start of the timing
period. (Giving the average time between tacho pulses.) This time is now converted to RPM. A check is also made to see if more
than 3 seconds have elapsed since the last pulse. This is to prevent the last reading being displayed after the tacho
pulses stop. If the time is greater than 3 seconds then the display is forced to zero. (This means that zero is
displayed when there are less than 20 pulses per minute. The result of the calculation (Pulses per minute) is sent to
the tablet interface via the serial ports as a 24 bit binary word in the form of three bytes. (Least significant byte first.)
The software in the interface module uses an interrupt routine for the USART received data to minimise disturbing the
data reception from the scales. To ensure the three bytes are all from the same group of three a test is done to check
that the three bytes are received within 6 mS ( At 19200 bauds three bytes should be received within about 3 mS.) A
further test is done that there is no more than about 6 seconds between reading. (The maximum time would be 3 seconds
for 20 pulses per minute input.) This sets the displayed value to zero to avoid the last valid reading from being
displayed after a loss of tacho data.
It should be possible to use this method in the Aduino and MSP430 interfaces.
different types of tachometer sensing device. (Optical, Hall effect etc.)
The software design is based round a 32 bit counter which is incremented every 0.4uS. The lower 16 bits are formed by TIMER1 and
the top 16 bits are two bytes that are incremented every time TIMER1 overflows. The input from the tacho sensor
triggers the capture of the count in TIMER1 (To the capture register.) The top 16 bits are captured with software.The
difference between the captured 32 bit value at the start of the timing and the current 32 bit value is calculated.
The tacho pulse counter is also incremented. This continues until the first time the calculated difference represents
more than 500 mS. At this point this difference is divided by the number of tacho pulses since the start of the timing
period. (Giving the average time between tacho pulses.) This time is now converted to RPM. A check is also made to see if more
than 3 seconds have elapsed since the last pulse. This is to prevent the last reading being displayed after the tacho
pulses stop. If the time is greater than 3 seconds then the display is forced to zero. (This means that zero is
displayed when there are less than 20 pulses per minute. The result of the calculation (Pulses per minute) is sent to
the tablet interface via the serial ports as a 24 bit binary word in the form of three bytes. (Least significant byte first.)
The software in the interface module uses an interrupt routine for the USART received data to minimise disturbing the
data reception from the scales. To ensure the three bytes are all from the same group of three a test is done to check
that the three bytes are received within 6 mS ( At 19200 bauds three bytes should be received within about 3 mS.) A
further test is done that there is no more than about 6 seconds between reading. (The maximum time would be 3 seconds
for 20 pulses per minute input.) This sets the displayed value to zero to avoid the last valid reading from being
displayed after a loss of tacho data.
It should be possible to use this method in the Aduino and MSP430 interfaces.