hello
I did the programming in hi-tech language ,the project is 7 segment in sw1 the 7 segment work from 0 to 9 and in sw2 the 7 segment work from 9 to 0 ,
the question is : if push on sw2 the seven segment working in the the 7 segment working I want push sw1 go to in function for sw1 ,is mean stop the function sw2 ?
I did the programming in hi-tech language ,the project is 7 segment in sw1 the 7 segment work from 0 to 9 and in sw2 the 7 segment work from 9 to 0 ,
the question is : if push on sw2 the seven segment working in the the 7 segment working I want push sw1 go to in function for sw1 ,is mean stop the function sw2 ?
Code:
#include<htc.h>
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & BOREN_OFF & LVP_OFF);
#define _XTAL_FREQ 20000000
#define sw1 RB1
#define sw2 RB2
void main (void)
{
TRISD =0x00;
PORTD =0x00;
TRISB1 =1;
TRISB2 =1;
while(1)
{
if(sw1==0)
{
line1:
PORTD =0b00111111;
__delay_ms(1000); //0
PORTD =0b00000110;
__delay_ms(1000); //1
PORTD =0b01011011; //2
__delay_ms(1000);
PORTD =0b01001111; //3
__delay_ms(1000);
PORTD =0b01100110; //4
__delay_ms(1000);
PORTD =0b01101101; //5
__delay_ms(1000);
PORTD =0b01111101; //6
__delay_ms(1000);
PORTD =0b00000111; //7
__delay_ms(1000);
PORTD =0b01111111; //8
__delay_ms(1000);
PORTD =0b01101111; //9
__delay_ms(1000);
if(sw2==0)
{
goto line2;
};
}
else if (sw2==0)
{
line2:
PORTD =0b01101111;
__delay_ms(1000); //9
PORTD =0b01111111;
__delay_ms(1000); //8
PORTD =0b00000111; //7
__delay_ms(1000);
PORTD =0b01111101; //6
__delay_ms(1000);
PORTD =0b01101101; //5
__delay_ms(1000);
PORTD =0b01100110; //4
__delay_ms(1000);
PORTD =0b01001111; //3
__delay_ms(1000);
PORTD =0b01011011; //2
__delay_ms(1000);
PORTD =0b00000110; //1
__delay_ms(1000);
PORTD =0b00111111; //0
__delay_ms(1000);
if(sw1==0)
{
goto line1;
};
}
}
}