|
楼主 |
发表于 2015-12-16 08:18:57
|
显示全部楼层
- void UART2_IRQHandler (void)
- {
- static unsigned char count;
- UART_MemMapPtr uartPtr = UART2_BASE_PTR; /* ·¢ËÍÖжϴ¦Àí³ÌÐò */
- #if UART2_SEND_IRQ /* Óû§¶¨Òå */
- #endif
-
- #if UART2_RECEIVE_IRQ
- if (UART_S1_REG(uartPtr) & UART_S1_RDRF_MASK)
- { /* Çå³ýÖжϱêÖ¾ */
-
- // uart0SendChar ( UART_D_REG(uartPtr));
- tab[count] = UART_D_REG (uartPtr );
- if(tab[count] == 0x01 && count == 0x00)
- {
- count = 1;
- }
- else if(tab[count] == 0x03 && count == 1)
- {
- count = 2;
- }
-
- else if(count >= 2 && count < 8)
- {
- count ++;
- }
- else if(count == 8)
- {
- count = 0;
- // for(i=0;i<8;i++)
- // {
- // uart0SendChar (tab[i]);
- // }
- //printf("size=%d\n",sizeof(tab));
- //datalen = 0x00;
- uart0SendChar (crc16(tab,7)>>8);
- uart0SendChar (crc16(tab,7)&0xff);
-
-
- }
- else
- {
- count = 0;
- //datalen = 0;
- }
-
- }
- #endif
- }
复制代码 |
|