How can I tune the Servo component refresh rate ?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Mathy
Posts: 333
Joined: Mon Oct 05, 2009 2:39 pm
Has thanked: 30 times
Been thanked: 33 times

How can I tune the Servo component refresh rate ?

Post by Mathy »

Hello,

In the RC world, we have now ESC that can accept higher PPM refresh rate than simple servo motor ( 50Hz ).
High end ESC can accept 400Hz input.

How and where can I tune this refresh rate in the custom component ?
I looked into the custom code utility but I don't understand anything.

I think it is about this peace of code but I don't know how the %a, %b and %c value are defined ?
Subsidiary question, how do you call those things ? Arguments right ?

#define MX_SERVO_CCPR1H %a / 2
#define MX_SERVO_CCPR1L %b / 2
#define MX_SERVO_T1CON %c

Thank you for your help.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: How can I tune the Servo component refresh rate ?

Post by Benj »

Hello,

Not 100% sure this will work but changing the defines to this may help.

Code: Select all

#define MX_SERVO_CCPR1H %a / 16
#define MX_SERVO_CCPR1L %b / 16
This basically takes the 50Hz and multiplies the interrupt rate by 8 to give you 400Hz.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: How can I tune the Servo component refresh rate ?

Post by dazz »

HI Mathy
Can you be a bit more specific as to what you need to do as you're wanting to control an ESC, also what esc is it as most rc esc's use pwm input. is the Uc going to control the esc or do you want to control it with a pot ect

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply