UART Routines GCC

download UART Routines GCC

If you can't read please download the document

Transcript of UART Routines GCC

//**************************************************************//******** FUNCTIONS FOR SERIAL COMMUNICATION USING UART *******//**************************************************************//Controller: ATmega8 (Clock: 8 Mhz-internal)//Compiler: AVR-GCC//Version : 2.0//Author: CC Dharmani, Chennai (India)// www.dharmanitech.com//Date: 26 Feb 2009//**************************************************************//**************************************************// ***** HEADER FILE : UART_routines.h ******//**************************************************#ifndef _UART_ROUTINES_H_#define _UART_ROUTINES_H_#define CHAR 0#define INT 1#define LONG 2#define TX_NEWLINE {transmitByte(0x0d); transmitByte(0x0a);}unsigned char receiveByte(void);void transmitByte(unsigned char);void transmitHex( unsigned char dataType, unsigned long data );void transmitString_F(char*);void transmitString(unsigned char*);#endif//**************************************************************//******** FUNCTIONS FOR SERIAL COMMUNICATION USING UART *******//**************************************************************//Controller: ATmega8 (Clock: 8 Mhz-internal)//Compiler: AVR-GCC//Version : 2.0//Author: CC Dharmani, Chennai (India)// www.dharmanitech.com//Date: 26 Feb 2009//**************************************************************//**************************************************// ***** SOURCE FILE : UART_routines.c ******//**************************************************#include "UART_routines.h"#include #include //**************************************************//Function to receive a single byte//*************************************************unsigned char receiveByte( void ){unsigned char data, status;while(!(UCSRA & (1