Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

interfacing led with 89c2051

Status
Not open for further replies.

ankitvirdi4

Member level 4
Member level 4
Joined
Mar 13, 2012
Messages
70
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Location
India
Activity points
1,928
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.
 
Thanks! :-D
just one last question
Can i use port 1 of 89c2051 in pulldown mode.. if not then how do i determine the value of the resistor ?
 
Last edited:

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.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top