The number of IO pins of the microcontroller is not enough, how to deal with it?
Время публикации: 2020-06-18 11:12:16
SCM, as a key component of general electronic product projects, is often used by engineers to apply logical operations to process data, and even contains some software algorithms. For example, engineers are developing.
- In the household rice cooker project, the single-chip microcomputer can be used as the core device of data calculation, which is responsible for the realization of functions such as heating, timing, display, and keys;
- In the electric shaver project, the single chip microcomputer can be used as the core device of motor control, which is responsible for the realization of functions such as forward rotation of the motor and battery power management;
- In the office shredder project, the single chip microcomputer can be used as the core device of logic analysis, and is responsible for processing the realization of functions such as forward rotation, reverse rotation, blocked rotation, and human body protection;
- In the development of such projects, engineers will determine the internal resources required by the microcontroller based on the functional requirements of the design, that is, determine the type of microcontroller. The internal resources of commonly used single-chip computers include the number of pins, clock frequency, storage space and communication interface, etc. The engineer selects the matching single-chip computer model based on these information.
After determining the MCU model, the engineer can carry out the specific R&D work of the project. The hardware engineer develops the circuit schematic design, and the software engineer develops the code design of the program. During the project development stage, the engineer may encounter type situations:
When the research and development of the project is nearing completion, an additional function needs to be added temporarily; or the project version needs to temporarily adjust an additional function during the update iteration process;
Faced with such situations, these temporary additions and adjustments may cause the problem of insufficient number of IO pins of the previously selected MCU; when the number of IO pins of the MCU is insufficient, how can engineers better solve them?
The engineer may re-select the model of the single-chip microcomputer and directly solve it by simply increasing the number of IO pins; although this solution can be solved, there are mainly 2 problems
1. Re-select the new MCU model, and the associated software code is equivalent to the need to re-develop and design, which increases the development workload of the project and the work efficiency is not good;
2. Re-select the new MCU model, the hardware circuit associated with it is equivalent to the need to re-develop and design, need to re-debug verification, especially the test of some reliability tests;
Since re-selecting a new MCU model has these problems, is there any other solution that can better solve it?
The answer is yes. During the project development process, when the number of IO pins of the microcontroller is not enough, in addition to re-selecting a new microcontroller model solution, there is also a solution to use the IO pin to expand the chip. For example, the AL5524 chip is a single chip. IO pin expansion chip can solve such problems;
So what kind of characteristics does the AL5524 IO pin expansion chip have? How does it solve the number of IO pins of the microcontroller? How does it expand the number of IO pins of the microcontroller?
AL5524 chip pin definition
Pin1 pin: INTB is to realize the interrupt function;
Pin2 & Pin3 & Pin21 pins: The function of ADD is to define the address information of IIC communication through hardware;
Pin4 ~ Pin11 pins: RA is the IO pin of the chip expansion;
Pin13 ~ Pin20 pins: RB is the IO pin of the chip expansion;
Pin22 & Pin23 pins: IIC communication interface function pins;
Pin12 & Pin24: power input pin of the chip;
AL5224 pin definition diagram
Through the definition of pin functions, engineers can basically analyze the working principle of the chip, that is, the number of IO pins of the microcontroller is expanded through the IIC interface, which is easier to see from the internal structure block diagram of the chip.
AL5224 chip internal block diagram
In the internal block diagram of the AL5224 chip, it mainly includes four parts: address generator, IIC controller, registers and controller, and ordinary IO pins Port A and Port B;
AL5224 functional block diagram
(1) The address generator is mainly to define the communication address of IIC through the external hardware circuit of ADD0, ADD1 and ADD2. The common simple design is to directly ground ADD0, ADD1 and ADD2;
(2) IIC controller, mainly the communication bridge between AL5224 chip and single chip microcomputer, used for data exchange to realize IO pin expansion function;
(3) The register and the controller are mainly used to temporarily store the data of IIC communication here, which is convenient for conversion into Port A and Port B pin output;
(4) Common IO pins Port A and Port B, these two pins are the IO pins that the chip needs to expand, which is equivalent to the IO pin function of the single chip;
After analyzing these contents, the engineer may have a clearer understanding of the function of the AL5224 chip; but these contents are still only at the theoretical level, so how to apply them specifically in project development? How to design? How to develop circuits?
AL5224 chip application circuit
After understanding the basic circuit characteristics of the AL5224 chip, the engineer urgently wanted to solve the actual problems in the project, otherwise it would lose its working significance;
AL5224 chip application circuit
The application circuit of the AL5224 chip is easy for engineers to design and develop. Simply connect the SCL and SDA pins to the IIC pin of the microcontroller, so that the microcontroller can easily solve the problem of expanding the number of IO pins; the microcontroller uses 2 The IO pin SCL and SDA expand the number of 16 IO pins, which also realizes the function of expanding the number of IO pins;
After introducing the circuit characteristics of the AL5224 chip, the engineer may find in the comparison that the AL5224 IO pin expansion chip solution is more universal and more operable than re-selecting a new single-chip model. With duality, there must be positive and negative, AL5224 chip circuit solutions also have some shortcomings
a) Increase the BOM accounting cost of the project, mainly due to the increase in the chip cost of AL5224;
b) The AL5224 IO pin expansion chip expands the number of 14 IO pins; obviously in actual project development, it is rarely encountered that the number of 14 IO pins needs to be expanded, even if the AL5224 series chip also supports the expansion of 8 IO pins The number of pins, but it will cause some waste of excess IO pin resources;
Finally, it needs to be pointed out that in the project development, engineers need to evaluate various solutions from multiple angles and angles, and weigh the gains and losses of the solutions before they can make the best solution to the project problem.Тег: microcontroller