I ready made the source code of my pic project but iam puzzled in completing them. In line with this iam asking for your help in achieving my goal. Iam looking forward with your prompt assistance. Thank you....
here is the circuit
**broken link removed**
and here is my source code..
void routine();
void main()
{
TRISA = 0x1F;
TRISB = 0x00;
PORTB = 0x00;
while(1)
{
if (PORTA.F0 == 0)
{
PORTB.F5 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F3 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F2 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F1 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F0 = 0;
}
}
}
}
}
else if(PORTA.F0 == 1)
PORTB = 0x00;
}
}
void routine()
{
if (PORTA.F2 == 0)
{
PORTB.F0 = 1;
PORTB.F3 = 0;
PORTB.F2 = 0;
PORTB.F1 = 0;
}
if (PORTA.F1 == 0)
PORTB = 0x00;
if (PORTA.F0 == 1)
PORTB = 0x00;
}
this is the scenario of my project....
when you switch on the main switch that is S-ON, the led D1 will on automatically that will last only for 10 second. At this time the RX button must also be switch on within the said time,automatically the led ON will turn-on for a moment.
In 3 minutes the led D1 will turn-on again with the given time which is 10 seconds. If the Rx button wasn't switch, the led W1 will turn-on, still the led ON still function regardless the absence of RX button.
Another 3 minutes same cycle will take into place; the led D1 will turn-on and if again the RX button wasn't turn switch, the led W1 and W2 will turn-on same with the led ON who is still functioning. Same process again, within 3 minutes the led D1 turn-on last for 10 seconds, but if the Rx button was not switch, the led W1, W2 and W3 will function (on) but in this time, the led ON will turn-off automatically due to the presence of the 3 warning leds.
thank you....
here is the circuit
**broken link removed**
and here is my source code..
void routine();
void main()
{
TRISA = 0x1F;
TRISB = 0x00;
PORTB = 0x00;
while(1)
{
if (PORTA.F0 == 0)
{
PORTB.F5 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F3 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F2 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F1 = 1;
if (PORTA.F2 == 1)
{
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
delay_ms(100);
routine();
if(PORTB.F0 == 0)
PORTB.F0 = 0;
}
}
}
}
}
else if(PORTA.F0 == 1)
PORTB = 0x00;
}
}
void routine()
{
if (PORTA.F2 == 0)
{
PORTB.F0 = 1;
PORTB.F3 = 0;
PORTB.F2 = 0;
PORTB.F1 = 0;
}
if (PORTA.F1 == 0)
PORTB = 0x00;
if (PORTA.F0 == 1)
PORTB = 0x00;
}
this is the scenario of my project....
when you switch on the main switch that is S-ON, the led D1 will on automatically that will last only for 10 second. At this time the RX button must also be switch on within the said time,automatically the led ON will turn-on for a moment.
In 3 minutes the led D1 will turn-on again with the given time which is 10 seconds. If the Rx button wasn't switch, the led W1 will turn-on, still the led ON still function regardless the absence of RX button.
Another 3 minutes same cycle will take into place; the led D1 will turn-on and if again the RX button wasn't turn switch, the led W1 and W2 will turn-on same with the led ON who is still functioning. Same process again, within 3 minutes the led D1 turn-on last for 10 seconds, but if the Rx button was not switch, the led W1, W2 and W3 will function (on) but in this time, the led ON will turn-off automatically due to the presence of the 3 warning leds.
thank you....
Last edited: