Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/07/04 18:45
Read: times


 
Msg Score: 0
 -1 Gimmee Code
 +1 Informative
#75612 - RE: Program keeps looping itself ,Why?
Responding to: ???'s previous message
Hello Kashyap Deepak,

I would suggest you get the following programs off of
the Internet. They are public domain so they won't cost
you anything.
1. D51.EXE (8051 disassembler)
2. JSIM.EXE (8051 simulator)
3. Editor (your choice)
Put a little effort into learning these programs and you
can see things more clearly.
Having run your program thru ASEM.EXE (assembler),
D51.EXE (8051 disassembler) I was able to conclude you
were missing the infamous SJMP $ to keep the program
from going out of control AND your delay subroutine is
only 1 Milli second long (based on a 12 Mhz clock). A human can even see things
that happen that fast. This means you won't see the LED
blink on or off.

Once you have mastered items 1 and 2 you will be able to
write programs and debug them efficiently.

Good luck,

Charles Bannister


;  8051 Disassembly of deepak1.hex
;  8/7/2004 
	ORG	0
RESET1:	LJMP	MAIN		; 0000   02 01 0D   
	ORG	100H
DELAY1:	MOV	R2,#8		; 0100   7A 08     ;; Delay (510 uS) * (R1) * R0 (~ 1 Ms)    
	MOV	R1,#8		; 0102   79 08     ;;   5VDC------ 
	MOV	R0,#0ECH	; 0104   78 EC     ;;             R1 (100 Ohms)
DELAY2:	DJNZ	R0,DELAY2	; 0106   D8 FE     ;;             /
	DJNZ	R1,DELAY2	; 0108   D9 FC     ;;              K
	DJNZ	R2,DELAY2	; 010A   DA FA     ;;             LED (RED)
	RET			; 010C   22	   ;;   P3.0------/ A
MAIN:	CLR	P3.0		; 010D   C2 B0     ;; Led on 
	ACALL	DELAY1		; 010F   31 00     ;; Delay 925.183 Ms (~1 Ms @ 12Mhz) 
	SETB	P3.0		; 0111   D2 B0     ;; Led off 
	ACALL	DELAY1		; 0113   31 00     ;; Delay 925.183 Ms (~1 Ms @ 12Mhz)  
	CLR	P3.0		; 0115   C2 B0     ;; Led on 
HERE1:	SJMP	HERE1		; 0117   80 FE     ;; Hang here till dooms day 
	END


List of 12 messages in thread
TopicAuthorDate
Program keeps looping itself ,Why?            01/01/70 00:00      
   RE: Program keeps looping itself ,Why?            01/01/70 00:00      
      RE: Program keeps looping itself ,Why?            01/01/70 00:00      
         RE: Program keeps looping itself ,Why?            01/01/70 00:00      
            RE: Program keeps looping itself ,Why?            01/01/70 00:00      
               RE: Program keeps looping itself ,Why?            01/01/70 00:00      
                  RE: Program keeps looping itself ,Why?            01/01/70 00:00      
         RE: Program keeps looping itself ,Why?            01/01/70 00:00      
   RE: Program keeps looping itself ,Why?            01/01/70 00:00      
   RE: Program keeps looping itself ,Why?            01/01/70 00:00      
   RE: Program keeps looping itself ,Why?            01/01/70 00:00      
      My mistake            01/01/70 00:00      

Back to Subject List