Added the missing files for the last commit ... d'oh
This commit is contained in:
parent
05262db980
commit
c5baf9195e
Binary file not shown.
After Width: | Height: | Size: 280 KiB |
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
|
@ -0,0 +1,42 @@
|
|||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
|
||||
#define BAUD 9600UL // baudrate
|
||||
|
||||
// Some calculations ...
|
||||
#define UBRR_VAL ((F_CPU+BAUD*8)/(BAUD*16)-1) // rounding magic
|
||||
#define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1))) // Real baudrate
|
||||
#define BAUD_ERROR ((BAUD_REAL*1000)/BAUD) // Error in 0,1%
|
||||
|
||||
#if ((BAUD_ERROR<990) || (BAUD_ERROR>1010)) // Make sure your UBRR_VAL will work
|
||||
#error Baudrate error is bigger then 1% !
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int main(void) {
|
||||
|
||||
UBRRH = UBRR_VAL >> 8; //Setting baudrate
|
||||
UBRRL = UBRR_VAL & 0xFF;
|
||||
|
||||
UCSRB |= (1<<TXEN); // UART TX
|
||||
UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); // Asynchronous 8N1
|
||||
|
||||
char str[] = "Hello World !\n\r";
|
||||
|
||||
while(1) {
|
||||
|
||||
int c;
|
||||
for(c = 0; c < 15; c++) {
|
||||
UDR = str[c]; // write byte to data register
|
||||
while (!(UCSRA & (1<< TXC))); // waiting for the uart to finish transmission
|
||||
UCSRA |= (1 << TXC); // resetting the TXC bit
|
||||
}
|
||||
|
||||
int s;
|
||||
for(s = 0; s < 250; s++) {
|
||||
_delay_ms(2);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
:1000000012C024C023C022C021C020C01FC01EC0F7
|
||||
:100010001DC01CC01BC01AC019C018C017C016C014
|
||||
:1000200015C014C013C011241FBECFE5D4E0DEBF3D
|
||||
:10003000CDBF10E0A0E6B0E0ECEBF0E002C0059030
|
||||
:100040000D92A037B107D9F702D036C0D9CFCF93E0
|
||||
:10005000DF93CDB7DEB760970FB6F894DEBF0FBE63
|
||||
:10006000CDBF10BC87E689B9539A86E880BD80E190
|
||||
:10007000E0E6F0E09E012F5F3F4FD90101900D9225
|
||||
:100080008A95E1F716C0F901E80FF91F40814CB9D4
|
||||
:100090005E9BFECF5E9A01968F309105A4F38AEFA6
|
||||
:1000A00090E0EFE3FFE13197F1F700C00000019726
|
||||
:0C00B000C1F780E090E0F0CFF894FFCFA3
|
||||
:1000BC0048656C6C6F20576F726C6420210A0D00C0
|
||||
:00000001FF
|
Loading…
Reference in New Issue