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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/25/10 16:29
Read: times


 
#172710 - execution speed and crystal frequency
Hi, I just started out with microcontrolers and have a question about the execution speed in combination with the crystal used as clock.

I made a test program which simply decrements P0 in a loop (with some delay). It all works fine, I've got 8 LED's connected to P0 so I have a simple binairy counter.
Now for my question: I have two different crystal oscillators, one with a frequency of 11.059 MHz and on of 32.768 MHz. I read the 8051 tutorial from the site and I understand that with the 32 MHz one my program should run almost 3x as fast as the 11 Mhz one, right?

Except it doesn't... When I change the crystal the LED's blink just as fast. I timed it with the stopwatch on my phone and it takes (independent of the crystal) about 6 seconds to count from 0 all the way to 255 where it wraps back to 0.

The microcontroler I use is an AT89S51RC. As far as I can tell from the data-sheet it has no internal timer and can be used with a crystal between 0 and 33MHz.
I connected the crystal between pins XTAL1 and XTAL2 and connected connected both pins to the ground using 30pF capacitors as instructed in the data-sheet.

The program I run is:

	ORG	0h

START:
	MOV	P0, #255
LOOP:
	CALL	DELAY
	DEC	P0
	SJMP	LOOP
	

DELAY:
	MOV	R1, #100
DELAY1:
	MOV	R2, #100
DELAY2:
	DJNZ	R2, DELAY2
	DJNZ	R1, DELAY1

	RET

END

 


I'm probably missing something really obvious here, but can't figure out what. Can anyone explain why my program runs at the same speed with a different crystal.

Thanks,
Hans

List of 26 messages in thread
TopicAuthorDate
execution speed and crystal frequency            01/01/70 00:00      
   my guess is ...            01/01/70 00:00      
   overtone            01/01/70 00:00      
   As others already mentioned...            01/01/70 00:00      
      Indeed overtone            01/01/70 00:00      
         Just try the crystal with 15pF + 15pF caps.            01/01/70 00:00      
   Try it with a crystal oscillator, rather than a crystal            01/01/70 00:00      
      baloney            01/01/70 00:00      
         Baloney #2            01/01/70 00:00      
         Where is your head wedged, Erik?            01/01/70 00:00      
            just correcting invalid info            01/01/70 00:00      
               SO ... What, exactly, is incorrect?            01/01/70 00:00      
                  already stated            01/01/70 00:00      
                     You are showing us how smart you are again, Erik!            01/01/70 00:00      
                        not my intention, but thanks for the compliment            01/01/70 00:00      
         Richard is right...            01/01/70 00:00      
            I do not use these and ....            01/01/70 00:00      
               Fact is ...            01/01/70 00:00      
                  as Kai stated            01/01/70 00:00      
                     so ... Erik ... what's your point?            01/01/70 00:00      
                        I did            01/01/70 00:00      
                           Once again, Erik, you've missed the point            01/01/70 00:00      
                              YOU would sell a suicide candidate a rope            01/01/70 00:00      
                                 come on...            01/01/70 00:00      
                     come on...            01/01/70 00:00      
   Specifying Quartz Crystals            01/01/70 00:00      

Back to Subject List