Код
USHORT H = 23;
USHORT M = 31;
USHORT S = 40;
USHORT fi, se, th, fo;
bit FuncEnabled = 0;
char SetCountCommand[7] = {':','1','3','4','6','/'};
bit setTimeFunctionEnabled = 0;
interrupt [TIM1_OVF] void timer1_ovf_isr(void)
{
TCNT1=57723;//57723
if (S!=59){
S++;
} else {
S=0;
M++;
}
if (M==60){
M=0;
H++;
}
if (H==24){
H=0;
}
//PAINT(M/10, M%10, S/10, S%10);
if (FuncEnabled!=1){
SetCountCommand[1]=M/10+48;
SetCountCommand[2]=M%10+48;
SetCountCommand[3]=S/10+48;
SetCountCommand[4]=S%10+48;
puts(SetCountCommand);
} else {
;
}
}
void scanCP(void)
{
USHORT pos = 1;
while(1){
if (setTimeFunctionEnabled){
while(1){ //Программа работает идеально до появления этого цикла
if (PINB==0b11110111){ //JoyUp //Наличие с содержимое кода на ситуацию никак не влияют
if (pos==1){
fi++;
SetCountCommand[1]=fi;
puts(SetCountCommand);
}
}
};
}
if (PINB==0b11111011){
FuncEnabled = 1;
setTimeFunctionEnabled = 1;
while(PINB==0b11111011){};
}
};
}