Current location - Quotes Website - Collection of slogans - What are the functions of P0, P 1, P2 and P3 ports of single chip microcomputer?
What are the functions of P0, P 1, P2 and P3 ports of single chip microcomputer?
1 and P0 ports: true bidirectional ports with output latch and input buffer. Before input, set 1 (the header file contained in keil has been activated, and if assembly is used, set1manually). The output is open at the drain, and the output is generally pulled up. The input is high impedance state, which can drive 8 TTL loads. When there is an off-chip memory, it is used as a data line.

2.P 1 port: the simplest port, the input should be set to 1 first, and there is no high impedance state, so it can only be output or input. Can drive 4 TTL loads.

3.P2 port: I/O (input/output) is the same as P 1 port. When there is an off-chip memory, it is used as an address line to address the 64K off-chip data memory. Can drive 4 TTL loads.

4.P3 port: I/O (input/output) is the same as P 1 port, but both input and output must be set to 1. It has a variety of multiplexing functions.

Extended data

1. If P 1 is used as the input port, that is, q = 0,/q =1; The field effect transistor is turned on, and the pin is directly connected to the ground GND of the power supply. Even if the pin input is high, it is directly pulled down to "0".

So just like the P0 port, before the data is input to the P 1 port, it is necessary to write "1" to the latch through the internal bus, so that /Q=0, the field effect transistor is turned off, and the "1" input from the P 1 port can be sent to the input read of the tri-state buffer, and then another one can be sent to the tri-state buffer.

2. The input/output ports with this operating characteristic are generally called quasi-bidirectional I/O ports, and the P 1, P2 and P3 ports of 5 1 single chip microcomputer are all quasi-bidirectional ports. The P0 port has a tri-state function (the tri-state of the output port refers to high level, low level and high impedance state), so when it is used as an input port, there is no need to write "1" before reading.

References:

Working Principle of P 1, P2 and P3 Ports of EEPW-5 1 Single Chip Microcomputer