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 implement 8051 port3 as bidirection I/O?

Status
Not open for further replies.

hch16550

Junior Member level 2
Joined
Jan 26, 2002
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
72
I want to use 8051 port 3 as bidirection I/O.
How to implement 8051 port3 as bidirection I/O?

Thanks.

hch16550 :cry:
 

Hi hch16550,

All four ports 0,1,2,3 of MCS51 are bidirectional. However only port 0 is considered "true" bidirectional, because when configured as an input, it floats.
Ports 1,2 and 3 are sometimes called "quasi - bidirectional" due to the fixed internal pullups.

You can read a good document about hardware inside standard MCS51 at:

**broken link removed**

Thus, if you want a "true" bidirectional (high-impedance input) on port 3 you must use an external buffer featuring three state output.
Otherwise, for "quasi - bidirectional" you must accept a weak pullup resistor on the order of 100K ohms pulls the port pin up toward Vcc. Obvious if you want all bits, you must sacrifice various special features provided by micro on port 3 as: INT0,1 T0,1 RX TX RD WR

This behaviour could be slightly different from one MCS51 derivative to another, but from most of them, follows the rules depicted in 80C51_FAM_HARDWARE_1.pdf

Regards,
Silvio
 

Hi, my dear friends.
I use aduc814( 8051 like) port3 sometime as input port, some time as output port alternate.
I use the port as handshak port,somt time output data ,somtime input data.
In low speed the data is correct.
In high speed the data sometime is wrong.
I don't know what happened?
;input data
MOV A,#0FFH
ORL P3,A
MOV A,P3
CLR IBF_RST ;handshak signal
MOV A,P3 ;READ A/D PORT
SETB IBF_RST
MOV B,A ;PASS TO B

;output data
MOV P3,#0 ;MAKE P3 OUTPUT STATE
MOV P3,A
CLR OBF_SET ;OBF_SET SIGNAL
NOP
SETB OBF_SET
MOV A,#0FFH ;MAKE P3 as INPUT STATE
MOV P3,A


Thanks.

hch16550 :?
 

Hi hch16550,

Can you post all code ?
Please mention what means for you low and high speed.
What kind of peripheral device did you attached to the P3 port (wires configuration) ?
How you figure out that data is wrong ? What results did you expected to see ?

All I can tell you until now is:
1. You can write immediately to port 3. No need to go through Accumulator.
2. It's useless to write #00H to P3 in order to make it output port. In fact, you write to output latch. If you need 0 on output, write 0. If you need 1, then write 1. If you write 1 doesn't mean it becomes automatically input. It's true that the pull up is enabled and you can use port as input. But you can use as output as well, and P3 will source current when externally pulled low.
3. Sorry to say that but the code it's meaningless for me until I'll see complete.

Regards,
Silvio
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top