|
|
View previous topic :: View next topic |
Author |
Message |
btpolo1
Joined: 28 Sep 2016 Posts: 3
|
Problem configuring PWM on 18F67J94 |
Posted: Wed Sep 28, 2016 2:49 pm |
|
|
We are using the 18F67J94 for a project, and we would like to do PWM on pins RD1 and RD2. The PWM is separate for each pin. When we try to build our software, I keep getting "Option invalid :: P1D not assigned, use #PIN_SELECT". I put a shorten copy of what we are trying to do below:
Code: |
#fuses NOIESO, CKSNOFSM, NOCLOCKOUT, WDT_SW, WDT256, NOPROTECT, BROWNOUT_SW, BORV20
#define P1D PIN_D1
#define P1C PIN_D2
void main (void) {
setup_wdt(WDT_OFF)
set_tris_d(0x00);
output_high(PIN_D1);
setup_ccp1(CCP_PWM_L_L | CCP_PULSE_STEERING_D); // Option invalid on this line ???
setup_timer_2(T2_DIV_BY_16, 217, 1);
set_pwm1(44L);
while (TRUE) {
restart_wdt();
}
|
Reading through the forums and documentation, I can't figure out how to resolve the definitions for P1A, P1B, P1C, or P1D.
We are using the following compiler version: 5.051
Thanks |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Wed Sep 28, 2016 3:09 pm |
|
|
If you look at the examples, you will find they do one setting up the PWM on a chip with #PIN SELECT.
Have a look at this, and then the first few lines of the include file for the processor, which lists all the 'selectable' peripheral names.
Come back if you still can't get it. |
|
|
btpolo1
Joined: 28 Sep 2016 Posts: 3
|
|
Posted: Thu Sep 29, 2016 10:42 am |
|
|
Okay I was able to figure it out. I finally determined how to decode Table 11-14 in the chip documentation.
I did the following:
Code: | #pin_select P1C=PIN_D1
#pin_select P1B=PIN_D2 |
Thanks. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|