Dear all, i am using P89V51RD2 (philips) 8051 micro-controller. i am doing some samples with NSK developemnt kit. In this i want to set the Port1 pint 0 to 7 as high/low continiously. I tried this by using the following lines,
P1 = 0x00 ; delay(10000) ; P1 = 0xFF ;
but still i am always getting around 5V on these pins. i searched lot of forums, but in that also they mentioned like this only. Kindly give your suggessions.......
Thanks and Regards Radhakrishnan M
Dear all, Thanks for your replies. i am new to this micro-controller domain. so i might have missed something. i am using Keil uVision4.22 to program for 8051 micro-controller with C. Using this i want to configure few ports as input(ex port1 as input). Suppose if i initialize the value with 0 then whenever i connect some input in this port then i will show either off or intermediate state.
You don't configure, since the normal port don't have any configure register.
If you set the pin as low, it will kept low by force - making it impossible for you to see a high input signal. This makes it incompatible for use as input. But can result in damages if processor pin is connected to external hardware that can draw pin high with strength.
If you set the pin as high, it will be kept high by a weak internal pull-up. So external electronics can override and force the pin low. So you could have the processor read the pin state and see if it is still high or if it is externally drawn low. In shirt - it will behave like an input.
This information is available in thousands of posts on hundreds of web sites. And google knows most of them.
www.8052.com/.../120176 www.8052.com/.../121619
these resources are great for "traditional '51s", in this respect including the Rx2. Some modern derivatives (e.g. SILabs) have configurable ports.
Erik
Suppose if i initialize the [port pin] value with 0 then whenever i connect some input in this port [pin] then i will show either off or intermediate state ????
if you connect an input to a port pin that is set to 0, you will, of course, see a 'low' at that input.
You might also see smoke, since the processor pin will try to short whatever is connected to ground.