cellcare
Newbie level 4
- Joined
- Apr 17, 2010
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- uttar pradesh
- Activity points
- 1,328
i am new in microcontroller , my led blinking program PORTA.F1 & PORTA.F2 not work Properly. plz solv my problam.
microcontroller= PIC 16F84A,]
SORCE CODE in mikro c pro,
void main() {
TRISA = 0xff;
TRISB = 0x00 ;
while (1){
if(PORTA.f1==0){
{
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(500);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(500);
PORTB = 0xff;
}
while (1){
if(PORTA.f2==0 ){
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(3000);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(3000);
PORTB = 0xff;
}
}
else
PORTB = 0xff;
}
}
microcontroller= PIC 16F84A,]
SORCE CODE in mikro c pro,
void main() {
TRISA = 0xff;
TRISB = 0x00 ;
while (1){
if(PORTA.f1==0){
{
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(500);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(500);
PORTB = 0xff;
}
while (1){
if(PORTA.f2==0 ){
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0x0f;
delay_ms(150);
PORTB = 0xff;
delay_ms(3000);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(150);
PORTB = 0xf0;
delay_ms(150);
PORTB = 0xff;
delay_ms(3000);
PORTB = 0xff;
}
}
else
PORTB = 0xff;
}
}