Port Configuration of C8051F020

Publisher:SparklingRiverLatest update time:2015-12-21 Source: eefocusKeywords:C8051F020 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
C8051F020 introduces the concept of cross switch, that is, the pins of the microcontroller can only be configured when the cross switch is enabled. Therefore, during initialization, the cross switch must be enabled first. The official configuration tool Config2 is very convenient and recommended for everyone to use. The pin has a weak pull-up inside (the pin is connected to VDD with a resistive connection of about 100KΩ), so the pin can output 0 and 1 if the weak pull-up is not disabled. After the weak pull-up is disabled, the pin output can be configured as push-pull and open-drain. Push-pull and weak pull-up can both output 0 and 1, but the driving capability is large, and the push-pull mode is low resistance. In this way, it can be ensured that the voltage on the port line is not divided or a very small voltage (negligible) is divided, and the output is guaranteed to be the same high level as the power supply. Push-pull is suitable for output but not for input, because if a high level is added to the push-pull (low resistance), I=U/R, I will be very large, which will cause the port to burn out. For many models of C8051F, the method of setting the I/O port to push-pull mode is: PnMDOUT=0xff, Pn=0x00, which sets the I/O port to push-pull and outputs a low level (which can reduce power consumption). If the drain is open, it can only output 0. If you need to output 1, you need to connect an external pull-up resistor. The output mode of the pin is determined by the corresponding bit in the PnMDOUT register. A certain position 1 indicates push-pull, and 0 indicates open drain (default state).

The port pins of port 1 can be used as analog inputs of the ADC1 analog multiplexer by setting the output mode to open drain and writing 1 to the corresponding bit in the port data register. The port pins can be configured as analog inputs by writing 0 to the corresponding bit in the P1MDIN register. By default, the port pins are in digital input mode.

Ports 0-3 are both bit-addressable and byte-addressable, and all port pins of ports 4-7 are only byte-addressable.

Keywords:C8051F020 Reference address:Port Configuration of C8051F020

Previous article:C8051F020 I/O Configuration Summary
Next article:Countdown timer made of 89C52 and DS12887

Recommended ReadingLatest update time:2024-11-16 21:53

Design of digital multi-motor control platform based on control chip C8051F020
    Stepper motors are very suitable for use in open-loop position control systems because of their low rotor inertia, high positioning accuracy, and no cumulative error. DC motors are commonly used in servo control. However, in actual systems, multiple moving parts often exist at the same time to meet different funct
[Microcontroller]
Design of digital multi-motor control platform based on control chip C8051F020
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号