Пример #1
0
t_uint8 _Device_Uart_Module_1_Send_Bytes(unsigned char *sendByte, unsigned int length){
	unsigned int i;

//    if(Usart_Peripheral_Enable_Flag == DeviceOff){
//        return Func_Fail;
//    }

	for(i = 0; i < length; i++){
		SendingWhileTimeOutCount = 0;
        //confirm TX buffer is ready first, USCI_A1 TX buffer ready?
        while (!USCI_A_UART_getInterruptStatus(UART_Module_1_USCI_A_BASEADDRESS, USCI_A_UART_TRANSMIT_INTERRUPT_FLAG)){
            __no_operation();
			if(SendingWhileTimeOutCount >= Uart_Module_1_SendingTimeOutCycle){
				break;
			}
			SendingWhileTimeOutCount++;
        }

        //Transmit data
        USCI_A_UART_transmitData(UART_Module_1_USCI_A_BASEADDRESS, (*(sendByte + i)));
    }
    __no_operation();

    return Func_Success;
}
Пример #2
0
void PC_USCI_A0_UART_string_transmitData(uint8_t *str){
	do{
        while(!USCI_A_UART_getInterruptStatus(USCI_A0_BASE,
                                              USCI_A_UART_TRANSMIT_INTERRUPT_FLAG))
        {
            ;
        }
		USCI_A_UART_transmitData(USCI_A0_BASE,*str);
	}while(*str++);
}
Пример #3
0
void PC_USCI_A0_UART_alldata_transmitData(uint8_t *str, int size){

	do{
        while(!USCI_A_UART_getInterruptStatus(USCI_A0_BASE,
                                              USCI_A_UART_TRANSMIT_INTERRUPT_FLAG))
        {
            ;
        }
		USCI_A_UART_transmitData(USCI_A0_BASE,*str);
		str++;
	}while(--size);
}
Пример #4
0
/*普通船体基础上上加有结束符*/
void USCI_A1_UART_screen_string_transmitData(uint8_t *str){
	int8_t i = 3;

	do{
		while(!USCI_A_UART_getInterruptStatus(USCI_A1_BASE,
				                                              USCI_A_UART_TRANSMIT_INTERRUPT_FLAG))
		{
			;
		}
		USCI_A_UART_transmitData(USCI_A1_BASE,*str);
	}while(*(++str));

	while(i--){
		while(!USCI_A_UART_getInterruptStatus(USCI_A1_BASE,
		                                              USCI_A_UART_TRANSMIT_INTERRUPT_FLAG))
		{
			;
		}
		USCI_A_UART_transmitData(USCI_A1_BASE,0xff);
	};
}
static inline void uart_tx_isr(void)
{
	if (_txBuf.head == _txBuf.tail) {     //No data need to transmit.
		USCI_A_UART_disableInterrupt(USCI_A1_BASE,
                                     USCI_A_UART_TRANSMIT_INTERRUPT); // Disable interrupt
		UCA1IFG |= UCTXIFG;    // Set Flag again
		return;
	}

	unsigned char data = _txBuf.buf[_txBuf.tail];
	_txBuf.tail = (_txBuf.tail + 1) % UART_BUFFER_SIZE;
	USCI_A_UART_transmitData(USCI_A1_BASE, data);
}