![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
mah115 Guest
|
Timer5 Period Match with PICC |
Posted: Thu Oct 30, 2008 10:05 am |
|
|
Hello,
I'm trying to use PIC C with the PIC18F4431, and I'm trying to make the PIC generate an interrupt on a TIMER5 period match. However, the setup_timer_5(MODE,PERIOD) function won't work, only the setup_timer_5(MODE) works. This means I can't set the period match register, when I should be able to.
I also tried writing directly to the memory location of PR5, but that doesn't work either. Anyone know how to set the period match register?
Code: |
int* PR5L;
int* PR5H;
PR5L = 0x70;
PR5H = 0x71;
*PR5H = 100/256;
*PR5L = 100%256;
|
|
|
![](templates/subSilver/images/spacer.gif) |
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Re: Timer5 Period Match with PICC |
Posted: Thu Oct 30, 2008 10:23 am |
|
|
Code: |
#byte PR5L=0x70
#byte PR5H=0x71
. . .
PR5H = 100/256;
PR5L = 100%256;
|
_________________ Robert Scott
Real-Time Specialties
Embedded Systems Consulting |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Thu Oct 30, 2008 10:36 am |
|
|
However, read the data sheet.
The timer5 registers are at 0xF87, and 0xF88, not 70 and 71.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Thu Oct 30, 2008 11:36 am |
|
|
Ttelmah wrote: | However, read the data sheet.
The timer5 registers are at 0xF87, and 0xF88, not 70 and 71.
Best Wishes |
Ah, good catch. PR5 is actually 0x90 and 0x91; I was reading the wrong column. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|