Started following some tutorial on att85 usi. Downloaded example code from make avr book.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
A simple test of serial-port functionality.
|
||||
Takes in a character at a time and sends it right back out,
|
||||
displaying the ASCII value on the LEDs.
|
||||
*/
|
||||
|
||||
// ------- Preamble -------- //
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include "pinDefines.h"
|
||||
#include "USART.h"
|
||||
|
||||
int main(void) {
|
||||
char serialCharacter;
|
||||
|
||||
// -------- Inits --------- //
|
||||
LED_DDR = 0xff; /* set up LEDs for output */
|
||||
initUSART();
|
||||
printString("Hello World!\r\n"); /* to test */
|
||||
|
||||
// ------ Event loop ------ //
|
||||
while (1) {
|
||||
|
||||
serialCharacter = receiveByte();
|
||||
transmitByte(serialCharacter);
|
||||
LED_PORT = serialCharacter;
|
||||
/* display ascii/numeric value of character */
|
||||
|
||||
} /* End event loop */
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user