Flow meters are used in fuel dispensers to measure the amount of fuel dispensed. Generally, the flow meter works by rotating its rotor as fuel flows in the pipe after dispensing begins. The flow meter transmits this rotational information to the mainboard, which then calculates the amount of fuel dispensed. Flow meters transmit information in several ways: some use pulse output, where the mainboard calculates the amount dispensed by counting the pulses; others use 4-20 mA analog output, where the mainboard determines the flow rate by measuring the sensor’s output voltage and then calculates the amount dispensed; still others communicate directly with the mainboard using a communication protocol to obtain the amount dispensed.

H-type fuel dispensers use pulse-counting flow meters, which have two signal lines. When there is a flow, the voltage levels on these two signal lines continuously change, outputting pulses. The phase difference between these pulses determines the flow direction. The mainboard monitors the voltage changes on these two signal lines to obtain the pulse count and then calculates the amount of fuel dispensed. To achieve this functionality, a timer can be used in the program to trigger an interrupt every 0.25ms. Within the interrupt, the level changes of two signal lines connected to the I/O ports are detected. These two signal lines are A and B. When the level of line A changes, the levels of lines A and B are compared. If they are different, the pulse count is incremented by one. When the level of line B changes, the levels of lines A and B are compared again. If they are the same, the pulse count is incremented by one. This detection method can accurately determine the number of pulses.

Another newly developed flow meter uses CAN communication to directly transmit data to the motherboard. This flow meter obtains the current angle through a position sensor and then sends the angle value to the motherboard via CAN communication. The motherboard compares the current angle with the previous angle to determine the number of degrees rotated and calculates the oil volume. When designing the motherboard program, compatibility with pulse-counting flow meters is necessary. Furthermore, since the previous program calculated oil volume using pulse counts, changing the calculation method would be cumbersome. Converting the rotation angle to pulse counts is more convenient. The conversion method involves comparing the number of pulses in one full rotation (360 degrees). Divide the rotation angle by 360 and multiply by this number to get the number of pulses.