Full duplex serial communication with a laptop using ATMEGA8 USART

atmegacommunicationserialusart

Can anyone please tell me how to use ATMEGA8's USART to establish a full duplex serial communication with a laptop using a USB-to-Serial Adapter.

I am working on a project in which I need to display accelerometer reading in a gui. But the problem is I want to start sending the accelerometer data to laptop only when i send a character 's' to my ATMEGA8, which will then initiate continuous transfer of Accelerometer reading to the laptop. Also during this process, I want to send another character 't' to ATMEGA8 to stop the accelerometer data transfer.

Please help…

Thanks.

Best Answer

Your question doesn't really fit the guidelines, I don't think...

Here's some pseudo code, implementation is left to the student:

if got 's', do loop

loop{
send_accel_data();
check_for_char(t);
if 't', break
}

It's easier if you have the sending and receiving interrupt driven, if your project is more complicated.