Hi to all
I need all of your help!
I am still learning to use PIC (newbie user) and am using CCS C
I will share one code but that code not for me.
I wrote some codes but i dont want use this code i mean i cant completed
I want the prepare simple circuit with pic 16F877A and when i was press to one button, first led starts blinking but when i was press to another button for another led, first led never stop and second led never starts to blinking. How can reach this problem? If possible, could you help me ?
Thank you very much for everythink
Not: My english not very well
Code:
I need all of your help!
I am still learning to use PIC (newbie user) and am using CCS C
I will share one code but that code not for me.
I wrote some codes but i dont want use this code i mean i cant completed
I want the prepare simple circuit with pic 16F877A and when i was press to one button, first led starts blinking but when i was press to another button for another led, first led never stop and second led never starts to blinking. How can reach this problem? If possible, could you help me ?
Thank you very much for everythink
Not: My english not very well
Code:
Code:
#include <16f877A.h>
#use delay(CLOCK=4000000)
#use fast_io(b)
#use fast_io(a)
#fuses XT,NOPUT,NOPROTECT,NOBROWNOUT,NOLVP,NOWDT
int i=0;
void main()
{ set_tris_b(0xf8);
set_tris_a(0x00);
output_b(0x00);
output_a(0x00);
while(true)
{ if(input(pin_b7) && i==0)
{ i=1;
output_high(pin_b2);
delay_ms(6000);
output_low(pin_b2);
}
if(input(pin_b6) && i==0)
{ i=1;
output_high(pin_b1);
delay_ms(3000);
output_low(pin_b1);
}
if(input(pin_b5) && i==0)
{ i=1;
output_high(pin_b0);
delay_ms(1500);
output_low(pin_b0);
}
if(input(pin_b4) && i==0)
{ i=1;
output_high(pin_a1);
delay_ms(3000);
output_low(pin_a1);
}
if(input(pin_b3) && i==0)
{ i=1;
output_high(pin_a0);
delay_ms(6000);
output_low(pin_a0);
}
if(!input(pin_b3)&& !input(pin_b4)&& !input(pin_b5)&& !input(pin_b6)&& !input(pin_b7))
{ i=0; }
}
}
Last edited: