What is the significance of CCPR1Lbits.CCPR1L ?

What is the significance of CCPR1Lbits.CCPR1L ?

Postby HKPhysicist » Tue Apr 20, 2021 5:45 pm

Dear all PIC experts,
I came across an exercise which uses CCP PWM to control a DC motor. Part of the codes are:
Code: Select all
CCPR1Lbits.CCPR1L = 192;
CCPR2Lbits.CCPR2L = 0;


What is the function and significance of them? I can't find any complete explanation of them in MPLAB X IDE and my book.

Thanks for your help. :)
User avatar
HKPhysicist
 
Posts: 16
Joined: Wed Feb 24, 2021 5:53 am

Re: What is the significance of CCPR1Lbits.CCPR1L ?

Postby Roche » Wed Apr 21, 2021 5:15 pm

Read the data sheet for the device - it will tell you about the PWM registers.
Roche
 
Posts: 65
Joined: Fri Jul 11, 2014 12:35 pm
PIC experience: Professional 5+ years with MCHP products

Re: What is the significance of CCPR1Lbits.CCPR1L ?

Postby AussieSusan » Fri Apr 23, 2021 3:20 am

As @Roche says, you are looking at the wrong document.
MPlab X is the IDE (think editor) which means that it can be used across (nearly) all MCUs.
XC8, XC16 and XC32 (plus others) are the compilers. Each has its own user guide etc that describes the language features, differences and extensions etc..
Each MCU has a specific data sheet that describes the combination of memory, modules etc. in that device. The data sheet specifies exactly what is in that MCU but not necessarily how to use it.
The Family Reference Manual is a set of documents that describe in detail the various components and modules that a family of devices has. Note that an FRM section (document) may describe some functionality of a module that is not implemented in a specific MCU so you need to check back to the MCU for that detail. The FRM also can contain more examples than the data sheet (but this depends on the overall family - PIC12/16/18 tend to have details in the data sheet while PIC24/dsPIC33 and PIC32 have the examples more in the FRM).
All information is generally in one of the manuals but you need to know which is the best one to look at for a particular question - experience helps a lot.
Susan
AussieSusan
Verified identity
 
Posts: 156
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: What is the significance of CCPR1Lbits.CCPR1L ?

Postby HKPhysicist » Fri Apr 23, 2021 8:24 am

Susan,
You explain better than many so-called experts! Thanks!
User avatar
HKPhysicist
 
Posts: 16
Joined: Wed Feb 24, 2021 5:53 am


Return to CCP, ECCP and PWM

Who is online

Users browsing this forum: No registered users and 3 guests