void USART3_IRQHandler(void)
{
u8 i;
if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET)
{
USART_ClearITPendingBit(USART3,USART_IT_RXNE);
tn_num[key_num++] = USART_ReceiveData(USART3);
if(tn_num[key_num-1]==0xf1)
{
key_num=1;
tn_num[0]=0xf1;
}
else if(tn_num[key_num-1]==0xf2)
{
if((tn_num[1]==0xe2)&&(tn_num[23]==playnumsend))
{
for(i=0;i<26;i++)
{
USART_SendData(USART1, tn_num[i]);
}
if(play_state!=tn_num[22])
{
if(tn_num[22]==1){disp_state=7;disp_code=0;}
else if(tn_num[22]==10){if(print_sn==1){disp_state=10;disp_code=0;}}
if((play_state!=4)&&(play_state!=5)&&(tn_num[22]==4))
{
disp_state=11;disp_code=0;
}
}
if(yf_time!=tn_num[21])
{
yf_time=tn_num[21];
LCD_disp_num(18,1,yf_time%100/10);
LCD_disp_num(19,1,yf_time%10);
}
play_state=tn_num[22];
re_delay=0;
}
else if((tn_num[1] ==0xe3))
{
win_odds = tn_num[2];//ÅâÂÊ
all_in=tn_num[3]*1000000+tn_num[4]*10000+tn_num[5]*100+tn_num[6];
all_out=tn_num[7]*1000000+tn_num[8]*10000+tn_num[9]*100+tn_num[10];
w_year_tp = tn_num[16]*100+tn_num[17];
w_month_tp= tn_num[18];
w_date_tp= tn_num[19];
w_hour_tp= tn_num[20];
w_minute_tp= tn_num[21];
if(machine_code==100)
{
USART_SendData(USART3, 0xa1);
USART_SendData(USART3, read_fpga(0));
USART_SendData(USART3, read_fpga(1));
USART_SendData(USART3, read_fpga(2));
if(print_sn==1)start_printb();
machine_code=0;
}
}
else if((tn_num[1]==0xe4))
{
receive_ok=1;
USART_SendData(USART3, 0xa2);
for(i=2;i<102;i++)
{
card_rank[i-1]=tn_num[i];
}
w_year_tp = tn_num[102]*100+tn_num[103];
w_month_tp= tn_num[104];
w_date_tp= tn_num[105];
w_hour_tp= tn_num[106];
w_minute_tp= tn_num[107];
run_rs= tn_num[108];
rom[0]=tn_num[102];
rom[1]=tn_num[103];
rom[2]=tn_num[104];
rom[3]=tn_num[105];
rom[4]=tn_num[106];
rom[5]=tn_num[107];
SPI_write_FM25CL64(rom,45,6);
re_delay=0;
}
else if((tn_num[1]==0xe5))
{
re_delay=0;
}
else if((tn_num[1]==0xe6))
{
all_in=tn_num[2]*1000000+tn_num[3]*10000+tn_num[4]*100+tn_num[5];
all_out=tn_num[6]*1000000+tn_num[7]*10000+tn_num[8]*100+tn_num[9];
key_in=tn_num[10]*1000000+tn_num[11]*10000+tn_num[12]*100+tn_num[13];
key_out=tn_num[14]*1000000+tn_num[15]*10000+tn_num[16]*100+tn_num[17];
coin=tn_num[18]*1000000+tn_num[19]*10000+tn_num[20]*100+tn_num[21];
pay_out=tn_num[22]*1000000+tn_num[23]*10000+tn_num[24]*100+tn_num[25];
all_bet=tn_num[26]*1000000+tn_num[27]*10000+tn_num[28]*100+tn_num[29];
all_win=tn_num[30]*1000000+tn_num[31]*10000+tn_num[32]*100+tn_num[33];
my_win=tn_num[34]*1000000+tn_num[35]*10000+tn_num[36]*100+tn_num[37];
bouns_num=tn_num[38]*1000000+tn_num[39]*10000+tn_num[40]*100+tn_num[41];
}
else if((tn_num[1]==0xe7))
{
all_in=tn_num[2]*1000000+tn_num[3]*10000+tn_num[4]*100+tn_num[5];
all_out=tn_num[6]*1000000+tn_num[7]*10000+tn_num[8]*100+tn_num[9];
coin=tn_num[10]*1000000+tn_num[11]*10000+tn_num[12]*100+tn_num[13];
pay_out=tn_num[14]*1000000+tn_num[15]*10000+tn_num[16]*100+tn_num[17];
all_bet=tn_num[18]*1000000+tn_num[19]*10000+tn_num[20]*100+tn_num[21];
all_win=tn_num[22]*1000000+tn_num[23]*10000+tn_num[24]*100+tn_num[25];
for(i=0;i<8;i++)
{
play_bet[i][0]=tn_num[26+i*16]*1000000+tn_num[27+i*16]*10000+tn_num[28+i*16]*100+tn_num[29+i*16];
play_bet[i][1]=tn_num[30+i*16]*1000000+tn_num[31+i*16]*10000+tn_num[32+i*16]*100+tn_num[33+i*16];
play_bet[i][2]=tn_num[34+i*16]*1000000+tn_num[35+i*16]*10000+tn_num[36+i*16]*100+tn_num[37+i*16];
play_bet[i][3]=tn_num[38+i*16]*1000000+tn_num[39+i*16]*10000+tn_num[40+i*16]*100+tn_num[41+i*16];
}
}
else if((tn_num[1]==0xe8))
{
for(i=2;i<102;i++)
{
card_rank[i-1]=tn_num[i];
}
bd_print();
re_delay=0;
}
}
if(key_num>=160)key_num=0;
}
}
这个是我的串口3的中断接收程序 |