CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Timer5 Period Match with PICC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mah115
Guest







Timer5 Period Match with PICC
PostPosted: Thu Oct 30, 2008 10:05 am     Reply with quote

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;
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: Timer5 Period Match with PICC
PostPosted: Thu Oct 30, 2008 10:23 am     Reply with quote

Code:

#byte PR5L=0x70
#byte PR5H=0x71 
 . . .
  PR5H = 100/256;
  PR5L = 100%256;

_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
Ttelmah
Guest







PostPosted: Thu Oct 30, 2008 10:36 am     Reply with quote

However, read the data sheet.
The timer5 registers are at 0xF87, and 0xF88, not 70 and 71.

Best Wishes
Guest








PostPosted: Thu Oct 30, 2008 11:36 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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