Preschool - how to read the schematic diagram of GPIO and gate circuit

The hardware circuit diagrams are divided into three categories:

1. GPIO (general peripheral input/output) and gate circuit (pin class and gate circuit class)

1.1 Input, output pins, pull-up resistors, transistors

  Example diagram of output pins:

  As shown in the figure above, if the pin of 2440 outputs 0, the light will be off, otherwise it will be on.

Schematic diagram of input pins:

If the pin at 2 is connected to a pin of the 2440, the pin at 2 is called the input pin, we can read a certain bit of the 2440 register, and after reading a certain bit, we can know The corresponding pin at 2 corresponds to the high level or low level. If it is high, it means that the button at 3 is pressed, otherwise it is released. Generally, the same pin can be configured as input or output (configuration pin function). Output pin: write value to a certain register; input pin: read the value of a certain register.

Schematic example:

If you want LED1 to be on, you need to make nLED1 low level (the light will be on if there is a voltage difference), so you should configure nLED1 as an output pin, the output of this pin is high level, the light is off, and the output is low level ,Light. Therefore, it is necessary to make sure that nLED1 is specifically connected to a pin. Through searching, it is found that nLED1 is connected to the pin of GPF4, as shown in the figure:

Further open the chip manual and find the GPF4 in the io port, as shown in the figure:

  As can be seen from the figure, it is only necessary to set bits 8-9 of GPFCON to 01. If you want to further make the output of nLED1 low, you need to configure the corresponding GPFDAT register, you only need to write the corresponding value to the corresponding register, as shown in the figure:

GPFData register

Pull-up resistor (related to triode):

NPN tertiary tube

If there is no pull-up resistor, if the output of 2440 is low, then 1 is floating, and the voltage at 1 cannot be determined, so a pull-up resistor needs to be added at 1.

If the 2440 output is low, then 3.3 volts at 1 (high);

If the 2440 output is high, the current output by the 2440 flows to ground. The current of the pull-up resistor flows to ground, so the current at 1 is 0 (low level).

Pull-up resistors inside the 2440:

Schematic - GPF Registers

As shown, the GPF register is set to 0 and the pull-up resistor is turned on.

The role of the pull-up resistor, for input pins, can be used to determine the state.

Pull-down resistors, similar to pull-up resistors, are also used to determine the state of a pin, as shown in the figure:

PNP - Pull Down Resistor

1.2 AND gate, OR gate, NOT gate

Schematic diagram of the gate circuit:

NOT gate

AND gate

OR gate

NOR gate

Keymap:

button map

1.3 Interrupts

Interrupt pin: specific input function; can interrupt the CPU

interrupt pin

If CPF is configured as 10, it is used for interrupt. When DM900 needs to notify 2440, just set this pin.

Reprinted from: https://blog.csdn.net/PZ0605/article/details/53208332

Related Posts