/* Project: Relay Remote Control via PC Author : Sasa Karanovic (sale@mrdnise.com) */ #define F_CPU 8000000UL #define BAUD 4800 #define MYUBBR (((F_CPU/16)/BAUD)-1) #define SIGNAL_LED PB4 #define RELAY_PIN PB3 #include #include #include /* Prototypes */ void InitUART (unsigned char baudrate); unsigned char ReceiveByte (void); void TransmitByte (unsigned char data); void init() { DDRB = 0xFF; PORTB = 0x00; } /* -------------------------------------------------------------- Main - program that receives a character then transmits back the next character. An example would be if you send in an A, the chip will return a B ---------------------------------------------------------------- */ unsigned char data, status; int main (void) { init(); InitUART (MYUBBR); /* Set the baudrate to 4800 at 8MHz */ while (1) { data = ReceiveByte(); if(data != 0x00) { if(data == 0x99) { PORTB |= (1<