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.

8051 port configuration

Status
Not open for further replies.

dinesh401

Advanced Member level 4
Joined
Aug 21, 2010
Messages
104
Helped
3
Reputation
4
Reaction score
2
Trophy points
1,298
Location
BANGALORE
Activity points
2,077
can anyone tel me. how a 8051 microcontroller pin will be worked. my doubt is that in the programing we hav to initialize the port as input or output. like

po=0x00;//initialize as output

but where as coming to 8051 programming, in the program we are writing the code on the same port po=0xi;, i is a variable changing its value always. even then also how the port is acting like a output port. when we send the i value as po=0x11; in the program. why it is not acting as a input port. can anyone tel me how a port will works. i didnt understand from the text.
 

for 8051s , you can write to the port registers (P0 , P1...) the data required and it will reflect on the output port pins.

when you read the port registers (PO, P1..) you are reading the actual port .

only precaution for 8051s are this:

whwnever you want to read the ports , fist write to the port a 1.
then read the port.

otherwise , the port pin may get damaged.

for writing(output) , no restrictions.
for reading(input) , write a 1 first and then read the port.
 

Summary to configure a port as input port (or pin) send FFhex to that port (or 1 = High to that pin) else it can be used as output port.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top