Maker Pro
Maker Pro

PIC program clock delay question ?

D

Dana Raymond

Jan 1, 1970
0
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
 
S

sunny

Jan 1, 1970
0
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!
 
T

The Butcher

Jan 1, 1970
0
sunny said:
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 .
 
S

sunny

Jan 1, 1970
0
What is the delay here:
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.
 
R

Robert Monsen

Jan 1, 1970
0
Eugene Rosenzweig said:
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
 
R

Robert Monsen

Jan 1, 1970
0
sunny said:
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
 
Top