Re: PIC timing
- From: "Richard Seriani" <richard_s633@xxxxxxx>
- Date: Fri, 28 Dec 2007 19:13:48 -0500
"randy.day" <randy.day@xxxxxxxx> wrote in message
news:nTedj.29074$DP1.13331@xxxxxxxxxxxx
Okay, I was curious about the actual speed my controllerIf you are only measuring the part of the pulse that is high, it appears it
is running at, so I ran the following loop on it. If I'm not mistaken,
I've set OSCCON to 8MHz, so at 4 clock/instruction I should see
0.5 uS pulses. My scope on RB4 shows pulses 5uS wide!
I'm out by a factor of 10. What have I not taken into account?
#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF &
_CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
Org 0
goto Start
Org 4
goto ISR
ISR
retfie
Start movlw 0x71 ;b'01110001'
BANKSEL OSCCON
movwf OSCCON
; initialize any register that might affect I/O
BANKSEL IOCB
clrf IOCB
clrf WPUB
clrf ANSEL
clrf ANSELH
BANKSEL TRISA
clrf TRISA ; PORTA all output
clrf TRISB ; PORTB all output
clrf TRISC ; PORTC all output
BANKSEL SSPCON
bcf SSPCON, 5
;=== run timing loop ===
BSF PORTB,4
BCF PORTB,4
goto $-2
end
should be 0.5 us. Check if your scope has a X10 horizontal magnification
switch (my old Leader has a knob on the inside of the Variable Possition
control (horizontal position) that is labeled, "PULL X10 MAG". Inadvertantly
activating that control can throw you off.
By the way, goto takes 2 instruction cycles, so you may be getting a 0.5 us
high pulse, followed by a 1 us low pulse.
Richard
.
- Follow-Ups:
- Re: PIC timing
- From: Randy Day
- Re: PIC timing
- References:
- PIC timing
- From: randy.day
- PIC timing
- Prev by Date: Re: Can you charge a battery from two sources at the same time?
- Next by Date: Re: Basic AC wattage question: am I doing my math right?
- Previous by thread: Re: PIC timing
- Next by thread: Re: PIC timing
- Index(es):
Relevant Pages
|