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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...