ud23
Advanced Member level 3

hi all i want to do some simple program want send char 'a' only one time not continuous on UART of atmega 8535
i am using this function for sending data but it sending continuous 'a' on hyper when some switch press
i want to send just one time when switch press.Is there any flag bit to stop continuous transmit.
Code:
void USARTWriteChar(char data)
{
//Wait untill the transmitter is ready
while(!(UCSRA & (1<<UDRE)));
//{
//Do nothing
//}
//Now write the data to USART buffer
UDR = data;
}
i am using this function for sending data but it sending continuous 'a' on hyper when some switch press
i want to send just one time when switch press.Is there any flag bit to stop continuous transmit.