Adding CCP1 (CCPR1L CCPR1H) registers.

General discussion on mikroC.
Post Reply
Author
Message
sparky
Posts: 47
Joined: 06 Jun 2008 04:35
Location: Australia

Adding CCP1 (CCPR1L CCPR1H) registers.

#1 Post by sparky » 29 Mar 2009 03:33

Hi all,

I want to get the total captured contents of the CCPR1L (low byte) and CCPR1H (high byte) registers.

Should I do it like this: CCPR1L + (CCPR1H<<8).

Or just like this: CCPR1L + CCPR1H.

Thanks for any help.

Nick101
Posts: 339
Joined: 06 Aug 2006 15:32
Location: Texas
Contact:

#2 Post by Nick101 » 29 Mar 2009 13:57

Hello,
It can be CCPR1L + (CCPR1H<<8 ) or (CCPR1H*256) + CCPR1L or get them direct from define address 0x15 unsigned varible

Code: Select all

unsigned CCPR1 absolute 0x15;
CCPR1 always contains CCPR1H:CCPR1L
Nick
[url]http://www.pic_examples.byethost3.com/[/url]

sparky
Posts: 47
Joined: 06 Jun 2008 04:35
Location: Australia

#3 Post by sparky » 30 Mar 2009 09:22

Hi Nick,

Thanks for your answer.

I like your idea about reading data straight from the address however 0x15 is only for CCPR1L right?. Would I need to read 0x16 (CCPR1H) also and then add them together and name it CCPR1? I guess if I did that it would be easier for me to use the register names. Sorry for what I'm guessing are silly questions.

I forgot to mention, this is for a 16F88.

Thanks again for your help.

Sparky.

Nick101
Posts: 339
Joined: 06 Aug 2006 15:32
Location: Texas
Contact:

#4 Post by Nick101 » 31 Mar 2009 02:02

Hi,
You don't have to read 0x16 because reading unsigned varible is already reading 2byte.
Nick
[url]http://www.pic_examples.byethost3.com/[/url]

sparky
Posts: 47
Joined: 06 Jun 2008 04:35
Location: Australia

#5 Post by sparky » 31 Mar 2009 06:53

Hi Nick,

That makes sense. I am not really used to going direct to the address, you've helped me get a step closer to understanding how it works, thanks for that!

Great website by the way!

Sparky.

Post Reply

Return to “mikroC General”