MCU pin input and output problems and pin attributes

Updated on technology 2024-03-30
5 answers
  1. Anonymous users2024-02-07

    MCU, all IO ports can be used as input and output, but not at the same time

    As input, write 1 to its port first

    Then read it again.

    If p0=0xf0 is set in the program, and then p0 7 is grounded externally, that is, set to zero, if you read p0 at this time, you will get p0=0x70

    That is, the highest digit is indeed 0

    However, if there is no pull-up resistor inside the P0 port, if the external IO port is connected to the power supply without resistor, although you set 1, the external result you read is not necessarily 1

    That is, p0 is not necessarily equal to 0x70

    P1-P3 has an internal pull-up resistor, so if you set P1=0xf0 and then read P1 to get P1=0xf0

    If p1 7 is grounded externally, then p1 = 0x70 is obtained

    Therefore, most of the enhanced 51 microcontroller IO ports have push-pull tubes, pull-up and pull-down resistors, and IO port configuration registers, which can be configured to float as needed.

    Push and pull. Weak pull-up and other states.

  2. Anonymous users2024-02-06

    Different microcontrollers have different properties for different pins.

    The basic 51 series has been taken as an example:

    The output current of the pin is less than the input current, the output is less than mA, and the input is less than a dozen mA.

    When the P0 port is used as the IO port, the pull-up resistor should be connected because the P0 port does not have a pull-up resistor.

  3. Anonymous users2024-02-05

    The pins of different series and models of single-chip microcomputers are not the same, and there are several common models of 51 series single-chip microcomputers below, which can be referred to:

  4. Anonymous users2024-02-04

    For AT89C51 microcontroller 40 pins.

    Found on the Internet, vcc gnd: power supply.

    P0 port: can be defined as the lower octet of the data address, which can be used for external program data storage. When FIASH is programmed, the P0 port is used as the input port of the original code, and when FIASH performs the verification, P0 outputs the original code, and the outside of P0 must be pulled up.

    P1 port: standard input and output IO, P1 pin is written to 1, and is internally pulled up to high, which can be used as input. During flash programming and verification, the P1 port is received as the eighth bit address.

    P2 port: It can be used for both standard input and output IO and high-octet addresses for external program memory or data memory access. The P2 port receives the high-octa-bit address signal and control signal during flash programming and verification.

    P3 port: It can be used as a standard input and output Io, and can also be used as some special function ports of AT89C51, and pin alternative functions.

    RXD (Serial Input).

    txd (serial output port).

    int0 (external interrupt 0).

    int1 (external interrupt 1).

    t0 (timer 0 external input).

    t1 (timer 1 external input).

    WR (External Data Memory Write Gating).

    RD (External Data Storage Read Gating).

    RST: Reset input. When the oscillator resets the device, keep the RST pin high for two machine cycles.

    ale prog: The output level allowed by address latching is used to latch the status bytes of the address when accessing external memory.

    During flash programming, this pin is used to input programming pulses. In normal times, the ALE side outputs at a constant frequency cycle.

    A positive pulse signal, which is 1 6 of the oscillator frequency.

    PSEN: The signal number of the external program memory. During fingering by external program memory, two PSEN cycles per machine are valid.

    However, when accessing the external data memory, these two valid PSEN signals will not appear.

    EA VPP: When the EA is kept low, the external program memory (0000H-FFFFH) is in place during this period, regardless of whether there is an internal program or not.

    Memorizer. Note that when encryption method 1, the EA locks the inside to reset; When the EA terminal is kept high, the internal range is here.

    Sequence memory. This pin is also used to apply a 12V programming power supply (VPP) during Flash programming.

    XTAL1: Input of the reverse oscillation amplifier and input of the internal clock operating circuit.

    xtal2: output from the inverted oscillator.

  5. Anonymous users2024-02-03

    It's good to see for yourself !! So don't ask questions!

Related questions
10 answers2024-03-30

Ignoring the influence of temperature and other factors, the method of measuring voltage by series resistance can be directly adopted. >>>More

4 answers2024-03-30

You use a P1 port to control the dynamic scanning of 8 digital tubes, and the dynamic scanning display of digital tubes needs to be blanked. >>>More

4 answers2024-03-30

Learning single-chip microcomputer is very promising and promising. >>>More

8 answers2024-03-30

void key0()

if(p1_0!=1) *If the key 0 is pressed. >>>More

10 answers2024-03-30

Step 1: ANL is Logic and Operation.

That is to say, the first step is to perform and calculate the content in A and 47h in 34h. a=10000011 34h=00110100 >>>More