AVRASM ver. 2.2.7 C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm Sun Jun 10 10:18:03 2018 [builtin](2): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.150\avrasm\inc\m328pdef.inc' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(34): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\vectors.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(35): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm(7): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.inc' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm(29): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\div8u.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\div8u.asm(6): warning: Register r16 already defined by the .DEF directive C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm(29): 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\div8u.asm' included form here C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(35): 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm' included form here C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(36): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\wait.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(37): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm(9): warning: Register r17 already defined by the .DEF directive C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(37): 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm' included form here C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(38): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\crc8.asm' [builtin](2): Including file 'C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.150\avrasm\inc\m328pdef.inc' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(34): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\vectors.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(35): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm(7): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.inc' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\hd44780.asm(29): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\div8u.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(36): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\wait.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(37): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\1-wire.asm' C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(38): Including file 'C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\crc8.asm' ;------------------------------------------------------------------------------ ;***** Created: 2011-02-09 12:03 ******* Source: ATmega328P.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 : "m328Pdef.inc" ;* Title : Register/Bit Definitions for the ATmega328P ;* Date : 2011-02-09 ;* Version : 2.35 ;* Support E-mail : avr@atmel.com ;* Target MCU : ATmega328P ;* ;* 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<= 4MHz ; http://avr-mcu.dxp.pl ; e-mail : radek@dxp.pl ; (c) Radoslaw Kwiecien ;------------------------------------------------------------------------------ #ifndef F_CPU #endif #if F_CPU < 4000000 #endif #define CYCLES_PER_US (F_CPU/1000000) #define C4PUS (CYCLES_PER_US/4) #define DVUS(x) (C4PUS*x) ;------------------------------------------------------------------------------ ; Input : XH:XL - number of CPU cycles to wait (divided by four) ;------------------------------------------------------------------------------ Wait4xCycles: 0000b5 9711 sbiw XH:XL, 1 ; x-- (2 cycles) 0000b6 f7f1 brne Wait4xCycles ; jump if not zero (2 cycles) 0000b7 9508 ret ;------------------------------------------------------------------------------ ; Input : r16 - number of miliseconds to wait ;------------------------------------------------------------------------------ WaitMiliseconds: 0000b8 930f push r16 WaitMsLoop: 0000b9 e0b7 ldi XH,HIGH(DVUS(500)) 0000ba eda0 ldi XL,LOW(DVUS(500)) 0000bb dff9 rcall Wait4xCycles 0000bc e0b7 ldi XH,HIGH(DVUS(500)) 0000bd eda0 ldi XL,LOW(DVUS(500)) 0000be dff6 rcall Wait4xCycles 0000bf 950a dec r16 0000c0 f7c1 brne WaitMsLoop 0000c1 910f pop r16 0000c2 9508 ret ;------------------------------------------------------------------------------ ; ;------------------------------------------------------------------------------ #include "1-wire.asm" ; ;------------------------------------------------------------------------------ .equ OW_PORT = PORTB .equ OW_PIN = PINB .equ OW_DDR = DDRB .equ OW_DQ = PB0 .def OWCount = r17 #define ReadRom 0x33 #define SkipRom 0xcc #define ConvertTemp 0x44 ; Initiates temperature conversion. #define WScratch 0x4e ; Writes data into scratchpad bytes 2, 3, and4 (TH, TL, and configuration registers). #define RScratch 0xbe ;------------------------------------------------------------------------------ ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Data segment, variable definitions ;------------------------------------------------------------------------------ .dseg 000108 TempWord: .byte 3 00010b TRegister: .byte 3 00010e ConfigRegister: .byte 2 .cseg ;------------------------------------------------------------------------------ ; Output : T - presence bit ;------------------------------------------------------------------------------ OWReset: 0000c3 9828 cbi OW_PORT,OW_DQ 0000c4 9a20 sbi OW_DDR,OW_DQ 0000c5 e0b7 ldi XH, HIGH(DVUS(470)) 0000c6 e5a8 ldi XL, LOW(DVUS(470)) 0000c7 dfed rcall Wait4xCycles 0000c8 9820 cbi OW_DDR,OW_DQ 0000c9 e0b1 ldi XH, HIGH(DVUS(70)) 0000ca e1a8 ldi XL, LOW(DVUS(70)) 0000cb dfe9 rcall Wait4xCycles 0000cc 9468 set 0000cd 9b18 sbis OW_PIN,OW_DQ 0000ce 94e8 clt 0000cf e0b3 ldi XH, HIGH(DVUS(240)) 0000d0 eca0 ldi XL, LOW(DVUS(240)) 0000d1 dfe3 rcall Wait4xCycles 0000d2 9508 ret ;------------------------------------------------------------------------------ ; Input : C - bit to write ;------------------------------------------------------------------------------ OWWriteBit: 0000d3 f418 brcc OWWriteZero 0000d4 e0b0 ldi XH, HIGH(DVUS(1)) 0000d5 e0a4 ldi XL, LOW(DVUS(1)) 0000d6 c002 rjmp OWWriteOne OWWriteZero: 0000d7 e0b1 ldi XH, HIGH(DVUS(120)) 0000d8 eea0 ldi XL, LOW(DVUS(120)) OWWriteOne: 0000d9 9a20 sbi OW_DDR, OW_DQ 0000da dfda rcall Wait4xCycles 0000db 9820 cbi OW_DDR, OW_DQ 0000dc e0b0 ldi XH, HIGH(DVUS(60)) 0000dd efa0 ldi XL, LOW(DVUS(60)) 0000de dfd6 rcall Wait4xCycles 0000df 9508 ret ;------------------------------------------------------------------------------ ; Input : r16 - byte to write ;------------------------------------------------------------------------------ OWWriteByte: 0000e0 931f push OWCount 0000e1 e010 ldi OWCount,0 OWWriteLoop: 0000e2 9507 ror r16 0000e3 dfef rcall OWWriteBit 0000e4 9513 inc OWCount 0000e5 3018 cpi OWCount,8 0000e6 f7d9 brne OWWriteLoop 0000e7 911f pop OWCount 0000e8 9508 ret ;------------------------------------------------------------------------------ ; Output : C - bit from slave ;------------------------------------------------------------------------------ OWReadBit: 0000e9 e0b0 ldi XH, HIGH(DVUS(1)) 0000ea e0a4 ldi XL, LOW(DVUS(1)) 0000eb 9a20 sbi OW_DDR, OW_DQ 0000ec dfc8 rcall Wait4xCycles 0000ed 9820 cbi OW_DDR, OW_DQ 0000ee e0b0 ldi XH, HIGH(DVUS(5)) 0000ef e1a4 ldi XL, LOW(DVUS(5)) 0000f0 dfc4 rcall Wait4xCycles 0000f1 94e8 clt 0000f2 9918 sbic OW_PIN,OW_DQ 0000f3 9468 set 0000f4 e0b0 ldi XH, HIGH(DVUS(50)) 0000f5 eca8 ldi XL, LOW(DVUS(50)) 0000f6 dfbe rcall Wait4xCycles 0000f7 9408 sec 0000f8 f00e brts OWReadBitEnd 0000f9 9488 clc OWReadBitEnd: 0000fa 9508 ret ;------------------------------------------------------------------------------ ; Output : r16 - byte from slave ;------------------------------------------------------------------------------ OWReadByte: 0000fb 931f push OWCount 0000fc e010 ldi OWCount,0 OWReadLoop: 0000fd dfeb rcall OWReadBit 0000fe 9507 ror r16 0000ff 9513 inc OWCount 000100 3018 cpi OWCount,8 000101 f7d9 brne OWReadLoop 000102 911f pop OWCount 000103 9508 ret ;------------------------------------------------------------------------------ ; 18b20 MainReadTemp ;------------------------------------------------------------------------------ MainReadTemp: 000104 e0c8 ldi YL,LOW(TempWord) 000105 e0d1 ldi YH,HIGH(TempWord) 000106 dfbc rcall OWReset ; One wire reset 000107 f3e6 brts MainReadTemp ; If device not present go to MainLoop 000108 ec0c ldi r16,SkipRom ; Write Skip Rom one wire in "single-drop" 000109 dfd6 rcall OWWriteByte ; 00010a eb0e ldi r16, RScratch ; Write ConvertCommand 00010b dfd4 rcall OWWriteByte ; 00010c dfee rcall OWReadByte 00010d 9309 st Y+, r16 ; Store TEMPERATURE LSB(50h) byte to table, and increment pointer ;rcall LCD_WriteHex8 00010e dfec rcall OWReadByte 00010f 9309 st Y+, r16 ; Store TEMPERATURE MSB(05h) byte to table, and increment pointer ;rcall LCD_WriteHex8 000110 9508 ret TempRequest: 000111 dfb1 rcall OWReset ; One wire reset 000112 f38e brts MainReadTemp ; If device not present go to MainLoop 000113 ec0c ldi r16,SkipRom ; Write Skip Rom one wire in "single-drop" 000114 dfcb rcall OWWriteByte ; 000115 e404 ldi r16, ConvertTemp ; Write ConvertCommand 000116 dfc9 rcall OWWriteByte ; 000117 eb0c ldi r16, 188 000118 df9f rcall WaitMiliseconds 000119 9518 reti ConvertTempForLCD: ;r18 contiendra la partie décimal et xl la partie entiere 00011a 930f push r16 00011b 931f push r17 00011c e0c8 ldi YL,LOW(TempWord) 00011d e0d1 ldi YH,HIGH(TempWord) 00011e 91a9 ld XL, Y+ 00011f 91b9 ld XH, Y+ 000120 95a6 lsr XL 000121 95a6 lsr XL ;Sup des deux bit inutilisé 000122 2f0a mov r16, XL 000123 e023 ldi r18, 0x03 ;Masque des 3 bit de fraction 000124 232a AND r18, XL ;3bit fraction 000125 e109 ldi r16, 25 000126 9f20 mul r18, r16 000127 0190 movw r18, r0 000128 95a6 lsr XL 000129 95a6 lsr XL ;Sup des deux bit de fraction 00012a e00f ldi r16, 0b00001111 00012b 23b0 and XH,r16 00012c 95b2 SWAP XH 00012d 2bab or XL,XH ;mov r16, R18 ;rcall LCD_WriteHex8 00012e 911f pop r17 00012f 910f pop r16 000130 9508 ret #include "crc8.asm" ; CRC8 computing functions ; based on Application Note 27 from Dallas Semiconductor ; http://avr-mcu.dxp.pl ; e-mail: radek@dxp.pl ; (c) Radoslaw Kwiecien ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Data segment ;------------------------------------------------------------------------------ .dseg 000110 _crc : .byte 1 ;------------------------------------------------------------------------------ ; Code segment ;------------------------------------------------------------------------------ .cseg ;------------------------------------------------------------------------------ ; Update crc value ;------------------------------------------------------------------------------ CRC8Update: 000131 930f push r16 000132 931f push r17 000133 932f push r18 000134 930f push r16 000135 e018 ldi r17, 8 CRC8L: 000136 9120 0110 lds r18, _crc 000138 2702 eor r16, r18 000139 9507 ror r16 00013a 9100 0110 lds r16, _crc 00013c f410 brcc CRC8zero 00013d e128 ldi r18, 0x18 00013e 2702 eor r16, r18 CRC8zero: 00013f 9507 ror r16 000140 9300 0110 sts _crc, r16 000142 910f pop r16 000143 9506 lsr r16 000144 930f push r16 000145 951a dec r17 000146 f779 brne CRC8L 000147 910f pop r16 000148 912f pop r18 000149 911f pop r17 00014a 910f pop r16 00014b 9508 ret ;------------------------------------------------------------------------------ ; Clear crc value ;------------------------------------------------------------------------------ CRC8Init: 00014c 930f push r16 00014d e000 ldi r16,0 00014e 9300 0110 sts _crc, r16 000150 910f pop r16 000151 9508 ret ;------------------------------------------------------------------------------ ; Copy crc value to r16 ;------------------------------------------------------------------------------ GetCRC8: 000152 9100 0110 lds r16, _crc 000154 9508 ret ;------------------------------------------------------------------------------ ; End of crc8.asm file ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; Constants definition ;------------------------------------------------------------------------------ Text1 : 000155 6574 000156 706d 000157 7220 000158 6165 000159 6564 00015a 2072 00015b 307e 00015c 322e 00015d 0035 C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(43): warning: .cseg .db misalignment - padding zero byte 00015e 0000 .db "temp reader ~0.25",0,0 Text2 : 00015f 7661 000160 2d72 000161 636d 000162 2e75 000163 7864 000164 2e70 000165 6c70 000166 0000 .db "avr-mcu.dxp.pl",0,0 Tp : 000167 002e C:\Users\adrie\Nextcloud\iset\2IS\2IS\ASM JR\ASM18b20AvecLCD\ASM18b20AvecLCD\ASM18b20AvecLCD\main.asm(47): warning: .cseg .db misalignment - padding zero byte 000168 0000 .db ".",0,0 ;------------------------------------------------------------------------------ ; Program entry point ;------------------------------------------------------------------------------ ProgramEntryPoint: 000169 ef0f ldi r16, LOW(RAMEND) ; Initialize stack pointer 00016a bf0d out SPL, r16 ; 00016b df29 rcall LCD_Init ; Initialize LCD 00016c e001 ldi r16, (HD44780_LINE0 + 1) ; 00016d df21 rcall LCD_SetAddressDD ; Set Display Data address to (0,1) 00016e eaea ldi ZL, LOW(Text1 << 1) ; Load string address to Z 00016f e0f2 ldi ZH, HIGH(Text1<< 1) ; 000170 def6 rcall LCD_WriteString ; Display string 000171 e401 ldi r16, (HD44780_LINE1 + 1) ; 000172 df1c rcall LCD_SetAddressDD ; Set Display Data address to (1,1); ConfigResolTo10Bits: 000173 df4f rcall OWReset 000174 f3f6 brts ConfigResolTo10Bits 000175 ec0c ldi r16, SkipRom ; Write Skip Rom one wire in "single-drop" 000176 df69 rcall OWWriteByte 000177 e40e ldi r16, WScratch 000178 df67 rcall OWWriteByte 000179 2700 clr r16 00017a df65 rcall OWWriteByte ;th,tl 00017b df64 rcall OWWriteByte ;th,tl 00017c e30f ldi r16, 63 00017d df62 rcall OWWriteByte ;resol MainLoop: 00017e e401 ldi r16, (HD44780_LINE1 + 1) ; 00017f df0f rcall LCD_SetAddressDD ; Set Display Data address to (1,1); 000180 df42 rcall OWReset ; One wire reset 000181 f3e6 brts MainLoop ; If device not present go to MainLoop 000182 df8e rcall TempRequest 000183 df80 rcall MainReadTemp 000184 df95 rcall ConvertTempForLCD 000185 0000 nop 000186 0000 nop 000187 0000 nop ;jmp PC-1;LoadLoop LoadLoop: 000188 930f push r16 000189 2f0a mov r16, XL ; chargement partie entière 00018a d008 rcall bin2bcd8 00018b deeb rcall LCD_WriteHex8 ; display it on LCD in HEX 00018c 2f02 mov r16, r18 ; load DEC 00018d d005 rcall bin2bcd8 00018e dee8 rcall LCD_WriteHex8 ; display it on LCD in HEX 00018f 940c 017e jmp MainLoop 000191 f7b1 brne LoadLoop ; if not zero, jump to LoadLoop 000192 cfeb rjmp MainLoop ; jump to MainLoop ;------------------------------------------------------------------------------ ; End of file ;------------------------------------------------------------------------------ ;======= Converting from HEX to BCD ====================================================https://evileg.com/en/post/19/ ;***************************************************** ;* "bin2BCD8" - 8-bit Binary to BCD conversion ;* This subroutine converts an 8-bit number (temp) to a 2-digit ;* i.e 0x15 becomes 0x21 ;* result in temp ;********************************************************** ;.def tBCD = r21 ;add this to main asm file ; bin2bcd8: 000193 935f push r21 000194 2755 clr r21 ;clear temp reg bBCD8_1: 000195 500a subi r16,10 ;input = input - 10 000196 f010 brcs bBCD8_2 ;abort if carry set 000197 5f50 subi r21,-$10 ;tBCD = tBCD + 10 000198 cffc rjmp bBCD8_1 ;loop again bBCD8_2: 000199 5f06 subi r16,-10 ;compensate extra subtraction 00019a 0f05 add r16,r21 00019b 915f pop r21 RESOURCE USE INFORMATION ------------------------ Notice: The register and instruction counts are symbol table hit counts, and hence implicitly used resources are not counted, eg, the 'lpm' instruction without operands implicitly uses r0 and z, none of which are counted. x,y,z are separate entities in the symbol table and are counted separately from r26..r31 here. .dseg memory usage only counts static data declared with .byte "ATmega328P" register use summary: x : 0 y : 4 z : 1 r0 : 1 r1 : 0 r2 : 0 r3 : 0 r4 : 0 r5 : 0 r6 : 0 r7 : 0 r8 : 0 r9 : 0 r10: 0 r11: 0 r12: 0 r13: 0 r14: 3 r15: 6 r16: 93 r17: 29 r18: 13 r19: 0 r20: 0 r21: 5 r22: 0 r23: 0 r24: 0 r25: 0 r26: 22 r27: 17 r28: 2 r29: 2 r30: 1 r31: 1 Registers used: 15 out of 35 (42.9%) "ATmega328P" instruction use summary: .lds : 0 .sts : 0 adc : 0 add : 5 adiw : 0 and : 2 andi : 2 asr : 0 bclr : 0 bld : 0 brbc : 0 brbs : 0 brcc : 3 brcs : 1 break : 0 breq : 1 brge : 0 brhc : 0 brhs : 0 brid : 0 brie : 0 brlo : 1 brlt : 0 brmi : 0 brne : 10 brpl : 0 brsh : 0 brtc : 0 brts : 5 brvc : 0 brvs : 0 bset : 0 bst : 0 call : 0 cbi : 12 cbr : 0 clc : 2 clh : 0 cli : 0 cln : 0 clr : 4 cls : 0 clt : 2 clv : 0 clz : 0 com : 0 cp : 0 cpc : 0 cpi : 5 cpse : 0 dec : 5 eor : 2 fmul : 0 fmuls : 0 fmulsu: 0 icall : 0 ijmp : 0 in : 0 inc : 3 jmp : 1 ld : 2 ldd : 0 ldi : 66 lds : 3 lpm : 1 lsl : 0 lsr : 5 mov : 3 movw : 1 mul : 1 muls : 0 mulsu : 0 neg : 0 nop : 3 or : 1 ori : 2 out : 1 pop : 17 push : 18 rcall : 65 ret : 25 reti : 26 rjmp : 7 rol : 2 ror : 4 sbc : 0 sbci : 0 sbi : 15 sbic : 1 sbis : 1 sbiw : 1 sbr : 0 sbrc : 4 sbrs : 4 sec : 2 seh : 0 sei : 0 sen : 0 ser : 0 ses : 0 set : 2 sev : 0 sez : 0 sleep : 0 spm : 0 st : 2 std : 0 sts : 2 sub : 2 subi : 3 swap : 4 tst : 0 wdr : 0 Instructions used: 51 out of 113 (45.1%) "ATmega328P" memory use summary [bytes]: Segment Begin End Code Data Used Size Use% --------------------------------------------------------------- [.cseg] 0x000000 0x00033a 736 40 776 32768 2.4% [.dseg] 0x000100 0x000111 0 17 17 2048 0.8% [.eseg] 0x000000 0x000000 0 0 0 1024 0.0% Assembly complete, 0 errors, 4 warnings