TX_Buffer TO TRANSMIT 1 BYTE ONLY

Thread Starter

embed_v

Joined Aug 30, 2010
24
hii

this is about to send the sring to tx buffer but i want to send only one byte .

so any guidence to impliment this... plzzzz help

and the command is like this :(this is only 1 case for better understanding )

case CMD_READ_O_SENSORS: //...>0x10
Write_To_TX_Buffer((GPIO_PORTA_DATA_R & (OS1_IN | OS2_IN | OS3_IN)) >> 3);
err=ERR_SUCCESS;
break;
and the tx buffer code want to be modified in as follow:
void Write_To_TX_Buffer(unsigned char str)
{

while (str != '\0') {
/* If the TX ring buffer is full, wait until hardware FIFO has a spot
* available then put the next entry in the ring buffer into the FIFO.
* Update the head ptr. */
// if (((tx_buff_tail + 1) % TX_BUFF_LEN) == tx_buff_head)
// {
// while (UART0_FR_R & UART_FR_TXFF) {}
if (!(UART0_FR_R & UART_FR_TXFF) && (tx_buff_head == tx_buff_tail ) ) //Check tx fifo is empty
{
UART0_DR_R = tx_buff[tx_buff_head];
tx_buff_head = (tx_buff_head + 1) % TX_BUFF_LEN;
}

/* We know we have at least one spot available in the ring buffer,
* so lets place the next character into it, and update the tail ptr.
*/
tx_buff[tx_buff_tail] = str++;
tx_buff_tail = (tx_buff_tail + 1) % TX_BUFF_LEN;
}
/* Enable the UART0 TX Interrupt. */
UART0_IM_R |= UART_IM_TXIM;
 
Top