Which is the frequency of this program?
I am using a pic16f876 with a 20Mhz Quartz...
Should it be same 20Mhz or not?
Thank you!!
i var word
TRISC = 0
PORTC = 0
inizia:
PORTC = %00000000
for i=0 to 255
PORTC = PORTC + %1
NEXT
goto inizia
end
Which is the frequency of this program?
I am using a pic16f876 with a 20Mhz Quartz...
Should it be same 20Mhz or not?
Thank you!!
i var word
TRISC = 0
PORTC = 0
inizia:
PORTC = %00000000
for i=0 to 255
PORTC = PORTC + %1
NEXT
goto inizia
end
With the oscilloscope it comes out a frequency of 200 khz.
A change of state for the LSB every 5 microseconds.
Is it right?
How can i have 20 MHz as the crystal resonator???
Try this. At 20MHz you should have a 500kHz signal on the pin used.
Code:DEFINE OSC 20 TRISB.0 = 0 ASM loop ; @ 20MHz 1us high + 1uS low bsf portb,0 ; 200nS goto $+1 ; 600nS goto $+1 ; 1000nS high bcf portb,0 ; 200nS goto $+1 ; 600nS goto loop ; 1000nS low ENDASM
just bear in mind that the pic will divide whatever the clock frequency is by 4
ie: if you have a 20mhz crystal, it will perform funcions @5mhz or one operation per 1/4 millionths of a second.
Bookmarks