Quote:
|
Originally Posted by Alan Anderson
Whenever you want to do processing on operator input (filtering, desensitizing, delta-coding, etc.), it makes the most sense to do it only when new values are available. I would definitely put it in user_routines.c, in the Process_Data_From_Master_uP() function.
|
What i would do is make a function that adjusts the value of the joystick depending on the input..
Code:
unsigned char Dead_Band(unsigned char input_value)
{
unsigned char Output = 127;
if (input_value < Dead_Band_Forward)
{
if(input_value > Dead_Band_Reverse)
{
Output = 127;
}
else
{
Output = input_value;
}
}
else if(input_value > Dead_Band_Forward)
{
Output = input_value;
}
return Output;
}
Then i would use that in the
user_routines.c file under the
Default_Routine() function as your output value to whatever PWM you want it to output in.
Code:
void Default_Routine(void)..........
pwm01 = Dead_Band(p1_y);
pwm02 = Dead_Band(p2_y);