| ??? 03/14/01 11:31 Read: times |
#9980 - Using Port P3 pins as I/O |
Hi,
I have a application in which I have to use Port 3 pins in their alternate functions. Only P3.4 and P3.5 are not used in alternate funcion. I want to make P3.4 as normal I/P pin and P3.5 as normal Output pin. It is given in the datasheets of 8051 that to use alternate functions of port P3, a 1 is to be written to the P3 latch. Now, if I write a 1 to P3.4 to make it input, the microcontroller will interpret the 1 as though it is used for alternate function. How can I distinguish that the 1 written to P3.4 is for using it as normal Imput Pin rather than alternate function ? 2) In the read-modify-write commands, it is given in the intel 8051 datasheets, that mov Px.y,C clr Px.y setb Px.y writes and reads the latch rather than the pin. Also, it is mentioned that by changing the data at the latch, the port is configured as Input or Output. Can anyone please clarify, how to make a port pin as output and change the values of the output pin without changing the status of the latch. If a 1 is written to the output port pin, how does the controller come to know whether it is the output state of the pin or you want to make it as Input port pin. 3) Can a port say P1 be made as input port initially and then as output port in the same program and how? I shall be highly obliged if any one could help me out with the above problems. Thanking You Regards, Mohit Gupta |
| Topic | Author | Date |
| Using Port P3 pins as I/O | 01/01/70 00:00 | |
RE: Using Port P3 pins as I/O | 01/01/70 00:00 |



