diff --git a/source/app/main.c b/source/app/main.c index 7526a85..cc9df98 100644 --- a/source/app/main.c +++ b/source/app/main.c @@ -94,9 +94,6 @@ void L0_main_init(void) L0_uart3_buf_init(); L0_uart4_buf_init(); - //打开系统总中断 - EA = 1; - //系统定时器初始化 L1_tick_init(); L0_timer0_Init(); @@ -118,6 +115,10 @@ void L0_main_init(void) //L3_task_debug_init(); //L3_task_show_init(); //L3_task_reglisten_init(); + + //打开系统总中断 + EA = 1; + L0_uart0_sendArray("v1.3",4); } @@ -154,7 +155,7 @@ void main(void) if(1 == s_nos_tick.t1s_heatbeart) { s_nos_tick.t1s_heatbeart = 0; - // LED0 ^= 1; + LED0 ^= 1; // KR1 ^= 1; // KC1 ^= 1; L0_uart0_uc('.'); @@ -165,20 +166,20 @@ void main(void) } //扫描键盘 - key = bsp_key_scan(); - if(key != BSP_KEY_NUM_MAX){ - L0_uart0_uc('#'); - L0_uart0_uchex(key); - } + // key = bsp_key_scan(); + // if(key != BSP_KEY_NUM_MAX){ + // L0_uart0_uc('#'); + // L0_uart0_uchex(key); + // } - //NFC协议处理 - L3_task_nfc_handler(&_s_task_nfc); + // //NFC协议处理 + // L3_task_nfc_handler(&_s_task_nfc); - //RFID协议处理 - L3_task_rfid_handler(&_s_task_rfid); + // //RFID协议处理 + // L3_task_rfid_handler(&_s_task_rfid); - //RS485协议处理 - L3_task_rs485_handler(&_s_task_rs485); + // //RS485协议处理 + // L3_task_rs485_handler(&_s_task_rs485); //串口调试 // if(ts_uart3_recv_buf.ok == 1){ diff --git a/source/bsp/bsp_key.c b/source/bsp/bsp_key.c index 3e68356..6024f6d 100644 --- a/source/bsp/bsp_key.c +++ b/source/bsp/bsp_key.c @@ -1,6 +1,8 @@ #include "bsp_key.h" #include "bsp_config_delay.h" +U32 timeout = 0x3FFFFF; + U8 bsp_key_init(void) { D_stdIO_P3(BITN6); @@ -43,6 +45,7 @@ void scan_row(U8 r) U8 scan_col(U8 c) { + timeout = 0x3FFFFF; if(c == 1) { if(KC1 == 0) @@ -50,7 +53,7 @@ U8 scan_col(U8 c) delayInMs(10); if(KC1 == 0) { - while(KC1 == 0); + while(KC1 == 0 && timeout--); return 1; } } @@ -61,7 +64,7 @@ U8 scan_col(U8 c) delayInMs(10); if(KC2 == 0) { - while(KC2 == 0); + while(KC2 == 0 && timeout--); return 1; } } @@ -72,7 +75,7 @@ U8 scan_col(U8 c) delayInMs(10); if(KC3 == 0) { - while(KC3 == 0); + while(KC3 == 0 && timeout--); return 1; } } @@ -83,7 +86,7 @@ U8 scan_col(U8 c) delayInMs(10); if(KC4 == 0) { - while(KC4 == 0); + while(KC4 == 0 && timeout--); return 1; } } diff --git a/source/msp/UART0.C b/source/msp/UART0.C index 5de1bfb..2c1f7ae 100644 --- a/source/msp/UART0.C +++ b/source/msp/UART0.C @@ -121,7 +121,8 @@ void INTERRUPT_UART(void) D_SERVE_UART if(L0_uart0_IntRI()) //如果是U0接收中断 { L0_uart0_IntRIClear(); //清除接收中断标志 - ts_uart[uNum0].t->reg = L0_uartN_get(uNum0); + // ts_uart[uNum0].t->reg = L0_uartN_get(uNum0); + ts_uart[uNum0].t->reg = SBUF; if(ts_uart[uNum0].tp_handler != NULL){ ts_uart[uNum0].tp_handler(ts_uart[uNum0].t); } @@ -131,7 +132,8 @@ void INTERRUPT_UART(void) D_SERVE_UART L0_uart0_IntTIClear(); //清除发送中断标志 if(ts_uart[uNum0].p->max != ts_uart[uNum0].p->now) { - L0_uartN_set(uNum0,ts_uart[uNum0].p->p[ts_uart[uNum0].p->now]); + // L0_uartN_set(uNum0,ts_uart[uNum0].p->p[ts_uart[uNum0].p->now]); + SBUF = ts_uart[uNum0].p->p[ts_uart[uNum0].p->now]; ts_uart[uNum0].p->now ++; } else diff --git a/source/msp/UART2.c b/source/msp/UART2.c index 90fd8b0..8bbc8e9 100644 --- a/source/msp/UART2.c +++ b/source/msp/UART2.c @@ -130,7 +130,8 @@ void INTERRUPT_uart2(void) D_SERVE_uart2// using 2 if(L0_uart2_IntRI()) //如果是U2接收中断 { L0_uart2_IntRIClear(); //清除接收中断标志 - ts_uart[uNum2].t->reg = L0_uartN_get(uNum2); + // ts_uart[uNum2].t->reg = L0_uartN_get(uNum2); + ts_uart[uNum2].t->reg = S2BUF; if(ts_uart[uNum2].tp_handler != NULL){ ts_uart[uNum2].tp_handler(ts_uart[uNum2].t); } @@ -140,7 +141,8 @@ void INTERRUPT_uart2(void) D_SERVE_uart2// using 2 L0_uart2_IntTIClear(); //清除发送中断标志 if(ts_uart[uNum2].p->max != ts_uart[uNum2].p->now) { - L0_uartN_set(uNum2,ts_uart[uNum2].p->p[ts_uart[uNum2].p->now]); + // L0_uartN_set(uNum2,ts_uart[uNum2].p->p[ts_uart[uNum2].p->now]); + S2BUF = ts_uart[uNum2].p->p[ts_uart[uNum2].p->now]; ts_uart[uNum2].p->now ++; } else diff --git a/source/msp/UART3.c b/source/msp/UART3.c index 37b015d..874af49 100644 --- a/source/msp/UART3.c +++ b/source/msp/UART3.c @@ -143,7 +143,8 @@ void INTERRUPT_UART3(void) D_SERVE_UART3// using 3 if(L0_uart3_IntRI()) //如果是U3接收中断 { L0_uart3_IntRIClear(); //清除接收中断标志 - ts_uart[uNum3].t->reg = L0_uartN_get(uNum3); + // ts_uart[uNum3].t->reg = L0_uartN_get(uNum3); + ts_uart[uNum3].t->reg = S3BUF; g_uart3_recv_num++; if(ts_uart[uNum3].tp_handler != NULL){ ts_uart[uNum3].tp_handler(ts_uart[uNum3].t); @@ -154,7 +155,8 @@ void INTERRUPT_UART3(void) D_SERVE_UART3// using 3 L0_uart3_IntTIClear(); //清除发送中断标志 if(ts_uart[uNum3].p->max != ts_uart[uNum3].p->now) { - L0_uartN_set(uNum3,ts_uart[uNum3].p->p[ts_uart[uNum3].p->now]); + // L0_uartN_set(uNum3,ts_uart[uNum3].p->p[ts_uart[uNum3].p->now]); + S3BUF = ts_uart[uNum3].p->p[ts_uart[uNum3].p->now]; ts_uart[uNum3].p->now ++; } else diff --git a/source/msp/UART4.C b/source/msp/UART4.C index ef4d775..a73d011 100644 --- a/source/msp/UART4.C +++ b/source/msp/UART4.C @@ -142,8 +142,10 @@ void INTERRUPT_uart4(void) D_SERVE_uart4// using 2 //NOP(); NOP(); NOP(); if(L0_uart4_IntRI()) //如果是U0接收中断 { + LED0 ^= 1; L0_uart4_IntRIClear(); //清除接收中断标志 - ts_uart[uNum4].t->reg = L0_uartN_get(uNum4); + // ts_uart[uNum4].t->reg = L0_uartN_get(uNum4); + ts_uart[uNum4].t->reg = S4BUF; if(ts_uart[uNum4].tp_handler != NULL){ ts_uart[uNum4].tp_handler(ts_uart[uNum4].t); } @@ -153,7 +155,8 @@ void INTERRUPT_uart4(void) D_SERVE_uart4// using 2 L0_uart4_IntTIClear(); //清除发送中断标志 if(ts_uart[uNum4].p->max != ts_uart[uNum4].p->now) { - L0_uartN_set(uNum4,ts_uart[uNum4].p->p[ts_uart[uNum4].p->now]); + // L0_uartN_set(uNum4,ts_uart[uNum4].p->p[ts_uart[uNum4].p->now]); + S4BUF = ts_uart[uNum4].p->p[ts_uart[uNum4].p->now]; ts_uart[uNum4].p->now ++; } else