Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

What does this mean?

Status
Not open for further replies.

kylemaes

Banned
PWM mode:
These bits are the two LSbs of the PWM duty cycle. The eight MSbs are found in CCPRxL.

Whats are LSbs and MSbs????
 
That is Least Significant Bits and Most Significant Bits. I think you meant to say that CCPRxL contains the 8 LSB's.

Take an 8-bit binary number, 01101001. The Most Significant Bits are any bits on the left-hand side of the number, while the LSB's are to the right.

So for a 10-bit binary number, 1100101010, the 2 MSB's are the first 2 left-hand-most digits, and the 8 LSB's are the 8 bits to the right.

The first 2 digits go into the 2 MSB's and the last 8 digits go into CCPRxL.
 
Ok, Well that was copied from the datasheet, Anyways I have this code that works perfectly on the PIC16F628A and has the same setup (Registers and order of Configuration) as the PIC16F877A, and it doesnt work on the 877a... It is really confusing me... I think my OSCILLOSCOPE needs more tubes though because it acts weird when testing the Square waves so I just hooked an LED on it and still doesnt work... So basically the 628a works but the 877a doesnt with the same code...
 
Post your code so we can have a look. The CCP modules seem the same between the chips except for the pinout so it probably should work.
 
Post your code so we can have a look. The CCP modules seem the same between the chips except for the pinout so it probably should work.

Instead of thinking "seem the same" go straight to the datasheet and check the whole register related to that.

I would not change from one micro to another without doing that.
 
When seting CCPR1L and CCP1CON(bits 4,5) to control the PWM duty cycle for testing purposes forget about CCP1CON(bits 4,5). i.e. leave them at 0. Now use only CCPR1L to change the duty cycle. You will now only have a single 8-bit register to adjust but you loose granularity. Example: if you set CCPR1L: 0, 1, 2, 3... the corresponding 10-bit value for the duty cycle will be 0, 4, 8, 16...
 
Instead of thinking "seem the same" go straight to the datasheet and check the whole register related to that.

I would not change from one micro to another without doing that.

I did, that's why I said 'seem the same' :)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top