2023 Post Sprint Contest Micro:Bit Basic Programming Guide Input Function Group (Special Analysis) 10
(2) Pull-up input mode:
Pull-up input means that the signal is pulled to the high level by an internal pull-up resistor after entering the chip, and its function is to keep the initial state of the pin high after reset, and will not affect the input of high and low voltage signals on the port.
In pull-up input mode, the level signal from the IO port passes through the Schmitt trigger and goes directly into the input data registers. In the case that the IO port is dangling (in the absence of signal input), the level of the input can be kept high;And when the input of the IO port is low, the level of the input is low.
(3) Drop-down input mode:
Pull-down input means that the signal is pulled to the low level by an internal pull-down resistor after entering the chip, and its function is to keep the initial state of the pin low after reset, and will not affect the input of high and low voltage signals on the port.
In the pull-down input mode, the I-O port works in the opposite way of the pull-up mode. The level signal from the IO port passes through the Schmitt trigger and goes directly into the input data registers. In the case that the IO port is dangling (in the absence of signal input), the level at the input can be kept low;And when the input of the IO port is high, the input is high.
(4) Analog input mode:
After the input signal enters the chip, it does not pass through the pull-up and pull-down resistors, nor does it pass through the Schmitt trigger, it transmits the voltage signal through another line to the corresponding peripheral module on the chip, usually the ADC module, and then the ADC collects the voltage signal. The analog input signal is the signal that has not been intervened and processed by any circuit, and is the original voltage signal of the port input.
(5) Push-pull output mode:
In push-pull output mode, the value of the clear register or output data register is set by setting the bit, and the conduction of the P-MOS and N-MOS transistors is controlled to control whether the output level of the IO port is high or low. When the output value is set to 1, the P-MOS tube is on and the N-MOS tube is off, and the level of the I-MOS port is determined by the P-MOS tube to be highWhen the output value is set to 0, the P-MOS transistor is in the off state and the N-MOS transistor is in the ON state, and the level of the I-MOS port is determined by the N-MOS transistor to be low. At the same time, the level of the IO port can also be read by the input circuit;Note that the level of the IO port must be the level of the output at this point.
The push-pull output can output high and low levels, and can be connected to digital devices and devices. The push-pull structure generally means that the two transistors are controlled by two complementary signals respectively, and the other is always cut off when one transistor is turned on, and each is responsible for the positive and negative half-cycle waveform amplification tasks. When the circuit is working, the two symmetrical power switches have only one conduction at a time, so the conduction loss is small and the efficiency is high. The output can either sink current into the load or draw current from the load (source current). The push-pull output increases both the circuit load capacity and the switching speed.
(6) Reuse push-pull mode
The push-pull multiplexed output mode is very similar to the push-pull output mode. It's just that the output is high and low, and it is not decided by letting the CPU write the output data registers directly, but instead using the multiplexing function output of the on-chip peripheral module.
(7) Open-drain output mode:
In open-drain output mode, the conduction of the MOS transistor is controlled by setting the value of the clear register or output data register by setting the bit. It should be noted here that when the output value is set high, the N-MOS transistor is turned off, and the high level cannot be output to the port pin. In this case, the level of the I.O. port is not determined by the high and low levels of the output, but by the high and low levels on the external connection circuit of the I.O. port.
When the output value is set to low, the N-MOS transistor is turned on, and the level of the I-O port is low. At the same time, the level of the IO port can also be read by the input circuit;Note that the level of the IO port is not necessarily the level of the output.
(8) Multiplexed open-drain output mode:
The open-drain multiplexed output mode is very similar to the open-drain output mode. It's just that the output is high and low, and it is not decided by letting the CPU write the output data registers directly, but instead using the multiplexing function output of the on-chip peripheral module.