danyel
Junior Member level 1
- Joined
- Jan 29, 2010
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- dar es salaam
- Activity points
- 1,371
please help me, I have to Dim an AC lamp using Micro-controller, but insteady of dimming, it is blinking, my circuit connection involves PIC,zero crossing detector and lamp connection. and am using mikro c codes below. where is the problem
can you help me please.....
unsigned Duty=0;
void InitMain()
{
TRISC=0x00;
PORTC=0x00;
PWM1_Init(5000);
}
void main()
{
InitMain();
//PWM1_Start();
while(1)
{
if (Duty==0)
{
PWM1_Start();
for (Duty=0;Duty<=255;Duty++)
{
PWM1_Set_Duty(Duty);
//Delay_ms (50);
}
}
Duty=255;
if (Duty==255)
{
PWM1_Start();
for (Duty=255;Duty>=0;Duty--)
{
PWM1_Set_Duty(Duty);
//Delay_ms (50);
}
}
can you help me please.....
unsigned Duty=0;
void InitMain()
{
TRISC=0x00;
PORTC=0x00;
PWM1_Init(5000);
}
void main()
{
InitMain();
//PWM1_Start();
while(1)
{
if (Duty==0)
{
PWM1_Start();
for (Duty=0;Duty<=255;Duty++)
{
PWM1_Set_Duty(Duty);
//Delay_ms (50);
}
}
Duty=255;
if (Duty==255)
{
PWM1_Start();
for (Duty=255;Duty>=0;Duty--)
{
PWM1_Set_Duty(Duty);
//Delay_ms (50);
}
}