/*
Copyright 2010 Volts and Bytes
http://voltsandbytes.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#define F_CPU 8000000UL
#define FOSC 8000000 // Clock Speed
#define BAUD 9600
#define MYUBRR FOSC/16/BAUD-1
#define STX 0x02
#define ACK 0x06
#define NAK 0x15
#define SIZE 69
#include
#include
void init_all(void);
void USART_Init(unsigned int);
void USART_Transmit(unsigned char);
unsigned char USART_Receive(void);
void EEPROM_write(unsigned int, unsigned char);
unsigned char EEPROM_read(unsigned int);
unsigned char buffer[SIZE+1];
int main(void) {
unsigned char ctr=0;
unsigned char checker=0;
unsigned char temp;
init_all();
_delay_ms(10);
while(1)
{
if((PIND & 0x20) == 0x20)
{
for(ctr=0;ctr>8);
UBRR0L = (unsigned char)ubrr;
/* Enable receiver and transmitter */
UCSR0B = (1<