The problem of single chip microcomputer interface level

Publisher:RadiantDuskLatest update time:2018-05-08 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Question: The book says that to measure the pin level of port P1, the corresponding pin needs to be set first. For example, to measure port P1.0:

    ORL P1, #01H ; first set
    MOV C, P1.0 ; then read the interface

Since the data given to the P1 port can generate a level, what is the point of setting it first and then measuring it? Isn't it obvious that it has become a high level? How can we measure it?

Satisfactory answer:

This is determined by the internal structure of the pin.

When the pin of the microcontroller outputs a low level, there is a strong pull-down circuit inside the pin, which can make the pin output a low level stably, and the pin can withstand a sink current of up to 20mA (different models vary);
when the pin of the microcontroller outputs a high level, the pull-up circuit inside the pin has little effect, although it can make the pin output a high level, but if the external circuit pulls the pin's potential down, it will be read back to 0 when reading.
This is the so-called "quasi-bidirectional port".

To use the pin input, you should first output 1 to put the pin in a weak pull-up input state.


Keywords:MCU Reference address:The problem of single chip microcomputer interface level

Previous article:P1 external 4x4 keyboard reverse scanning
Next article:51 MCU C language: irregular matrix keyboard

Latest Microcontroller Articles
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号