Author Topic: PWM  (Read 1608 times)

0 Members and 1 Guest are viewing this topic.

Offline g44Topic starter

  • Jr. Member
  • **
  • Posts: 38
  • Helpful? 0
PWM
« on: April 04, 2010, 12:57:49 PM »
PWM ......
« Last Edit: May 05, 2010, 06:39:05 AM by g44 »

Offline g44Topic starter

  • Jr. Member
  • **
  • Posts: 38
  • Helpful? 0
Re: PWM
« Reply #1 on: April 04, 2010, 09:39:52 PM »
PWM ......
« Last Edit: May 05, 2010, 06:39:47 AM by g44 »

Offline g44Topic starter

  • Jr. Member
  • **
  • Posts: 38
  • Helpful? 0
Re: PWM
« Reply #2 on: April 08, 2010, 04:08:45 PM »
PWM ......
« Last Edit: May 05, 2010, 06:40:21 AM by g44 »

Offline corrado33

  • Supreme Robot
  • *****
  • Posts: 611
  • Helpful? 11
Re: PWM
« Reply #3 on: April 12, 2010, 09:09:47 AM »
What "number" are you looking for.  The letters like CCAP3H are registers.  The numbers like 64, and 66 set certain "bits" on or off in the register.  For example, 66 really means 01100110.  (I think).  So if you look at the datasheet for the CCAPM3 register (pg 58) you can see that that statement sets bit 7 to 0, bit 6(ECOMn) to 1, bit 5(CAPPn) to 1, bit 4(CAPNn) to 0.  The same goes for the other four bits in that register. (I didn't feel like writing them out.)  You can also see that PWM is turned ON by setting that bit (bit 1) to "1" or ON. 

P0 and P1 are variables, however P0 is not set anywhere in the code you posted, and P1 is not used anywhere in the code you posted. 

If you are confused about how to decide which bits to set to 1, and which to leave at 0, then you have to read the datasheet some more.  It's all in there, you just have to figure out where to find it. 

 


Get Your Ad Here