CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem configuring PWM on 18F67J94

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
btpolo1



Joined: 28 Sep 2016
Posts: 3

View user's profile Send private message

Problem configuring PWM on 18F67J94
PostPosted: Wed Sep 28, 2016 2:49 pm     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Wed Sep 28, 2016 3:09 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 29, 2016 10:42 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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