Hello,
I want to interface(blink) 7 leds using 89c2051 with different delays..
I will be grateful if I get some help with the C code .. Even the very basic code will be perfect I will try to understand and modify it according to my needs..
I will debug the code in keil.. also if you can explain the hardware I will be very grateful..
I m new to microcontrollers and I find them intresting please help..
Cheers
Interfacing led's to 8051 is very simple.U can connect an led directly to any port pin in either pullup or pulldown mode.U can switch the led by just giving values of 1 or 0 to the port.
In keil,we can do it as
>give values 1 or 0 to port as
P1^0=1;
or P1^0=0; //P1.0 is used
>define a function for delay if u need it.
the code for 8051 and 89c2051 will be same?
and do i need to include any header when i write the code in c?
also what if i whant toh set the complete port?
wil it b p1=FF
and sorry i did not understand pullup or pulldown mode..
>The codes for 8051 and 89c2051 are the same.
>U have to include reg51.h header file.
>To use the entire port,its P1=0xFF //0x represents hex value
>Pulldown mode:Connect the cathode of led to portpin and anode to ground.
>Pullup mode:Connect the cathode of led to vcc through a resistor and the anode to portpin of the ic.
Before using any pin or PORT do not forget to give a direction that is if you are using any pin as input pin give the direction as input and same for output also.
Before using any pin or PORT do not forget to give a direction that is if you are using any pin as input pin give the direction as input and same for output also.
It is required only when the port is to be used for input.Then initially a 1 should be written to all the ports to use it for input.
No needing of such things while its for outpput.
Yes..Port 1 can be used in pulldown mode.But i think there is a difference for the pins 0 & 1 of port1 .Check with the datasheet of the ic to get it cleared.