Discussion Forum

Reading values from I/O port

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Roi T
Posted
20-Aug-2007 08:59 GMT
Toolset
C51
New! Reading values from I/O port

Hi,
I'm trying to read data off an I2C bus using a software simulator.
I see in the P1 peripheral dialog that P1.0 (SDATA) is low in the "Out" line, but the "In" line (latch?) has all of its high.
All I want to do is to read the bit in the "Out" line, but when I try to do so, I get the "In" line (although the debugger shows P1.0 as low).

My question is -
Can someone explain the difference between the two? I know one is the actual input pins and one is the output latch, but how do I manipulate the latch? How is it helpful? How do I read the actual value of the input pins?

I've read http://www.keil.com/support/docs/2071.htm and many more and still couldn't get a clear understanding of it...

Thanks!

Read-Only
Author
Reinhard Keil
Posted
28-Aug-2007 10:27 GMT
Toolset
C51
New! RE: Reading values from I/O port

I recommend to read this two KB articles:

http://www.keil.com/support/docs/2443.htm
http://www.keil.com/support/docs/1941.htm

Read-Only
Author
erik malund
Posted
28-Aug-2007 15:11 GMT
Toolset
C51
New! RE: Reading values from I/O port

The simplest feature of the '51 is also the one that many manage to make complex
There is no, none, nada, zero, keine, ingen, niente output or input pins in a '51 only quasi bidirectional pins.

read these two
http://www.8052.com/faqs.phtml?FAQ=120176http://www.8052.com/faqs.phtml?FAQ=121619

Erik

PS since you, as so many others, seem to consider it a secret what actual derivative you are using, I must add that some modern derivatives have configurable port, for those the above is only partially valid.

Next Thread | Thread List | Previous Thread Start a Thread | Settings