Jump to content

Recommended Posts

Posted

Hi there!

Does anyone can give a C code example on how to use the "free to use" pins like J10 SO and RC?

I'm using X-code and I would like to use these pins to do a PWM signal to control a servo. For a servo it's not real PWM signal but rather a high state during between 1 millisecond (0%) and 2 milliseconds (100%). As the DIN registers are refreshed only once per millisecond it's not precise enough for me. I hope that by using a timer and these pins I should be precise enough without having a code too heavy.

Thanks in advance!

Baptistou

Posted

if (PORTCbits.RC5) {

  // pin is high do something

} else {

  // pin is low do something else

}

Remember to set the pin directions before using them as in/outputs.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...