nadre25
Member level 3
HI, i have a problem creating this kind of waveform in PIC16F877A
my code only got the waveform until the vertical line.
here's my code:
while(1)
{
pwmplus=10;
for(lvl=0;lvl<=8;lvl++)
{
Pwm1_Change_Duty(unsign_pwm+pwmplus);
Delay_ms(1);
pwmplus=pwmplus+10;
}
}
when i add:
pwmplus=80;
for(lvl=0;lvl<=8;lvl++)
{
Pwm1_Change_Duty(unsign_pwm-pwmplus);
Delay_ms(1);
pwmplus=pwmplus-10;
if(lvl==8)
{
Pwm1_Change_Duty(0);
}
}
it got an error.
can you help me with the code so that i could create the waveform above? thanks!
my code only got the waveform until the vertical line.
here's my code:
while(1)
{
pwmplus=10;
for(lvl=0;lvl<=8;lvl++)
{
Pwm1_Change_Duty(unsign_pwm+pwmplus);
Delay_ms(1);
pwmplus=pwmplus+10;
}
}
when i add:
pwmplus=80;
for(lvl=0;lvl<=8;lvl++)
{
Pwm1_Change_Duty(unsign_pwm-pwmplus);
Delay_ms(1);
pwmplus=pwmplus-10;
if(lvl==8)
{
Pwm1_Change_Duty(0);
}
}
it got an error.
can you help me with the code so that i could create the waveform above? thanks!