Rich (BB code):
void priekin()
{
if(PORTA.RA0 == 1 && PORTA.RA1 == 0) //if button is pressed
{
PORTB = 0x03;
Delay_ms(5);
PORTB = 0x06;
Delay_ms(5);
PORTB = 0x0C;
Delay_ms(5);
PORTB = 0x09;
Delay_ms(5);
} else { PORTB = 0x00; }
}
void atgal()
{
if(PORTA.RA1 == 1 && PORTA.RA0 == 0)
{
PORTB = 0x09;
Delay_ms(5);
PORTB = 0x0C;
Delay_ms(5);
PORTB = 0x06;
Delay_ms(5);
PORTB = 0x03; //1 lygu 0 0 lygu 1
Delay_ms(5); //WAIT 1000/1S;
} else { PORTB = 0x00; }
}
void stop()
{
if(PORTA.RA2==1)
{
PORTB = 0x00;
TRISA.RA0 = 0;
TRISA.RA1 = 0;
}
}
void main() //MAIN;
{
TRISB = 0x00; //SET PORTB TO BE OUTPUT;
PORTB = 0x00; //TURN OFF LEDs ON PORTB;
TRISA.RA0 = 1;
TRISA.RA1 = 1;
TRISA.RA2 = 1;
while(1)
{
stop();
atgal ();
priekin ();
}
}
//where is a problem ?
//Code works on Proteus 8 Professional, but dont work in real.
bad project config, code or schematic ?
Write back fast
<SNIP>
Attachments
-
43.2 KB Views: 36
Last edited by a moderator: