PIC program clock delay question ?

S

sunny

Guest
If I have a PIC16F84 with an 32768khz osc, using timer0
and a prescaler of 32, what will be the delay?

I got 1/32768*256*32 = 0.25 sec ?

Any advances on that ?
:)

p.s.
This problem relates to this program
http://www.piclist.com/techref/piclist/cheapic/binclock.htm
 
You're missing the /4 stage between Fosc and the mux. Hence rate = 1/32768
*4 *32 *256 = 1Hz.
T0CS selects one count for every INSTRUCTION cycle, not oscillator cycle.

Hope this helps.
Dana Frank Raymond

"sunny" <nomail@btinternet.com> wrote in message
news:birk4u$hvu$2@hercules.btinternet.com...
If I have a PIC16F84 with an 32768khz osc, using timer0
and a prescaler of 32, what will be the delay?

I got 1/32768*256*32 = 0.25 sec ?

Any advances on that ?
:)

p.s.
This problem relates to this program
http://www.piclist.com/techref/piclist/cheapic/binclock.htm
 
What is the delay here:

use timer0
; prescaler set to 1:16
; rolls over each 1/125 th second

4mhz/4cycles = 1mhz
1/1,000,000*256*16=.004096 which is not 1/125 ?

Thanks!
 
"sunny" <nomail@btinternet.com> schreef in bericht
news:bit2mp$dst$1@titan.btinternet.com...
What is the delay here:

use timer0
; prescaler set to 1:16
; rolls over each 1/125 th second

4mhz/4cycles = 1mhz
1/1,000,000*256*16=.004096 which is not 1/125 ?

Why are you dividing by 1,000,000 you need to divide by 32768

1 / 32768 * 4 * 256 * 16 is a period of 0,5s

4 cause of the internal instruction cycle
16 prescaler
256 timer overloop (interrupt)

When you take a prescaler of 32 you have an exact period of 1s

Grtz The Butcher
You need info about infrared remote protocols, 1 link:
http://users.pandora.be/davshomepage
!!! Remove f*ckspam in email address .
 
What is the delay here:

use timer0
; prescaler set to 1:16
; rolls over each 1/125 th second

4mhz/4cycles = 1mhz
1/1,000,000*256*16=.004096 which is not 1/125 ?

Why are you dividing by 1,000,000 you need to divide by 32768
I have not got this oscillator, I am referring to the internal 4mhz one.

1 / 32768 * 4 * 256 * 16 is a period of 0,5s

4 cause of the internal instruction cycle
16 prescaler
256 timer overloop (interrupt)

When you take a prescaler of 32 you have an exact period of 1s
 
"Eugene Rosenzweig" <ugn@hotmail.com> wrote in message
news:3f51f08a$1@news.comindico.com.au...
There is an easy way to verify these things too:
compile the code
start the simulator
open the stopwatch in one of the menus (I htink thats what the tool is
called). It gives you cycles and real time and ms.
place a breakpoint right after the delay loop
run the code

I've used it often to verify the time-critical paths in the code.
its view menu:simulator trace
 
"sunny" <nomail@btinternet.com> wrote in message
news:bj59jn$68n$1@titan.btinternet.com...
Is there a way to simulate the ADC ?
Not that I know of. It would be quite useful, however, to be able to specify
voltage ramps (ala the piecewise waveforms of spice fame) and have the PIC
simulator react that that.

Regards,
Bob Monsen
 

Welcome to EDABoard.com

Sponsor

Back
Top