Potreban savet oko podesavanje tajmera 16f877

Rasprava o PIC mikrokontrolerima, PIC projekti i drugo vezano za PIC-eve...

Moderators: pedja089, stojke369, [eDo], trax

Post Reply
MIKI73
Napredujem
Napredujem
Posts: 107
Joined: 01-11-2014, 16:57

Potreban savet oko podesavanje tajmera 16f877

Post by MIKI73 »

Pozdrav svima.Hteo sam nesto da pravim sa 16f877 i u podesavanju tajmera slucajno vidim nesto sto nerazumem pa evo da pitam za misljenje.U pitanju je podesavanje da preskaler bude 1:4 ali kad podesim u WDT je frekvencija 4 puta manja nego kad stavim 1:4 u tajmeru.Evo primera a u komentaru sam stavio podesavanje.Po meni sa 1:4 podesavanje frekvencija bi trebala da bude ista

symbol led=portc.5
brojac var byte
portb=0
trisb=0
intcon=%00100000
option_reg=%00001010 ; OVO PODESAVANJE --------------------- WDT = 1010 / TMR = 0001 = 1:4 oba podesavanja
brojac=0
tmr0=5
on interrupt goto isr

main:

if brojac=2 then
toggle led

brojac=0
endif
goto main
disable
isr
brojac=brojac+1
tmr0=5
intcon.2=0
resume
enable
end
MIKI73
Napredujem
Napredujem
Posts: 107
Joined: 01-11-2014, 16:57

Re: Potreban savet oko podesavanje tajmera 16f877

Post by MIKI73 »

Sad vidim i ovu gresku ali probao sam na nekoliko pinova da vidim sta ce da se desi pa mi je tako ostalo,uglavnom nemenja se nista.

symbol led=portc.5
brojac var byte
portb=0
trisb=0
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7876
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: Potreban savet oko podesavanje tajmera 16f877

Post by pedja089 »

Ja nisam skontoa sta je pitanje?
MIKI73
Napredujem
Napredujem
Posts: 107
Joined: 01-11-2014, 16:57

Re: Potreban savet oko podesavanje tajmera 16f877

Post by MIKI73 »

Pitanje je zasto frekvencija nije ista ako je u oba slucaja preskaler 1:4 ?
User avatar
pedja089
Administrator sajta
Administrator sajta
Posts: 7876
Joined: 20-02-2007, 14:50
Location: Beočin -Srbija

Re: Potreban savet oko podesavanje tajmera 16f877

Post by pedja089 »

Zato sto klok ne dolazi sa istog oscilatora.
Za tmr dolazi sa Fosc/4, a za WDT sa internog RC oscilatora.

Code: Select all

14.13 Watchdog Timer (WDT)
The Watchdog Timer is a fr*e running, on-chip RC
oscillator which does not require any external
components. This RC oscillator is separate from the
RC oscillator of the OSC1/CLKI pin. That means that
the WDT will run even if the clock on the OSC1/CLKI
and OSC2/CLKO pins of the device has been stopped,
for example, by execution of a SLEEP instruction.
Aakriti
Posts: 1
Joined: 10-10-2023, 08:08

Re: Potreban savet oko podesavanje tajmera 16f877

Post by Aakriti »

A PIC 16F877 microcontroller needs to have its registers carefully configured in order to set the timer. To get detailed instructions on how to configure timers for your particular application, look for online tutorials or refer to the datasheet.GB whatsapp Apk
Post Reply