isolde
Newbie level 3
Hi I was just wondering is ther anyway in C code I can control the duty cycle of this code:
If ((input(PIN_A2) == 0)&& (input(PIN_A3) == 0))
{
output_low(PIN_C0);
delay_us(2000);
output_high(PIN_C0);
delay_us(1500);
output_low(PIN_C0);
}
else if ((input(PIN_A2) == 0) && (input(PIN_A3) == 1))
{
output_low(PIN_C0);
delay_us(2000);
output_high(PIN_C0);
delay_us(1000);
output_low(PIN_C0);
}
This code acts as a PWM signal and sends the signals I need out. If anyone code give me a idea how to drop the duty cyle by 50% it would be appreciated the signals travels from 0-5V.
If ((input(PIN_A2) == 0)&& (input(PIN_A3) == 0))
{
output_low(PIN_C0);
delay_us(2000);
output_high(PIN_C0);
delay_us(1500);
output_low(PIN_C0);
}
else if ((input(PIN_A2) == 0) && (input(PIN_A3) == 1))
{
output_low(PIN_C0);
delay_us(2000);
output_high(PIN_C0);
delay_us(1000);
output_low(PIN_C0);
}
This code acts as a PWM signal and sends the signals I need out. If anyone code give me a idea how to drop the duty cyle by 50% it would be appreciated the signals travels from 0-5V.