Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to split a 10 bit number

Status
Not open for further replies.

dmta

Member level 2
Member level 2
Joined
Mar 25, 2013
Messages
52
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Earth
Visit site
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,
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
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top