View previous topic :: View next topic |
Author |
Message |
Totice4
Joined: 08 Jul 2018 Posts: 3
|
Help: CCP2 Problem |
Posted: Sun Jul 08, 2018 10:13 pm |
|
|
HI, i am new member. Sorry but my English is not good.
Now i am controlling driver motor with 2 status:
1. CW: Pin C1: H; Pin B3: PWM
2. CCW: Pin C1: PWM, Pin B3: H
ps: ccp1 i used to another motor,
I read datasheet, CCP2 can output as C1 or B3 if change bit CCP2MX (0c300005), but in CCS, i cant change it.
I used "#Fuse CCP2C1" or "#Fuse CCP2B3". But i cant change it again in main program.
So, What should i do now? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 08, 2018 10:15 pm |
|
|
1. What is your PIC ?
2. Are you using a bootloader ? |
|
|
Totice4
Joined: 08 Jul 2018 Posts: 3
|
|
Posted: Sun Jul 08, 2018 10:18 pm |
|
|
PCM programmer wrote: | 1. What is your PIC ?
2. Are you using a bootloader ? |
Sorry, my pic is 18F46k20,
i did not use bootloader |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Mon Jul 09, 2018 12:17 am |
|
|
Unfortunately, you are misunderstanding the data sheet.
Not a CCS limitation, but a limitation of the chip. CCP2 can be moved to C1 or B3, but only as a chip configuration change (fuse), not as a 'program' (runtime) change.
The ECCP (CCP1), can be software configured to give outputs on the P1A, B, C or D pins in software. Use these pins instead if you want a steerable PWM.
You can't go changing fuses at runtime. First the processor has to stop while a fuse is written, and second they have a limited life for changes. You'll kill the chip if this is done every time you change the motor direction..... |
|
|
Totice4
Joined: 08 Jul 2018 Posts: 3
|
|
Posted: Mon Jul 09, 2018 2:53 am |
|
|
Ttelmah wrote: | Unfortunately, you are misunderstanding the data sheet.
Not a CCS limitation, but a limitation of the chip. CCP2 can be moved to C1 or B3, but only as a chip configuration change (fuse), not as a 'program' (runtime) change.
The ECCP (CCP1), can be software configured to give outputs on the P1A, B, C or D pins in software. Use these pins instead if you want a steerable PWM.
You can't go changing fuses at runtime. First the processor has to stop while a fuse is written, and second they have a limited life for changes. You'll kill the chip if this is done every time you change the motor direction..... |
thanks for reply. It is the best answer for me. |
|
|
|