Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to read data from MCS-51's pin port?

Status
Not open for further replies.

Jasper Chow

Junior Member level 3
Joined
Nov 14, 2013
Messages
26
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Activity points
218
I want to read data from MCS51 's pin instead of the output latch, but I find no relavent instructions to accompish this task. MOV, ORL only handle the data stored in the output latch, but not the pin. I want to create a program to detect the pin's level, what should I do? I Just couldn't understand why there is no input latch and why many programs use if(P0^0==0) to test the level of the p0^0 pin. For me, what the if sentence tests is the value of the latch, which is pointless.
 

MOV, ORL only handle the data stored in the output latch, but not the pin.
True for ORL, wrong for MOV. Read the 8051 manual thoroughly!
 
True for ORL, wrong for MOV. Read the 8051 manual thoroughly!

Could you tell me how to read in the logic level from the pin with mov, and better with keil C. I couldn't figure it out..
 

According to MCS51 documentation, a basic MOV from port (or a respective C assignment) always reads the pin level rather than the latch state.
 
i AM NOT SO COMFORTABLE WITH assembly language though, try ANDING port pin with binary 1, if result is 1, condition is satisfied,else condition is false.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top