Processing Codes and Setup
Project Source Code
###
*******************C Program****************** /* * proces.c * * Created: 10/19/2013 7:22:03 PM * Author: GANESH SELVARAJ */
#define F_CPU 16000000UL#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)#include<avr/io.h>
#include<util/delay.h>
void BlueInit()
{
UCSRB |= (1 << RXEN) | (1 << TXEN); // Enable transmission and reception
UCSRC |= (1 << URSEL) | (1<<USBS) | (1 << UCSZ0) | (1 << UCSZ1);
// Use 8-bit character sizes
UBRRL = BAUD_PRESCALE;
UBRRH = (BAUD_PRESCALE >> 8);
}void BlueWrChar(unsigned char d)
{
while ((UCSRA & (1 << UDRE)) == 0); // wait till UDR is ready
UDR = d; // send data
}unsigned int BlueRdChar()
{
while ((UCSRA & (1 << RXC)) == 0); // wait until data has been received
return(UDR); // return the byte
}void BlueWrString(const char *msg)
{BlueWrChar('r');
BlueWrChar('n');
while(*msg!='