Jump to content
Mac

Using Ccpr1 As 16-bit ?

Recommended Posts

I see a definition for 'ccpr1' in the '2620 header file but I can't seem to use it as a 16-bit 'INT'. What am I doin' wrong Gentlemen?

 

   unsigned int match = 2400;

.....

  ccpr1 = match;			// <-- error
  match <<= 1;			  //

Edited by Mac

Share this post


Link to post
Share on other sites

Hi Mac,

 

Although ccpr1 is a 16 bit register, it is formed using two 8 bit registers ccpr1h and ccpr1l. You have to load both bytes individually. You could write a macro to make it look like a 16 bit value you were loading.

 

These are afterall 8 bit processors.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites
Hi Mac,

 

Although ccpr1 is a 16 bit register, it is formed using two 8 bit registers ccpr1h and ccpr1l. You have to load both bytes individually. You could write a macro to make it look like a 16 bit value you were loading.

 

These are afterall 8 bit processors.

 

Cheers

 

Reynard

 

I'm just looking for the same capability that I get with MCC18. Being able to access register pairs as CCPR1, CCPR2, INDF0, and FSR0 seems very clean and intuitive (to me).

 

Kind regards, Mike

Edited by Mac

Share this post


Link to post
Share on other sites
I'm just looking for the same capability that I get with MCC18. Being able to access register pairs as CCPR1, CCPR2, INDF0, and FSR0 seems very clean and intuitive (to me).

 

Piece of cake:

 

volatile unsigned short ccpr1 @ 0xFBE;
ccpr1 = 2400;

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Nice solution.

 

I didn't spot that in the manual for consecutively addressed register pairs.

 

Always learning.

 

Regards

 

Reynard

Share this post


Link to post
Share on other sites
I'm just looking for the same capability that I get with MCC18. Being able to access register pairs as CCPR1, CCPR2, INDF0, and FSR0 seems very clean and intuitive (to me).

 

Piece of cake:

 

volatile unsigned short ccpr1 @ 0xFBE;
ccpr1 = 2400;

 

Regards,

Pavel

Ah, thank you...

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...