Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   How do you program timers? (http://www.chiefdelphi.com/forums/showthread.php?t=24750)

roberthan 04-02-2004 00:21

How do you program timers?
 
Newbie here. I need some help on how to program timers for the Frc.

rdsideresistanc 04-02-2004 00:33

Re: How do you program timers?
 
Quote:

Originally Posted by roberthan
Newbie here. I need some help on how to program timers for the Frc.

well, you know that the program loop is approximately 26.2ms, so just start a counter of the program loops and use a conditional to decide when to execute your commands.

so if we use 26ms as our reference,
10 sec = approx. .026s * 385 or 385 program loops....

If you need code examples just ask :D

Cheers,
Joel

roberthan 04-02-2004 00:46

Re: How do you program timers?
 
Thanks alot, I could use some examples and does it work for the autonomus mode?

FotoPlasma 04-02-2004 00:51

Re: How do you program timers?
 
Quote:

Originally Posted by rdsideresistanc
well, you know that the program loop is approximately 26.2ms, so just start a counter of the program loops and use a conditional to decide when to execute your commands.

so if we use 26ms as our reference,
10 sec = approx. .026s * 385 or 385 program loops....

If you need code examples just ask :D

Cheers,
Joel

NO! PLEASE! FOR THE LOVE OF ALL THAT IS THE NEW CONTROL SYSTEM! DON'T DO THAT!

Read MPLAB C18 C COMPILER LIBRARIES, section 2.9 to learn about Microchip's provided libraries for initializing, reading, and writing any of the four available timers on the PIC18F8520. Timer0 is used by IFI for some stuff, I believe, but other than that, you can interact with Timers 1-4, two of which are 16 bits wide, and the other two of which are 8 bits wide. If you have any questions, please feel free to ask.

rdsideresistanc 04-02-2004 02:01

Re: How do you program timers?
 
what exactly is the problem with this method?

Kevin Watson 04-02-2004 02:18

Re: How do you program timers?
 
Quote:

Originally Posted by roberthan
Newbie here. I need some help on how to program timers for the Frc.

There is example code here: http://www.kevin.org/frc/. The interrupt and timer template code is pretty well documented. The clock demonstration code shows how to setup a timer to create a very accurate clock.

-Kevin


All times are GMT -5. The time now is 04:20.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi