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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Aleksandar Stancic
06/21/09 03:21
Read: 301 times
Serbia


 
#166306 - AT89C51ED2 changing speed on its own
I've connected a LED on port P2.3 and
have a piece of code that turns it on and off.

After programming the part with FLIP and
hitting "Start Application" the code works
as it should. (ie. the LED blinks)

I can switch the power supply on and off,
and it always works.

If, howewer, I disconnect the programming cable
(RES and PSEN, actually, leaving RXD,TXD,VCC,GND connected),
and then turning it on and off, the LED does start
to blink, but really, really fast.

I have a crystal osc on 48MHz.
RES pin is left floating.

What should I do?


Here is the code:
(the error label is never reached, the LED always blinks)


		mov	IEN0,#0		;disable all INTs
		jmp	prog

		org	100h
error:		jmp	$		;to signal ERROR/INT, if I get it anyway

prog:		mov	a,CKCON0	;is X2 on?
		jb	acc.0, error

		mov	a,CKRL		;clock prescaler?
		cjne	a, #0FFh, error

loop:		clr	P2.3
		acall	delay

		setb	P2.3
		acall	delay

		jmp	loop

delay:		mov	r1,0
		acall	delayMS
		mov	r1,0
		acall	delayMS
		mov	r1,0
		acall	delayMS
		mov	r1,0
		acall	delayMS
		mov	r1,0
		acall	delayMS
		mov	r1,0
		acall	delayMS
		ret

delayMS:	mov	r2,#26

dms1:		mov	r3,#32

		djnz	r3,$

		djnz	r2,dms1

		djnz	r1,delayMS
		ret

 



List of 14 messages in thread
TopicAuthorDate
AT89C51ED2 changing speed on its own      Aleksandar Stancic      06/21/09 03:21      
   apply proper reset      Jan Waclawek      06/21/09 05:37      
      apply proper reset      Aleksandar Stancic      06/21/09 12:21      
         then that's R0 not R1      Jan Waclawek      06/21/09 14:57      
         MAX1232 + 4k7 pull-up      Kai Klaas      06/22/09 07:26      
            I beliebe this chip has a built-in watchdog and thus ...      Erik Malund      06/22/09 09:43      
               I don't like those on-chip watchdogs and Vcc monitors      Kai Klaas      06/22/09 10:35      
                  Should be always on      Per Westermark      06/22/09 10:47      
                  external vs internal      Erik Malund      06/22/09 13:18      
                     ..      Aleksandar Stancic      06/22/09 13:45      
                        Ground plane?      Kai Klaas      06/22/09 14:01      
                           no ground plane      Aleksandar Stancic      06/22/09 14:10      
                              choose a "magic" frequency crystal ...      Jan Waclawek      06/22/09 15:00      
                                 20MHz and 57600      Aleksandar Stancic      06/22/09 17:33      

Back to Subject List