8051 ports controlling....

Status
Not open for further replies.

saur

Member level 2
Joined
Feb 23, 2012
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,621
I'm making a project....in which i made port 0 output port using commands:
Code:
mov a,#00h
mov p0,a
Then I sent commands such as (3Fh,FFh,etc)for Glcd through p0...
for this purpose i sent commands as follows:
after making p0 output port
Code:
mov a,#3fh
mov p0,a
mov a,#0ffh
mov p0,a
but then if I want to send data I give command
Code:
mov a,#0ffh
mov p0,a
but I am feeling that the 8051 is not considering this as a command to make p0 input port, but as a data to be sent through output port 0..
So is there any way to check it?
Pls help me with this...
thanking u all....
waiting for ur replies....
 
Last edited by a moderator:

... but I am feeling that the 8051 is not considering this as a command to make p0 input port, but as a data to be sent through output port 0..
So is there any way to check it? ...

If you use command:
MOV A, P0
and A reads as all "1"s (#0FFh) then P0 is prepared to act as input ..
For 8051 there is no distinction between treating port as input or output, but only when a port is set to "1"s it may act as input ..
:wink:
IanP
 

So can u suggest me any way by which i can send data "FFH" to GLCD without making it an input port??
 

So can u suggest me any way by which i can send data "FFH" to GLCD without making it an input port??

Just send 0xFF using a typical sequence:
Code:
MOV A, #0FFh
MOV P0, A
Sending a “1” to a port pin does not define whether the pin becomes an output or an input.
It activates a weak pull-up inside the microcontroller what is enough for an external device such as LCD unit to read it as “H” or “1” and it (the weak pull-up) does not stop an external device from asserting a “0” if it asked to transmit data back to the microcontroller ..
:wink:
IanP
 
Reactions: saur

    saur

    Points: 2
    Helpful Answer Positive Rating
okk...thanks.... :_)
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…