gavrasm Gerd's AVR assembler version 5.4 (C)2022 by DG4FAC ---------------------------------------------------------- Path: /home/sergeyyarkov/Documents/Applications/attiny2313a_thermostat/ Source file: firmware.asm Hex file: firmware.hex Eeprom file: firmware.eep Compiled: 25.02.2023, 10:41:03 Pass: 2 1: ; 2: ; Project name: thermostat 3: ; Description: Electronic thermostat on AVR Microcontroller 4: ; Source code: https://github.com/sergeyyarkov/attiny2313a_thermostat 5: ; Device: ATtiny2313A 6: ; Device Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf 7: ; Package: SOIC-20W_7.5x12.8mm_P1.27mm 8: ; Assembler: AVR macro assembler 2.2.7 9: ; Clock frequency: 8 MHz External Crystal Oscillator 10: ; Fuses: lfuse: 0xCF, hfuse: 0x9F, efuse: 0xFF, lock: 0xFF 11: ; 12: ; Written by Sergey Yarkov 22.01.2023 13: 14: .INCLUDE "tn2313Adef.inc" -> Warning 009: Include defs not necessary, using internal values! File: /home/sergeyyarkov/Documents/Applications/attiny2313a_thermostat/firmware.asm, Line: 14 Source line: .INCLUDE "tn2313Adef.inc" 15: .LIST 16: 17: .DEF TEMP_REG_A = r16 18: .DEF TEMP_REG_B = r17 19: 20: ;========================================; 21: ; LABELS ; 22: ;========================================; 23: 24: .EQU DISPLAY_1_PIN = PD2 25: .EQU DISPLAY_2_PIN = PD3 26: .EQU DISPLAY_3_PIN = PD4 27: .EQU DISPLAY_4_PIN = PD5 28: 29: .EQU LED_POWER_PIN = PD6 30: 31: .EQU USI_LATCH_PIN = PB0 ; ST_CP on 74HC595 32: .EQU USI_DO_PIN = PB6 ; DS on 74HC595 33: .EQU USI_CLK_PIN = PB7 ; SH_CP on 74HC595 34: 35: ;========================================; 36: ; DATA SEGMENT ; 37: ;========================================; 38: .DSEG 39: .ORG SRAM_START 40: 41: DISPLAY_DIGIT: .BYTE 4 42: 43: ;========================================; 44: ; CODE SEGMENT ; 45: ;========================================; 46: 47: .CSEG 48: .ORG 0x00 49: 50: ;========================================; 51: ; VECTORS ; 52: ;========================================; 53: 54: 000000 C000 rjmp RESET_vect ; Program start at RESET vector 55: ;reti ; External Interrupt Request 0 / inactive 56: ;reti ; External Interrupt Request 1 / inactive 57: ;reti ; Timer/Counter1 Capture Event / inactive 58: ;reti ; Timer/Counter1 Compare Match A / inactive 59: ;reti ; Timer/Counter1 Overflow / inactive 60: ;reti ; Timer/Counter0 Overflow / inactive 61: ;reti ; USART0, Rx Complete / inactive 62: ;reti ; USART0 Data Register Empty / inactive 63: ;reti ; USART0, Tx Complete / inactive 64: ;reti ; Analog Comparator / inactive 65: ;reti ; Pin Change Interrupt Request 0/ inactive 66: ;reti ; Timer/Counter1 Compare Match B / inactive 67: ;reti ; Timer/Counter0 Compare Match A / inactive 68: ;reti ; Timer/Counter0 Compare Match B / inactive 69: ;reti ; USI Start Condition/ inactive 70: ;reti ; USI Overflow / inactive 71: ;reti ; EEPROM Ready/ inactive 72: ;reti ; Watchdog Timer Overflow / inactive 73: ;reti ; Pin Change Interrupt Request 1 / inactive 74: ;reti ; Pin Change Interrupt Request 2 / inactive 75: 76: RESET_vect: 77: ;========================================; 78: ; INITIALIZE STACK POINTER ; 79: ;========================================; 80: 000001 ED0F ldi TEMP_REG_A, LOW(RAMEND) 81: 000002 BF0D out SPL, TEMP_REG_A 82: 83: MCU_INIT: 84: ;=======================================================; 85: ; INITIALIZE PORTS ; 86: ; ; 87: ; POWER LED <-------------> OUT PD6 ; 88: ; - This LED is used to indicate that device ; 89: ; is working correctly ; 90: ; 7SEG DIGIT 1 <-------------> OUT PD2 ; 91: ; 7SEG DIGIT 2 <-------------> OUT PD3 ; 92: ; 7SEG DIGIT 3 <-------------> OUT PD4 ; 93: ; 7SEG DIGIT 4 <-------------> OUT PD5 ; 94: ; ; 95: ; USI CLOCK PIN <-------------> OUT PB0 ; 96: ; USI DATA OUT PIN <-------------> OUT PB6 ; 97: ; USI LATCH PIN <-------------> OUT PB7 ; 98: ;=======================================================; 99: 000003 E70C ldi r16, (1< USI Wire Mode 141: ; USICS1 <--------------> USI Clock Source Select 142: ; USICLK <--------------> USI Clock Strobe 143: ; USITC <--------------> USI Toggle Clock (Enable clock generation) 144: 00001E E10B ldi TEMP_REG_A, (1<