diff --git a/20230524/bit-ops-01.c b/20230524/bit-ops-01.c new file mode 100644 index 0000000000000000000000000000000000000000..da61782fe6fe2eca4023bf843f8d6450ac084565 --- /dev/null +++ b/20230524/bit-ops-01.c @@ -0,0 +1,19 @@ +#include <avr/io.h> + +int main (void) +{ + uint8_t mask; + DDRD = 0xff; + PORTD = 0xf0; + mask = 1; + mask <<= 3; + PORTD |= mask; + mask = 1; + mask <<= 4; + PORTD &= ~mask; + mask = 1; + mask <<= 0; + PORTD ^= mask; + while (1); + return 0; +} diff --git a/20230524/bit-ops-01.s b/20230524/bit-ops-01.s new file mode 100644 index 0000000000000000000000000000000000000000..ee8d240ff574e451dec435f5a8c03e653e7ae2f2 --- /dev/null +++ b/20230524/bit-ops-01.s @@ -0,0 +1,28 @@ + .file "bit-ops-01.c" +__SP_H__ = 0x3e +__SP_L__ = 0x3d +__SREG__ = 0x3f +__tmp_reg__ = 0 +__zero_reg__ = 1 + .text +.global main + .type main, @function +main: +/* prologue: function */ +/* frame size = 0 */ +/* stack size = 0 */ +.L__stack_usage = 0 + ldi r24,lo8(-1) + out 0xa,r24 + ldi r24,lo8(-16) + out 0xb,r24 + sbi 0xb,3 + cbi 0xb,4 + in r25,0xb + ldi r24,lo8(1) + eor r24,r25 + out 0xb,r24 +.L2: + rjmp .L2 + .size main, .-main + .ident "GCC: (GNU) 5.4.0" diff --git a/20230531/Makefile b/20230531/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..7ae33df99f68fcf460324cfbb008f3f7a3863638 --- /dev/null +++ b/20230531/Makefile @@ -0,0 +1,8 @@ +%.elf: %.c + avr-gcc -Wall -Os -mmcu=atmega328p $< -o $@ + +%.hex: %.elf + avr-objcopy -O ihex $< $@ + +download: + ./download.sh diff --git a/20230531/blink_interlaced.s b/20230531/blink_interlaced.s new file mode 100644 index 0000000000000000000000000000000000000000..bf14c3e6b57c599ff8963f30388afb9f3cea3d50 --- /dev/null +++ b/20230531/blink_interlaced.s @@ -0,0 +1,46 @@ + .text + + .global main + .type main, @function + +main: + ldi r24,0xff ; 1111 1111 to r24 + out 0x04,r24 ; r24 to 0x04 (DDRB) + out 0x0a,r24 ; r24 to 0x0a (DDRD) + + +loop: + ldi r24,0x00 + out 0x05,r24 + ldi r24,0x04 + out 0x0b,r24 + + ldi r26,lo8(7999999) + ldi r22,hi8(7999999) + ldi r23,hlo8(7999999) +1: + subi r26,1 ; sub immediately + sbci r22,0 ; sub carry immediately + sbci r23,0 + brne 1b ; branch not equal (not zero) + rjmp . + nop + + ldi r24,0x20 + out 0x05,r24 + ldi r24,0x00 + out 0x0b,r24 + + ldi r26,lo8(7999999) + ldi r22,hi8(7999999) + ldi r23,hlo8(7999999) + +1: + subi r26,1 ; 1 cycle + sbci r22,0 + sbci r23,0 + brne 1b ; 2 cycles when jump, 1 if not + rjmp . ; 2 cycle nop + nop ; 1 cycle nop + + jmp loop diff --git a/20230531/download.sh b/20230531/download.sh new file mode 100755 index 0000000000000000000000000000000000000000..770c3b5dca74ac09778be055c9d6f5adb0df293b --- /dev/null +++ b/20230531/download.sh @@ -0,0 +1,3 @@ +port=$(ls -rt /dev/ttyACM* | tail -1) +echo avrdude -P $port -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1) +avrdude -P $port -c arduino -p m328p -U flash:w:$(ls -rt *.hex | tail -1) 2>/dev/null diff --git a/20230620/rtech-20230620.pdf b/20230620/rtech-20230620.pdf index 465e2ee19360113c72429ef38943f84b9d297681..c6878ab9b8fcd7a62c52719772b826faffdbaa13 100644 Binary files a/20230620/rtech-20230620.pdf and b/20230620/rtech-20230620.pdf differ diff --git a/20230620/rtech-20230620.tex b/20230620/rtech-20230620.tex index 507e64e0c095bcd796156771447c352a96547808..655a4e57d66ae1747c22d14ed5afb92afe996754 100644 --- a/20230620/rtech-20230620.tex +++ b/20230620/rtech-20230620.tex @@ -224,7 +224,7 @@ .ppm.xz-Dateien sind kleiner als .png-Dateien \item mehrere Dateien, zusammengefaßt:\\ - .ar, .tar + .a, .tar \item mehrere Dateien, zusammengefaßt und komprimiert:\\ .tar.gz, .tar.bz2, .tar.xz, .zip, .7z