dmta
Member level 2
- Joined
- Mar 25, 2013
- Messages
- 52
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Earth
- Activity points
- 1,650
Hi all,
This is regarding the PWM module of a pic16f876a micro.
I have a 10 bit number (int) and have to extract the first 8 MSBs and store them in a register called "CCPR1H" and take the remaining 2 LSBs and store them in CCP1CON<5:4>. How do I go about doing this? (I am using MikroC pro for pic 5.61)
Regards
- - - Updated - - -
So I started using this where "kk" is my 10bit number,
I there a better way of doing this?
Regards
This is regarding the PWM module of a pic16f876a micro.
I have a 10 bit number (int) and have to extract the first 8 MSBs and store them in a register called "CCPR1H" and take the remaining 2 LSBs and store them in CCP1CON<5:4>. How do I go about doing this? (I am using MikroC pro for pic 5.61)
Regards
- - - Updated - - -
So I started using this where "kk" is my 10bit number,
Code:
k = kk;
k = k>>2;
CCPR1L = k;
k = kk;
k = k<<6;
k = k + 0b1100;
CCP1CON = k;
I there a better way of doing this?
Regards