Table of Contents

Introducere

Proiectul propune o masinuta teleghidata controlata de la tastatura unui calculator si care are capacitatea de a memora traseul parcurs pentru a-l reface fara interventia unei persoane.

Descriere generală

Hardware Design

Software Design

Codul contine:

int uart_putchar(char c, FILE *unused)      
{
	if (c == '\n') uart_putchar('\r', 0);
	loop_until_bit_is_set(UCSRA, UDRE);
	UDR = c;
	return 0;
}
int uart_getchar(FILE* f)
{
	char c;
  	loop_until_bit_is_set(UCSRA, RXC);
  	c = UDR;
  	if(c=='\r')
	c='\n';
  	return c;
}
void EEPROM_write(unsigned int uiAddress, unsigned char ucData)
{
	/* Wait for completion of previous write */
	while(EECR & (1<<EEWE));
	/* Set up address and data registers */
	EEAR = uiAddress;
	EEDR = ucData;
	/* Write logical one to EEMWE */
	EECR |= (1<<EEMWE);
	/* Start eeprom write by setting EEWE */
	EECR |= (1<<EEWE);
}
unsigned char EEPROM_read(unsigned int uiAddress)
{
	/* Wait for completion of previous write */
	while(EECR & (1<<EEWE));
	/* Set up address register */
	EEAR = uiAddress;
	/* Start eeprom read by writing EERE */
	EECR |= (1<<EERE);
	/* Return data from data register */
	return EEDR;
}

Rezultate Obţinute

Masina merge destul de bine. Uneori tine comanda ceva mai mult decat a fost apasata tasta.

Refacerea traseului nu respecta 100% traseul initial.

Download

masina.zip

Bibliografie/Resurse

PRMA2A05-SRC-Devices-datasheet-9227.pdf

atmega-eeprom-memory-writing