# PIC program clock delay question ?

Discussion in 'Electronic Basics' started by sunny, Aug 31, 2003.

2. ### Dana RaymondGuest

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

3. ### sunnyGuest

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!

4. ### The ButcherGuest

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
http://users.pandora.be/davshomepage
!!! Remove f*ckspam in email address .

5. ### sunnyGuest

What is the delay here:
I have not got this oscillator, I am referring to the internal 4mhz one.

7. ### sunnyGuest

Is there a way to simulate the ADC ?

8. ### Robert MonsenGuest

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

nope