修改后的发送函数代码片段
- // 在启动发送时,正确设置中断使能位
- if (uartc0_mode_flag == 0) {
- uartc0_mode_flag = 1;
- Ram_debug(0xF3);
- USARTC0_CTRLA = 0x04; // 设置中断优先级(根据实际需求)
- USARTC0_CTRLB = 0x28; // TXEN (0x08) + UDRIE (0x20),使能发送和中断
- asm volatile("CLI");
- USARTC0_DATA = uartc0_tx_buff[uartc0_tx_sp];
- uartc0_tx_sp++;
- if (uartc0_tx_sp >= cUartcBuff0) {
- uartc0_tx_sp = 0;
- }
- uartc0_tx_buff_len--;
- asm volatile("SEI");
- }
|