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.
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
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?
CLR IBF_RST ;handshak signal
MOV A,P3 ;READ A/D PORT
MOV B,A ;PASS TO B
MOV P3,#0 ;MAKE P3 OUTPUT STATE
CLR OBF_SET ;OBF_SET SIGNAL
MOV A,#0FFH ;MAKE P3 as INPUT STATE
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.