8051 basic question IO ports

Status
Not open for further replies.

PCBwire

Newbie level 6
Joined
Mar 27, 2010
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,357
Because i am new at 8051, i would like to know:

For example lets use port P1.
If i want to output something i just write P1 = number; in keil C.
As i understand that value will be always on that port until next write.

If it is true, and if i want now to receive something on P1, it can not be received if port is already transmitting something. How to prepare port for input?
 

for basic 8051 ,
if you want to make as input port
you must first write '1' to that port bit ,
then you can operate it as input port.

this is a must for 8051 before you apply any input voltage to port bit.

srizbf
15thmay2010
 

    PCBwire

    Points: 2
    Helpful Answer Positive Rating
Thanks, that was fast!
 

On power-on (or after reset) all P0-P3 pins have written a "1" into them, so they are already set as inputs .. see attached table ..

IanP
 

    PCBwire

    Points: 2
    Helpful Answer Positive Rating
It also depend upon which microcontroller ur using..
In some 8051 u have to decide direction of the port i.e. output or input
I f its bidirectional port then above logic is true i.e. writing 1 before reading..
 

    PCBwire

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…