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.

at89c2051 based led blinking problem

Status
Not open for further replies.

rohansinha2000

Member level 2
Joined
Jan 8, 2010
Messages
51
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Location
KOLKATA
Activity points
1,678
sir,
i have write a programmed but it is not working .....can anyone help me?

org 0h
start:Setb P0.0 ; send '1' to P0.0
call delay; call delay time
setb P0.1 ;
call delay;
setb P0.2 ;
call delay;
setb P0.3 ;
call delay;
setb P0.4 ;
call delay;
setb P0.5 ;
call delay;
setb P0.6 ;
call delay;
setb P0.7 ;
call delay;
call delay;
call delay;
call delay;
call delay;
Clr P0.7 ;
call delay;
Clr P0.6 ;
call delay;
Clr P0.5 ;
call delay;
Clr P0.4 ;
call delay:
Clr P0.3 ;
call delay;
Clr P0.2 ;
call delay;
Clr P0.1 ;
call delay;
Clr P0.0 ;
call delay;
sjmp start; loooooop forever to start

delay: mov R1,#255H
del1: mov R2,#255H
del2: djnz R2,del2
djnz R1,del1
ret
end
 

Have a look at the following mistakes [marked as <-----]:

Code:
org 0h 
start:Setb P0.0 ; send '1' to P0.0 
call delay; call delay time 
setb P0.1 ; 
call delay; 
setb P0.2 ; 
call delay; 
setb P0.3 ; 
call delay; 
setb P0.4 ; 
call delay; 
setb P0.5 ; 
call delay; 
setb P0.6 ; 
call delay; 
setb P0.7 ; 
call delay; 
call delay; 
call delay; 
call delay; 
call delay; 
Clr P0.7 ; 
call delay; 
Clr P0.6 ; 
call delay; 
Clr P0.5 ; 
call delay; 
Clr P0.4 ; 
call delay:    <---- remove collon ..
Clr P0.3 ; 
call delay; 
Clr P0.2 ; 
call delay; 
Clr P0.1 ; 
call delay; 
Clr P0.0 ; 
call delay; 
sjmp start; loooooop forever to start 

delay: mov R1,#255H  <---- remove "H" or change to #0FFh
del1: mov R2,#255H  <---- remove "H" or change to #0FFh
del2: djnz R2,del2 
djnz R1,del1 
ret 
end

And after correction:

Code:
       MCS-51 Family Macro Assembler   A S E M - 5 1   V 1.3
       =====================================================



	Source File:	2051_LED.txt
	Object File:	2051_LED.hex
	List File:	2051_LED.lst



 Line  I  Addr  Code            Source

    1:		N      0000		org 0h
    2:	  0000			start:
    3:	  0000	D2 80			Setb P0.0 		; send '1' to P0.0
    4:	  0002	12 00 5E		call delay		; call delay time
    5:	  0005	D2 81			setb P0.1
    6:	  0007	12 00 5E		call delay
    7:	  000A	D2 82			setb P0.2
    8:	  000C	12 00 5E		call delay
    9:	  000F	D2 83			setb P0.3
   10:	  0011	12 00 5E		call delay
   11:	  0014	D2 84			setb P0.4
   12:	  0016	12 00 5E		call delay
   13:	  0019	D2 85			setb P0.5
   14:	  001B	12 00 5E		call delay
   15:	  001E	D2 86			setb P0.6
   16:	  0020	12 00 5E		call delay
   17:	  0023	D2 87			setb P0.7
   18:
   19:	  0025	12 00 5E		call delay
   20:	  0028	12 00 5E		call delay
   21:	  002B	12 00 5E		call delay
   22:	  002E	12 00 5E		call delay
   23:	  0031	12 00 5E		call delay
   24:
   25:	  0034	C2 87			Clr P0.7
   26:	  0036	12 00 5E		call delay
   27:	  0039	C2 86			Clr P0.6
   28:	  003B	12 00 5E		call delay
   29:	  003E	C2 85			Clr P0.5
   30:	  0040	12 00 5E		call delay
   31:	  0043	C2 84			Clr P0.4
   32:	  0045	12 00 5E		call delay
   33:	  0048	C2 83			Clr P0.3
   34:	  004A	12 00 5E		call delay
   35:	  004D	C2 82			Clr P0.2
   36:	  004F	12 00 5E		call delay
   37:	  0052	C2 81			Clr P0.1
   38:	  0054	12 00 5E		call delay
   39:	  0057	C2 80			Clr P0.0
   40:	  0059	12 00 5E		call delay
   41:
   42:	  005C	80 A2			sjmp start		; loooooop forever to start
   43:

ASEM-51 V1.3                                         Copyright (c) 2002 by W.W. Heinz                                         PAGE 2



 Line  I  Addr  Code            Source

   44:	  005E	79 FF		delay:mov R1,#255
   45:	  0060	7A FF		del1:	mov R2,#255
   46:	  0062	DA FE		del2:	djnz R2,del2
   47:	  0064	D9 FA			djnz R1,del1
   48:	  0066	22			ret
   49:
   50:
   51:				end





                     register banks used:  ---

                     no errors

When you publish your code - always use .CODE. feature ..
It just looks more transparent ..

:D :D :D
 

thanks friend. i compiled your rectified code. but leds are not blinking. i donot get the problems.plz solve it

Added after 4 hours 14 minutes:

it is not also working for at 89c2051.............help me out
org 0000h
start:Setb P0.0 ; send '1' to P0.0
call delay; call delay time
setb P0.1 ;
call delay;
setb P0.2 ;
call delay;
setb P0.3 ;
call delay;
setb P0.4 ;
call delay;
setb P0.5 ;
call delay;
setb P0.6 ;
call delay;
setb P0.7 ;
call delay;
call delay;
call delay;
call delay;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
call delay;
call delay;
call delay;
call delay;
Clr P0.7 ;
call delay;
Clr P0.6 ;
call delay;
Clr P0.5 ;
call delay;
Clr P0.4 ;
call delay;
Clr P0.3 ;
call delay;
Clr P0.2 ;
call delay;
Clr P0.1 ;
call delay;
Clr P0.0 ;
call delay;
sjmp start; loooooop forever to start

delay: mov R0,#0FFH
del1: mov R1,#0FFH
del2: djnz R1,del2
djnz R0,del1
ret
end
 

at89c2051 based led blinking problem 2

MODERATOR ACTION: You get a warning!
Do not request the same again. Double posting is really unwanted. All posts which are related to the same request, merged together


is not working for at89c2051 why? plz help me out
org 0000h
start:Setb P0.0 ; send '1' to P0.0
call delay; call delay time
setb P0.1 ;
call delay;
setb P0.2 ;
call delay;
setb P0.3 ;
call delay;
setb P0.4 ;
call delay;
setb P0.5 ;
call delay;
setb P0.6 ;
call delay;
setb P0.7 ;
call delay;
call delay;
call delay;
call delay;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
Clr P0.7 ;
Clr P0.6 ;
Clr P0.5 ;
Clr P0.4 ;
Clr P0.3 ;
Clr P0.2 ;
Clr P0.1 ;
Clr P0.0 ;
call delay;
setb P0.7 ;
setb P0.6 ;
setb P0.5 ;
setb P0.4 ;
setb P0.3 ;
setb P0.2 ;
setb P0.1 ;
setb P0.0 ;
call delay;
call delay;
call delay;
call delay;
call delay;
Clr P0.7 ;
call delay;
Clr P0.6 ;
call delay;
Clr P0.5 ;
call delay;
Clr P0.4 ;
call delay;
Clr P0.3 ;
call delay;
Clr P0.2 ;
call delay;
Clr P0.1 ;
call delay;
Clr P0.0 ;
call delay;
sjmp start; loooooop forever to start

delay: mov R0,#0FFH
del1: mov R1,#0FFH
del2: djnz R1,del2
djnz R0,del1
ret
end
 

at89c2051 based led blinking problem 2

First you check your hardware..
and increase delay...

call bigdelay

bigdelay:
mov r2,#0a0h
lp:
call delay
djnz r2,lp
ret

write simple program to check ur system first...

org 0000h
start:
Setb P0.0
call bigdelay
clr P0.0
call bigdelay
sjmp start
 

The code is OK for any 8051-40-pin-derivative, however, the AT89C2051 is a reduced version of 8051 and therefore doesn't have Port_0 ..
You have to change P0.X to P1.X or P3.X .. see attached picture or the AT89C2051 data sheet for pin configuration ..
http://www.atmel.com/dyn/resources/prod_documents/doc0368.pdf

Rgds,
IanP
:|
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top