From a7928e0dbff9a3e3b0ed4729276cb279804f5bfd Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sat, 8 Apr 2023 03:09:12 +0200 Subject: [PATCH] avr: added timer entry for every5s This will be used for the window check module. --- avr/att84_base.asm | 46 ++++++++------------------------------------- avr/att84_temp1.asm | 12 ++++++++++-- avr/timer.asm | 21 +++++++++++---------- 3 files changed, 29 insertions(+), 50 deletions(-) diff --git a/avr/att84_base.asm b/avr/att84_base.asm index a7f3973..52b5995 100644 --- a/avr/att84_base.asm +++ b/avr/att84_base.asm @@ -110,44 +110,6 @@ -; --------------------------------------------------------------------------- -; TWI master module - -.equ TWI_DDR_SCL = DDRA -.equ TWI_PORT_SCL = PORTA -.equ TWI_PIN_SCL = PINA -.equ TWI_PINNUM_SCL = PORTA4 - -.equ TWI_DDR_SDA = DDRA -.equ TWI_PORT_SDA = PORTA -.equ TWI_PIN_SDA = PINA -.equ TWI_PINNUM_SDA = PORTA6 - - - -; --------------------------------------------------------------------------- -; LCD module - -.equ LCD_TWI_ADDRESS = 0x3c - - - -; --------------------------------------------------------------------------- -; BMP 280 - -.equ BMP280_ADDR = 0x76 - - - -; --------------------------------------------------------------------------- -; SI 7021 - -.equ SI7021_ADDR = 0x40 - - - - - ; *************************************************************************** ; code segment @@ -260,6 +222,14 @@ onEverySecond: +; --------------------------------------------------------------------------- +; Called every 5 seconds. Add your routine calls here. No arguments, no results. + +onEvery5s: + ret + + + ; --------------------------------------------------------------------------- ; Called every 10 seconds. Add your routine calls here. No arguments, no results. diff --git a/avr/att84_temp1.asm b/avr/att84_temp1.asm index 3bbd18f..2ecf507 100644 --- a/avr/att84_temp1.asm +++ b/avr/att84_temp1.asm @@ -11,8 +11,8 @@ ; VCC 1 14 GND ; PB0 2 13 PA0 ; PB1 3 12 PA1 COM-DATA -; /RESET PB3 4 11 PA2 OWI -; KEY1 PB2 5 10 PA3 LED +; /RESET PB3 4 11 PA2 [OWI] +; [KEY1] PB2 5 10 PA3 LED ; COM_ATTN PA7 6 9 PA4 TWI-SCL ; TWI-SDA PA6 7 8 PA5 ; -------- @@ -295,6 +295,14 @@ onEverySecond: +; --------------------------------------------------------------------------- +; Called every 5 seconds. Add your routine calls here. No arguments, no results. + +onEvery5s: + ret + + + ; --------------------------------------------------------------------------- ; Called every 10 seconds. Add your routine calls here. No arguments, no results. diff --git a/avr/timer.asm b/avr/timer.asm index d91e4fd..db8fce7 100644 --- a/avr/timer.asm +++ b/avr/timer.asm @@ -19,7 +19,7 @@ timerModuleTickCounter: .byte 1 timerModuleFlags: .byte 1 timerModuleCounterSecs: .byte 4 -timerModuleDerivedCounters: .byte 9 ; must correspond to entries in timer table! +timerModuleDerivedCounters: .byte 10 ; must correspond to entries in timer table! timerModuleData_end: @@ -34,15 +34,16 @@ timerModuleData_end: ; number of entries here must be equal to bytes in timerModuleDerivedCounters! timerTable: - .db 10, 0, LOW(onEvery10s), HIGH(onEvery10s) ; 10s: overflow after 10*1s (1) - .db 3, 0, LOW(onEvery30s), HIGH(onEvery30s) ; 30s: overflow after 3*10s (2) - .db 2, 0, LOW(onEvery1m), HIGH(onEvery1m) ; 1m : overflow after 2*30s (3) - .db 5, 0, LOW(onEvery5m), HIGH(onEvery5m) ; 5m : overflow after 5*1m (4) - .db 3, 0, LOW(onEvery15m), HIGH(onEvery15m) ; 15m: overflow after 3*5m (5) - .db 2, 0, LOW(onEvery30m), HIGH(onEvery30m) ; 30m: overflow after 2*15m (6) - .db 2, 0, LOW(onEvery1h), HIGH(onEvery1h) ; 1h: overflow after 2*30m (7) - .db 12, 0, LOW(onEvery12h), HIGH(onEvery12h) ; 12h: overflow after 12*1h (8) - .db 2, 0, LOW(onEvery1d), HIGH(onEvery1d) ; 1d: overflow after 2*12h (9) + .db 5, 0, LOW(onEvery5s), HIGH(onEvery5s) ; 5s : overflow after 5*1s (1) + .db 2, 0, LOW(onEvery10s), HIGH(onEvery10s) ; 10s: overflow after 2*5s (2) + .db 3, 0, LOW(onEvery30s), HIGH(onEvery30s) ; 30s: overflow after 3*10s (3) + .db 2, 0, LOW(onEvery1m), HIGH(onEvery1m) ; 1m : overflow after 2*30s (4) + .db 5, 0, LOW(onEvery5m), HIGH(onEvery5m) ; 5m : overflow after 5*1m (5) + .db 3, 0, LOW(onEvery15m), HIGH(onEvery15m) ; 15m: overflow after 3*5m (6) + .db 2, 0, LOW(onEvery30m), HIGH(onEvery30m) ; 30m: overflow after 2*15m (7) + .db 2, 0, LOW(onEvery1h), HIGH(onEvery1h) ; 1h: overflow after 2*30m (8) + .db 12, 0, LOW(onEvery12h), HIGH(onEvery12h) ; 12h: overflow after 12*1h (9) + .db 2, 0, LOW(onEvery1d), HIGH(onEvery1d) ; 1d: overflow after 2*12h (10) .db 0, 0