From 061c27c092b3db7fcbfcbe7d512a30031636e53b Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 17 Oct 2016 21:03:11 +0200 Subject: compiles, but differs --- .gitignore | 3 + Bewegungsmelder.asm | 22 +- Makefile | 12 + tn24def.inc | 673 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 699 insertions(+), 11 deletions(-) create mode 100644 Makefile create mode 100644 tn24def.inc diff --git a/.gitignore b/.gitignore index 0f3a6b1..22acbed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ Debug Release +*.o +*.elf +*.hex diff --git a/Bewegungsmelder.asm b/Bewegungsmelder.asm index a87f8d0..4979236 100644 --- a/Bewegungsmelder.asm +++ b/Bewegungsmelder.asm @@ -9,14 +9,14 @@ ; auf internen 128kHz-Oszillator stellen! -.DEF statusBits = r25 ; 0: hell, 1: akku voll, 2: akku nicht leer -.EQU hellBit = 0 -.EQU akkuVollBit = 1 -.EQU akkuNLeerBit = 2 -.EQU hellSpannung = 0x80 ; Schwellwert, ab dem es hell ist -.EQU akkuVollSpannung = 0xb9 ; Schwellwert, ab dem der Akku voll ist (= 14,4V) -.EQU akkuLeerSpannung = 0x99 ; Schwellwert, ab dem der Akku leer ist (= 12,0V) -.EQU zaehlerschritte = 0xffff - 0x2d00 ; 90s? +.EQU statusBits, 25 ; 0: hell, 1: akku voll, 2: akku nicht leer +.EQU hellBit, 0 +.EQU akkuVollBit, 1 +.EQU akkuNLeerBit, 2 +.EQU hellSpannung, 0x80 ; Schwellwert, ab dem es hell ist +.EQU akkuVollSpannung, 0xb9 ; Schwellwert, ab dem der Akku voll ist (= 14,4V) +.EQU akkuLeerSpannung, 0x99 ; Schwellwert, ab dem der Akku leer ist (= 12,0V) +.EQU zaehlerschritte, 0xffff - 0x2d00 ; 90s? rjmp RESET reti @@ -37,7 +37,7 @@ reti RESET: - ldi r16,low(RAMEND) ; Stackpointer initialisieren + ldi r16,lo8(RAMEND) ; Stackpointer initialisieren out SPL,r16 sbi DIDR0,ADC0D ; digitalen Eingang an ADC0 (Phototransistor) deaktivieren @@ -99,8 +99,8 @@ BEWEGUNG_AUSWERTEN: sbrc statusBits,hellBit ; ist es hell? rjmp MAINLOOP ; ja! - ldi r16,high(zaehlerschritte) - ldi r17,low(zaehlerschritte) + ldi r16,hi8(zaehlerschritte) + ldi r17,lo8(zaehlerschritte) out TCNT1H,r16 out TCNT1L,r17 ; Timer/Counter 1 resetten sbi PORTB,1 ; Licht an! diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..63c29ed --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ + +all: Bewegungsmelder.hex + +%.o: %.asm *.inc + avr-as $< -mmcu=attiny24 -o $@ + +%.elf: %.o +# cat $< > $@ + avr-ld -o $@ $< + +%.hex: %.elf + avr-objcopy --output-target=ihex $< $@ diff --git a/tn24def.inc b/tn24def.inc new file mode 100644 index 0000000..ba4d286 --- /dev/null +++ b/tn24def.inc @@ -0,0 +1,673 @@ +;***** THIS IS A MACHINE GENERATED FILE - DO NOT EDIT ******************** +;***** Created: 2011-02-09 12:04 ******* Source: ATtiny24.xml ************ +;************************************************************************* +;* A P P L I C A T I O N N O T E F O R T H E A V R F A M I L Y +;* +;* Number : AVR000 +;* File Name : "tn24def.inc" +;* Title : Register/Bit Definitions for the ATtiny24 +;* Date : 2011-02-09 +;* Version : 2.35 +;* Support E-mail : avr@atmel.com +;* Target MCU : ATtiny24 +;* +;* DESCRIPTION +;* When including this file in the assembly program file, all I/O register +;* names and I/O register bit names appearing in the data book can be used. +;* In addition, the six registers forming the three data pointers X, Y and +;* Z have been assigned names XL - ZH. Highest RAM address for Internal +;* SRAM is also defined +;* +;* The Register names are represented by their hexadecimal address. +;* +;* The Register Bit names are represented by their bit number (0-7). +;* +;* Please observe the difference in using the bit names with instructions +;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc" +;* (skip if bit in register set/cleared). The following example illustrates +;* this: +;* +;* in r16,PORTB ;read PORTB latch +;* sbr r16,(1<