Counter using PIC16C54 microcontroller

Single chip microcomputer STM32L151CCU6
1206RGB (single)
0201 package SLP0603 ESD electrostatic diode 5V one-way ESD
Photocoupler

Counters have a wide range of applications in industrial control. Traditional digital counters are composed of small and medium-sized digital integrated circuits. Not only are the circuits complicated, the cost is high, and the function modification is not easy. Counters made with single-chip microcomputers can overcome the limitations of traditional digital circuit counters and have broad application prospects.

The counters described in this article use Microchip's PIC16C54 microcontroller. This type of MCU is a RISC structure. At 4MHz operating frequency, each instruction cycle is 1μs, and the running speed greatly exceeds the MCS-51 series. It is suitable for industrial control fields with high real-time requirements.

Circuit principle

The drawing is a schematic diagram of a counter. The PIC16C54 microcontroller has two I/O ports, the RA port has four I/O lines, and the RB port has eight I/O lines. The RA port in this counter is set as an input port for reading the count value set by the BCD dial switch (BCD1~BCD5); the RB port is set as an output port for scanning and controlling the output relay of the digital tube. T0CKI is the input pin of the internal counter of PIC16C54 MCU. The counting pulse is input from this pin after photoelectric conversion. The internal counter of PIC16C54 counts the input pulse.

Since the internal counter is only 8 bits wide and can only count up to 256, the counter is extended by software to meet the actual counting needs.

The BCD dial switch (BCD1~BCD5) sets the count end value. When the extended internal counter counts equal to the BCD dial switch setting value, RB7 outputs a high level to make the relay pull in and control the external device. At this time, even if there is a count pulse input, the counter will not count again, and a reset signal must be input at the reset terminal to recount.

software design

The main program of this counter completes the reading of the BCD dial switch and the digital tube scan. The digital tube is displayed by dynamic scanning. Each digital tube is illuminated for a certain period of time, and the digital tube is made to be fully bright by using the human visual persistence. Each time the digital tube is lit, a delay program is called. In the delay program, the detection of the T0CKI pin and the operation of the internal counter of the PIC16C54 microcontroller are realized. Since the PIC16C54 has no interrupt function, real-time counting can be achieved in this way.

55 Modular Jack

55 Jack.China 4P4C RJ11 PCB Socket,Side Entry RJ11 Socket manufacturers, welcome RJ11 Jack Connector,2 Ports RJ11 Jack purchasers from worldwide to visit our site.

The RJ-45 interface can be used to connect the RJ-45 connector. It is suitable for the network constructed by twisted pair. This port is the most common port, which is generally provided by Ethernet hub. The number of hubs we usually talk about is the number of RJ-45 ports. The RJ-45 port of the hub can be directly connected to terminal devices such as computers and network printers, and can also be connected with other hub equipment and routers such as switches and hubs.

4P4C RJ11 PCB Socket,Side Entry RJ11 Socket,RJ11 Jack Connector,2 Ports RJ11 Jack

ShenZhen Antenk Electronics Co,Ltd , https://www.antenkwire.com