Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Technical Discussion (http://www.chiefdelphi.com/forums/forumdisplay.php?f=22)
-   -   Timers and MPLab (http://www.chiefdelphi.com/forums/showthread.php?t=62722)

joshyboy9987 28-01-2008 16:55

Timers and MPLab
 
So, this is my first year using MPLab instead of EasyC and I was wondering if there was a way to access a hardware timer at all. I know it can be done, cuz EasyC has a function to do it, but I couldn't find anything on the forums.

kaszeta 28-01-2008 18:15

Re: Timers and MPLab
 
Quote:

Originally Posted by joshyboy9987 (Post 687459)
So, this is my first year using MPLab instead of EasyC and I was wondering if there was a way to access a hardware timer at all. I know it can be done, cuz EasyC has a function to do it, but I couldn't find anything on the forums.

It's relatively easy. Which version of the code are you using (Kevin's new code, or the 2007 default code)?

The basics are in http://www.ifirobotics.com/docs/time...004-jan-14.pdf

But basically you setup the timer, create an ISR that updates some timer variables, and a set of functions that let you read the timer values.

joshyboy9987 28-01-2008 18:19

Re: Timers and MPLab
 
Thanks a lot... I'll read through that stuff tonight and see what happens. We're using the default code.

TechnocratiK 03-02-2008 16:01

Re: Timers and MPLab
 
Are all the timers on the PIC18F8520/8722 (TIMER0-4) available for our use, or are some reserved for use by the IFI code?

dcbrown 03-02-2008 16:53

Re: Timers and MPLab
 
I'd stay away from TMR0. Its referenced from some routines in ifi_library.c (within the high priority interrupt).

TechnocratiK 04-02-2008 10:04

Re: Timers and MPLab
 
I'm going to answer my own question here. In the IFI 2004 Programming Reference Guide, on page 28, it says that all timers are available to the user for programming, so hopefully that still applies to the 18F8722. I'll post again after some more testing (notably, when I have a chance to get the values of the TxCON registers during initialisation and runtime). Thanks for your input.

Mark McLeod 04-02-2008 10:10

Re: Timers and MPLab
 
Be sure to use the ifi library FRC_alltimers.lib, rather than FRC_library.lib.
FRC_library.lib in the default code does use Timer 0, but not for any reason you'd probably care about.

TechnocratiK 04-02-2008 10:12

Re: Timers and MPLab
 
Huh... so that's what that's for. Thanks for the tip, that definitely removes all doubt about which timers to use.


All times are GMT -5. The time now is 09:37.

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