Reading firmware from Atmega8 16AI

The Internet is full of examples of how to flash Atmel microcontrollers using Arduino, very easily converting the latter into an ISP programmer.
I need the opposite task - to get the firmware from the Atmel microcontroller, and specifically from the Atmega 8 16 AI.


And so I'm wondering - can I do this using Arduino Leonardo Rev.3

or do I need a specialized programmer and Atmel Studio as software?
schematic_Leonardo_rev3.pdf (336,9 КБ)

What board is that? Aniway, if the copyprotect bit it set it won't work. But you could flash your own program.

1 Like

This is an RDAC module, using a simple ADC for reading analog parameters from speed sensors, thermocouples or pressure sensors.

I hope there is no protection for copying the firmware, but I haven’t even gotten to this step yet...

No, you can try it with an Arduino.

However, as mentioned above, if your Atmega8 was a part of commercial device - you have a liitle chances to read the firmware.

1 Like

I don’t want to seem rude, but I asked a question about the technical possibility of using an Arduino Leonardo as a device for reading firmware.
Whether it is possible or not to be closed on the target device is a mystery to me, as well as to you.
I don’t yet understand the algorithm for how to do this “in principle” - all the examples from the Internet boil down to flashing the device’s firmware, and not downloading the firmware from it.
That’s why the question was asked, because there are concerns that it is impossible to unload the firmware from the device using Arduino IDE.

Please tell me how to download the firmware from the device using Arduino IDE?

not with Arduino IDE, but with arduino board as programmer.
The tool that you need to extract the firmware is avrdude

See the link (it about the Mega, but the principles the same for every AVR chip)

1 Like

Take the note, that the code you will extract from the chip has nothing similar to C++ sourcecode and hardly can be edited.
Sorry if what I say is obvious things for you.

1 Like

It’s okay, we on the forum still respect each other, even though we are located at great distances.
Yes, I understand the mechanisms and that you cannot get the source code from the microcontroller, but only *hex.
I just need the firmware because I want to write my own but need to keep the original one.

In that case ArduinoISP may work, but you'd need to solder RESET (PC6) directly on the chip. In case you want hardware serial you'd have to cut the trace between PD0 and PD1 and solder a wire to PD0. And check if the uC is powerd by 5V or 3.3

1 Like
  1. Pins connected as:

pin 13 and SCK, pin 12 and MISO, pin 11 and MOSI, pin 10 and RCT.


  1. I flashed the Arduino Leonardo board with the ArduinoISP sketch.
    1.1 Uncomment #define SPI_CLOCK (128000/6)

  2. Exported blink from Arduino IDE in *hex file

  3. I’m trying to flash atmega328p, which is Nano, via ISP using avrdude:
    avrdude -v -p atmega328p -c arduino -P com7 -U flash:w:blink.hex:i
    I get this answer:

avrdude: Version 7.3
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is D:\Downloads\avrdude.conf

         Using port            : com7
         Using programmer      : arduino
         AVR Part              : ATmega328P
         Programming modes     : ISP, HVPP, debugWIRE, SPM
         Programmer Type       : Arduino
         Description           : Arduino for bootloader using STK500 v1 protocol
         HW Version            : 2
         FW Version            : 1.18
         Topcard               : Unknown
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0xffffff (probably .xmega) (retrying)
avrdude: device signature = 0xffffff (probably .xmega) (retrying)
avrdude: device signature = 0xffffff (probably .xmega)
avrdude main() error: Yikes!  Invalid device signature.
avrdude main() error: expected signature for ATmega328P is 1E 95 0F
        Double check connections and try again, or use -F to override
        this check.


avrdude done.  Thank you.

If I add the -F flag:

The firmware will start, but nothing will load into the Nano.
Perhaps I need to connect the pins not to the usual Arduino Leonardo combs, but directly to the six-pin ISP connector?
...
I’m already thinking of giving up on this stupid idea and just buying a USBASP programmer :grinning:

0xffffff

You have proably swapped miso and mosi

1 Like

To my regret, I tried to change it, but to no avail.
I'll try to solder the wires, now the connections are just "dupont wires".

Firmware via USB for Arduino Nano from Arduino IDE is unstable, yesterday it happened a couple of times, and today it’s error after error, like this post.
Perhaps the reason was the update of Avrdude to version 7.3.
Perhaps I removed the bootloader from the nano board when I loaded the firmware into it using the ISP programmer.
Moreover, the Arduino IDE is strangely structured; it has a folder on the system disk where standard files are stored, incl. and avrdude, and there is also a hidden directory for Arduino15, where basically all the files, frameworks, etc. are located.
It’s not clear to me from which directory Arduino IDE loads Avrdude for work, so I didn’t look into it too much, it works in the console version of Avrdude and it’s a success!

It turned out to connect and read the firmware from the Nano board, with Atmega328P on board, to the programmer based on the Arduino Leonardo debug board.
Because Since I was connecting two boards with dupont wires, I could choose to connect to the standard side pins on the Leonardo board, as well as to a separate ISP connector.
I chose the first, and initially this option did not work for me until I uncommented the definition in the code of the ArduinoISP sketch:

#define USE_OLD_STYLE_WIRING
I read the firmware using the console utility Avrdude, and compare the resulting *hex files.

avrdude -v -p atmega328p -c arduino -P com7 -U flash:r:blink2_1.hex:i

avrdude: Version 7.3
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is D:\Downloads\avrdude.conf

         Using port            : com7
         Using programmer      : arduino
         AVR Part              : ATmega328P
         Programming modes     : ISP, HVPP, debugWIRE, SPM
         Programmer Type       : Arduino
         Description           : Arduino for bootloader using STK500 v1 protocol
         HW Version            : 2
         FW Version            : 1.18
         Topcard               : Unknown
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)

avrdude: processing -U flash:r:blink2_1.hex:i
avrdude: reading flash memory ...
Reading | ################################################## | 100% 75.27 s
avrdude: writing output file blink2_2_1.hex

avrdude done.  Thank you.

For some reason, when reading a firmware dump using Avrdude, the file size is always 77 kB, while when I get the firmware using Arduino IDE


the firmware takes only 2.54-3 kB for the blink LED example.
Moreover, loading a 77 kB or 3 kB file into the microcontroller - the result is the same.

avrdude -v -p atmega328p -c arduino -P com7 -b19200 -U flash:w:blink2_1.hex:i

avrdude: Version 7.3
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is D:\Downloads\avrdude.conf

         Using port            : com7
         Using programmer      : arduino
         Setting baud rate     : 19200
         AVR Part              : ATmega328P
         Programming modes     : ISP, HVPP, debugWIRE, SPM
         Programmer Type       : Arduino
         Description           : Arduino for bootloader using STK500 v1 protocol
         HW Version            : 2
         FW Version            : 1.18
         Topcard               : Unknown
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.
         To disable this feature, specify the -D option.
avrdude: erasing chip

avrdude: processing -U flash:w:blink2_1.hex:i
avrdude: reading input file blink2_1.hex for flash
         with 922 bytes in 1 section within [0, 0x399]
         using 8 pages and 102 pad bytes
avrdude: writing 922 bytes flash ...
Writing | ################################################## | 100% 2.90 s
avrdude: 922 bytes of flash written
avrdude: verifying flash memory against blink2_1.hex
Reading | ################################################## | 100% 2.35 s
avrdude: 922 bytes of flash verified

avrdude done.  Thank you.

Perhaps I’m not operating the Avrdude flags correctly, or is there another reason?
I also want to figure out the Avr-objdump utility, maybe I’ll be able to parse the firmware down to the assembler to understand what’s happening in the code.
.........................................................................................................................................
I played a little with code, compilation, firmware, firmware reading and decompilation.
The following code:

void setup() {
   // initialize digital pin LED_BUILTIN as an output.
   pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
   digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
   delay(200); // wait for a second
   digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
   delay(200); // wait for a second
}

Compiles into this firmware.
blink2_1.zip (1,1 КБ)
Hex here:

:100000000C945C000C946E000C946E000C946E00CA
:100010000C946E000C946E000C946E000C946E00A8
:100020000C946E000C946E000C946E000C946E0098
:100030000C946E000C946E000C946E000C946E0088
:100040000C9412010C946E000C946E000C946E00D3
:100050000C946E000C946E000C946E000C946E0068
:100060000C946E000C946E00000000002400270029
:100070002A0000000000250028002B0004040404CE
:100080000404040402020202020203030303030342
:10009000010204081020408001020408102001021F
:1000A00004081020000000080002010000030407FB
:1000B000000000000000000011241FBECFEFD8E0B8
:1000C000DEBFCDBF21E0A0E0B1E001C01D92A930AC
:1000D000B207E1F70E945C010C94CB010C94000084
:1000E000E1EBF0E02491EDE9F0E09491E9E8F0E053
:1000F000E491EE23C9F0222339F0233001F1A8F472
:10010000213019F1223029F1F0E0EE0FFF1FEE58F7
:10011000FF4FA591B4912FB7F894EC91811126C0AF
:1001200090959E239C932FBF08952730A9F02830E7
:10013000C9F0243049F7209180002F7D03C0209121
:1001400080002F7720938000DFCF24B52F7724BD48
:10015000DBCF24B52F7DFBCF2091B0002F772093EC
:10016000B000D2CF2091B0002F7DF9CF9E2BDACFF7
:100170003FB7F8948091050190910601A091070185
:10018000B091080126B5A89B05C02F3F19F0019634
:10019000A11DB11D3FBFBA2FA92F982F8827BC01E1
:1001A000CD01620F711D811D911D42E0660F771F09
:1001B000881F991F4A95D1F708958F929F92AF9209
:1001C000BF92CF92DF92EF92FF920E94B8004B0154
:1001D0005C0188ECC82ED12CE12CF12C0E94B800D7
:1001E000681979098A099B09683E73408105910560
:1001F000A8F321E0C21AD108E108F10888EE880EC0
:1002000083E0981EA11CB11CC114D104E104F104C7
:1002100029F7FF90EF90DF90CF90BF90AF909F9025
:100220008F9008951F920F920FB60F9211242F9363
:100230003F938F939F93AF93BF93809101019091D0
:100240000201A0910301B09104013091000123E06B
:10025000230F2D3758F50196A11DB11D20930001E4
:100260008093010190930201A0930301B0930401D4
:100270008091050190910601A0910701B0910801BC
:100280000196A11DB11D8093050190930601A093D5
:100290000701B0930801BF91AF919F918F913F915A
:1002A0002F910F900FBE0F901F90189526E8230FE7
:1002B0000296A11DB11DD2CF789484B5826084BD11
:1002C00084B5816084BD85B5826085BD85B581605A
:1002D00085BD80916E00816080936E0010928100D8
:1002E0008091810082608093810080918100816093
:1002F0008093810080918000816080938000809154
:10030000B10084608093B1008091B00081608093DF
:10031000B00080917A00846080937A0080917A00A6
:10032000826080937A0080917A00816080937A0065
:1003300080917A00806880937A001092C100EDE984
:10034000F0E02491E9E8F0E08491882399F090E0CE
:10035000880F991FFC01E859FF4FA591B491FC014A
:10036000EE58FF4F859194918FB7F894EC91E22B62
:10037000EC938FBFC0E0D0E081E00E9470000E944B
:10038000DD0080E00E9470000E94DD002097A1F354
:0A0390000E940000F1CFF894FFCFA7
:00000001FF

Disassembling here:

avr-objdump -j .sec1 -d -m avr blink2_1.hex

blink2_1.hex:     file format ihex


Disassembly of section .sec1:

00000000 <.sec1>:
   0:   0c 94 5c 00     jmp     0xb8    ;  0xb8
   4:   0c 94 6e 00     jmp     0xdc    ;  0xdc
   8:   0c 94 6e 00     jmp     0xdc    ;  0xdc
   c:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  10:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  14:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  18:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  1c:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  20:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  24:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  28:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  2c:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  30:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  34:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  38:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  3c:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  40:   0c 94 12 01     jmp     0x224   ;  0x224
  44:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  48:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  4c:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  50:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  54:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  58:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  5c:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  60:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  64:   0c 94 6e 00     jmp     0xdc    ;  0xdc
  68:   00 00           nop
  6a:   00 00           nop
  6c:   24 00           .word   0x0024  ; ????
  6e:   27 00           .word   0x0027  ; ????
  70:   2a 00           .word   0x002a  ; ????
  72:   00 00           nop
  74:   00 00           nop
  76:   25 00           .word   0x0025  ; ????
  78:   28 00           .word   0x0028  ; ????
  7a:   2b 00           .word   0x002b  ; ????
  7c:   04 04           cpc     r0, r4
  7e:   04 04           cpc     r0, r4
  80:   04 04           cpc     r0, r4
  82:   04 04           cpc     r0, r4
  84:   02 02           muls    r16, r18
  86:   02 02           muls    r16, r18
  88:   02 02           muls    r16, r18
  8a:   03 03           mulsu   r16, r19
  8c:   03 03           mulsu   r16, r19
  8e:   03 03           mulsu   r16, r19
  90:   01 02           muls    r16, r17
  92:   04 08           sbc     r0, r4
  94:   10 20           and     r1, r0
  96:   40 80           ld      r4, Z
  98:   01 02           muls    r16, r17
  9a:   04 08           sbc     r0, r4
  9c:   10 20           and     r1, r0
  9e:   01 02           muls    r16, r17
  a0:   04 08           sbc     r0, r4
  a2:   10 20           and     r1, r0
  a4:   00 00           nop
  a6:   00 08           sbc     r0, r0
  a8:   00 02           muls    r16, r16
  aa:   01 00           .word   0x0001  ; ????
  ac:   00 03           mulsu   r16, r16
  ae:   04 07           cpc     r16, r20
        ...
  b8:   11 24           eor     r1, r1
  ba:   1f be           out     0x3f, r1        ; 63
  bc:   cf ef           ldi     r28, 0xFF       ; 255
  be:   d8 e0           ldi     r29, 0x08       ; 8
  c0:   de bf           out     0x3e, r29       ; 62
  c2:   cd bf           out     0x3d, r28       ; 61
  c4:   21 e0           ldi     r18, 0x01       ; 1
  c6:   a0 e0           ldi     r26, 0x00       ; 0
  c8:   b1 e0           ldi     r27, 0x01       ; 1
  ca:   01 c0           rjmp    .+2             ;  0xce
  cc:   1d 92           st      X+, r1
  ce:   a9 30           cpi     r26, 0x09       ; 9
  d0:   b2 07           cpc     r27, r18
  d2:   e1 f7           brne    .-8             ;  0xcc
  d4:   0e 94 5c 01     call    0x2b8   ;  0x2b8
  d8:   0c 94 cb 01     jmp     0x396   ;  0x396
  dc:   0c 94 00 00     jmp     0       ;  0x0
  e0:   e1 eb           ldi     r30, 0xB1       ; 177
  e2:   f0 e0           ldi     r31, 0x00       ; 0
  e4:   24 91           lpm     r18, Z
  e6:   ed e9           ldi     r30, 0x9D       ; 157
  e8:   f0 e0           ldi     r31, 0x00       ; 0
  ea:   94 91           lpm     r25, Z
  ec:   e9 e8           ldi     r30, 0x89       ; 137
  ee:   f0 e0           ldi     r31, 0x00       ; 0
  f0:   e4 91           lpm     r30, Z
  f2:   ee 23           and     r30, r30
  f4:   c9 f0           breq    .+50            ;  0x128
  f6:   22 23           and     r18, r18
  f8:   39 f0           breq    .+14            ;  0x108
  fa:   23 30           cpi     r18, 0x03       ; 3
  fc:   01 f1           breq    .+64            ;  0x13e
  fe:   a8 f4           brcc    .+42            ;  0x12a
 100:   21 30           cpi     r18, 0x01       ; 1
 102:   19 f1           breq    .+70            ;  0x14a
 104:   22 30           cpi     r18, 0x02       ; 2
 106:   29 f1           breq    .+74            ;  0x152
 108:   f0 e0           ldi     r31, 0x00       ; 0
 10a:   ee 0f           add     r30, r30
 10c:   ff 1f           adc     r31, r31
 10e:   ee 58           subi    r30, 0x8E       ; 142
 110:   ff 4f           sbci    r31, 0xFF       ; 255
 112:   a5 91           lpm     r26, Z+
 114:   b4 91           lpm     r27, Z
 116:   2f b7           in      r18, 0x3f       ; 63
 118:   f8 94           cli
 11a:   ec 91           ld      r30, X
 11c:   81 11           cpse    r24, r1
 11e:   26 c0           rjmp    .+76            ;  0x16c
 120:   90 95           com     r25
 122:   9e 23           and     r25, r30
 124:   9c 93           st      X, r25
 126:   2f bf           out     0x3f, r18       ; 63
 128:   08 95           ret
 12a:   27 30           cpi     r18, 0x07       ; 7
 12c:   a9 f0           breq    .+42            ;  0x158
 12e:   28 30           cpi     r18, 0x08       ; 8
 130:   c9 f0           breq    .+50            ;  0x164
 132:   24 30           cpi     r18, 0x04       ; 4
 134:   49 f7           brne    .-46            ;  0x108
 136:   20 91 80 00     lds     r18, 0x0080     ;  0x800080
 13a:   2f 7d           andi    r18, 0xDF       ; 223
 13c:   03 c0           rjmp    .+6             ;  0x144
 13e:   20 91 80 00     lds     r18, 0x0080     ;  0x800080
 142:   2f 77           andi    r18, 0x7F       ; 127
 144:   20 93 80 00     sts     0x0080, r18     ;  0x800080
 148:   df cf           rjmp    .-66            ;  0x108
 14a:   24 b5           in      r18, 0x24       ; 36
 14c:   2f 77           andi    r18, 0x7F       ; 127
 14e:   24 bd           out     0x24, r18       ; 36
 150:   db cf           rjmp    .-74            ;  0x108
 152:   24 b5           in      r18, 0x24       ; 36
 154:   2f 7d           andi    r18, 0xDF       ; 223
 156:   fb cf           rjmp    .-10            ;  0x14e
 158:   20 91 b0 00     lds     r18, 0x00B0     ;  0x8000b0
 15c:   2f 77           andi    r18, 0x7F       ; 127
 15e:   20 93 b0 00     sts     0x00B0, r18     ;  0x8000b0
 162:   d2 cf           rjmp    .-92            ;  0x108
 164:   20 91 b0 00     lds     r18, 0x00B0     ;  0x8000b0
 168:   2f 7d           andi    r18, 0xDF       ; 223
 16a:   f9 cf           rjmp    .-14            ;  0x15e
 16c:   9e 2b           or      r25, r30
 16e:   da cf           rjmp    .-76            ;  0x124
 170:   3f b7           in      r19, 0x3f       ; 63
 172:   f8 94           cli
 174:   80 91 05 01     lds     r24, 0x0105     ;  0x800105
 178:   90 91 06 01     lds     r25, 0x0106     ;  0x800106
 17c:   a0 91 07 01     lds     r26, 0x0107     ;  0x800107
 180:   b0 91 08 01     lds     r27, 0x0108     ;  0x800108
 184:   26 b5           in      r18, 0x26       ; 38
 186:   a8 9b           sbis    0x15, 0 ; 21
 188:   05 c0           rjmp    .+10            ;  0x194
 18a:   2f 3f           cpi     r18, 0xFF       ; 255
 18c:   19 f0           breq    .+6             ;  0x194
 18e:   01 96           adiw    r24, 0x01       ; 1
 190:   a1 1d           adc     r26, r1
 192:   b1 1d           adc     r27, r1
 194:   3f bf           out     0x3f, r19       ; 63
 196:   ba 2f           mov     r27, r26
 198:   a9 2f           mov     r26, r25
 19a:   98 2f           mov     r25, r24
 19c:   88 27           eor     r24, r24
 19e:   bc 01           movw    r22, r24
 1a0:   cd 01           movw    r24, r26
 1a2:   62 0f           add     r22, r18
 1a4:   71 1d           adc     r23, r1
 1a6:   81 1d           adc     r24, r1
 1a8:   91 1d           adc     r25, r1
 1aa:   42 e0           ldi     r20, 0x02       ; 2
 1ac:   66 0f           add     r22, r22
 1ae:   77 1f           adc     r23, r23
 1b0:   88 1f           adc     r24, r24
 1b2:   99 1f           adc     r25, r25
 1b4:   4a 95           dec     r20
 1b6:   d1 f7           brne    .-12            ;  0x1ac
 1b8:   08 95           ret
 1ba:   8f 92           push    r8
 1bc:   9f 92           push    r9
 1be:   af 92           push    r10
 1c0:   bf 92           push    r11
 1c2:   cf 92           push    r12
 1c4:   df 92           push    r13
 1c6:   ef 92           push    r14
 1c8:   ff 92           push    r15
 1ca:   0e 94 b8 00     call    0x170   ;  0x170
 1ce:   4b 01           movw    r8, r22
 1d0:   5c 01           movw    r10, r24
 1d2:   88 ec           ldi     r24, 0xC8       ; 200
 1d4:   c8 2e           mov     r12, r24
 1d6:   d1 2c           mov     r13, r1
 1d8:   e1 2c           mov     r14, r1
 1da:   f1 2c           mov     r15, r1
 1dc:   0e 94 b8 00     call    0x170   ;  0x170
 1e0:   68 19           sub     r22, r8
 1e2:   79 09           sbc     r23, r9
 1e4:   8a 09           sbc     r24, r10
 1e6:   9b 09           sbc     r25, r11
 1e8:   68 3e           cpi     r22, 0xE8       ; 232
 1ea:   73 40           sbci    r23, 0x03       ; 3
 1ec:   81 05           cpc     r24, r1
 1ee:   91 05           cpc     r25, r1
 1f0:   a8 f3           brcs    .-22            ;  0x1dc
 1f2:   21 e0           ldi     r18, 0x01       ; 1
 1f4:   c2 1a           sub     r12, r18
 1f6:   d1 08           sbc     r13, r1
 1f8:   e1 08           sbc     r14, r1
 1fa:   f1 08           sbc     r15, r1
 1fc:   88 ee           ldi     r24, 0xE8       ; 232
 1fe:   88 0e           add     r8, r24
 200:   83 e0           ldi     r24, 0x03       ; 3
 202:   98 1e           adc     r9, r24
 204:   a1 1c           adc     r10, r1
 206:   b1 1c           adc     r11, r1
 208:   c1 14           cp      r12, r1
 20a:   d1 04           cpc     r13, r1
 20c:   e1 04           cpc     r14, r1
 20e:   f1 04           cpc     r15, r1
 210:   29 f7           brne    .-54            ;  0x1dc
 212:   ff 90           pop     r15
 214:   ef 90           pop     r14
 216:   df 90           pop     r13
 218:   cf 90           pop     r12
 21a:   bf 90           pop     r11
 21c:   af 90           pop     r10
 21e:   9f 90           pop     r9
 220:   8f 90           pop     r8
 222:   08 95           ret
 224:   1f 92           push    r1
 226:   0f 92           push    r0
 228:   0f b6           in      r0, 0x3f        ; 63
 22a:   0f 92           push    r0
 22c:   11 24           eor     r1, r1
 22e:   2f 93           push    r18
 230:   3f 93           push    r19
 232:   8f 93           push    r24
 234:   9f 93           push    r25
 236:   af 93           push    r26
 238:   bf 93           push    r27
 23a:   80 91 01 01     lds     r24, 0x0101     ;  0x800101
 23e:   90 91 02 01     lds     r25, 0x0102     ;  0x800102
 242:   a0 91 03 01     lds     r26, 0x0103     ;  0x800103
 246:   b0 91 04 01     lds     r27, 0x0104     ;  0x800104
 24a:   30 91 00 01     lds     r19, 0x0100     ;  0x800100
 24e:   23 e0           ldi     r18, 0x03       ; 3
 250:   23 0f           add     r18, r19
 252:   2d 37           cpi     r18, 0x7D       ; 125
 254:   58 f5           brcc    .+86            ;  0x2ac
 256:   01 96           adiw    r24, 0x01       ; 1
 258:   a1 1d           adc     r26, r1
 25a:   b1 1d           adc     r27, r1
 25c:   20 93 00 01     sts     0x0100, r18     ;  0x800100
 260:   80 93 01 01     sts     0x0101, r24     ;  0x800101
 264:   90 93 02 01     sts     0x0102, r25     ;  0x800102
 268:   a0 93 03 01     sts     0x0103, r26     ;  0x800103
 26c:   b0 93 04 01     sts     0x0104, r27     ;  0x800104
 270:   80 91 05 01     lds     r24, 0x0105     ;  0x800105
 274:   90 91 06 01     lds     r25, 0x0106     ;  0x800106
 278:   a0 91 07 01     lds     r26, 0x0107     ;  0x800107
 27c:   b0 91 08 01     lds     r27, 0x0108     ;  0x800108
 280:   01 96           adiw    r24, 0x01       ; 1
 282:   a1 1d           adc     r26, r1
 284:   b1 1d           adc     r27, r1
 286:   80 93 05 01     sts     0x0105, r24     ;  0x800105
 28a:   90 93 06 01     sts     0x0106, r25     ;  0x800106
 28e:   a0 93 07 01     sts     0x0107, r26     ;  0x800107
 292:   b0 93 08 01     sts     0x0108, r27     ;  0x800108
 296:   bf 91           pop     r27
 298:   af 91           pop     r26
 29a:   9f 91           pop     r25
 29c:   8f 91           pop     r24
 29e:   3f 91           pop     r19
 2a0:   2f 91           pop     r18
 2a2:   0f 90           pop     r0
 2a4:   0f be           out     0x3f, r0        ; 63
 2a6:   0f 90           pop     r0
 2a8:   1f 90           pop     r1
 2aa:   18 95           reti
 2ac:   26 e8           ldi     r18, 0x86       ; 134
 2ae:   23 0f           add     r18, r19
 2b0:   02 96           adiw    r24, 0x02       ; 2
 2b2:   a1 1d           adc     r26, r1
 2b4:   b1 1d           adc     r27, r1
 2b6:   d2 cf           rjmp    .-92            ;  0x25c
 2b8:   78 94           sei
 2ba:   84 b5           in      r24, 0x24       ; 36
 2bc:   82 60           ori     r24, 0x02       ; 2
 2be:   84 bd           out     0x24, r24       ; 36
 2c0:   84 b5           in      r24, 0x24       ; 36
 2c2:   81 60           ori     r24, 0x01       ; 1
 2c4:   84 bd           out     0x24, r24       ; 36
 2c6:   85 b5           in      r24, 0x25       ; 37
 2c8:   82 60           ori     r24, 0x02       ; 2
 2ca:   85 bd           out     0x25, r24       ; 37
 2cc:   85 b5           in      r24, 0x25       ; 37
 2ce:   81 60           ori     r24, 0x01       ; 1
 2d0:   85 bd           out     0x25, r24       ; 37
 2d2:   80 91 6e 00     lds     r24, 0x006E     ;  0x80006e
 2d6:   81 60           ori     r24, 0x01       ; 1
 2d8:   80 93 6e 00     sts     0x006E, r24     ;  0x80006e
 2dc:   10 92 81 00     sts     0x0081, r1      ;  0x800081
 2e0:   80 91 81 00     lds     r24, 0x0081     ;  0x800081
 2e4:   82 60           ori     r24, 0x02       ; 2
 2e6:   80 93 81 00     sts     0x0081, r24     ;  0x800081
 2ea:   80 91 81 00     lds     r24, 0x0081     ;  0x800081
 2ee:   81 60           ori     r24, 0x01       ; 1
 2f0:   80 93 81 00     sts     0x0081, r24     ;  0x800081
 2f4:   80 91 80 00     lds     r24, 0x0080     ;  0x800080
 2f8:   81 60           ori     r24, 0x01       ; 1
 2fa:   80 93 80 00     sts     0x0080, r24     ;  0x800080
 2fe:   80 91 b1 00     lds     r24, 0x00B1     ;  0x8000b1
 302:   84 60           ori     r24, 0x04       ; 4
 304:   80 93 b1 00     sts     0x00B1, r24     ;  0x8000b1
 308:   80 91 b0 00     lds     r24, 0x00B0     ;  0x8000b0
 30c:   81 60           ori     r24, 0x01       ; 1
 30e:   80 93 b0 00     sts     0x00B0, r24     ;  0x8000b0
 312:   80 91 7a 00     lds     r24, 0x007A     ;  0x80007a
 316:   84 60           ori     r24, 0x04       ; 4
 318:   80 93 7a 00     sts     0x007A, r24     ;  0x80007a
 31c:   80 91 7a 00     lds     r24, 0x007A     ;  0x80007a
 320:   82 60           ori     r24, 0x02       ; 2
 322:   80 93 7a 00     sts     0x007A, r24     ;  0x80007a
 326:   80 91 7a 00     lds     r24, 0x007A     ;  0x80007a
 32a:   81 60           ori     r24, 0x01       ; 1
 32c:   80 93 7a 00     sts     0x007A, r24     ;  0x80007a
 330:   80 91 7a 00     lds     r24, 0x007A     ;  0x80007a
 334:   80 68           ori     r24, 0x80       ; 128
 336:   80 93 7a 00     sts     0x007A, r24     ;  0x80007a
 33a:   10 92 c1 00     sts     0x00C1, r1      ;  0x8000c1
 33e:   ed e9           ldi     r30, 0x9D       ; 157
 340:   f0 e0           ldi     r31, 0x00       ; 0
 342:   24 91           lpm     r18, Z
 344:   e9 e8           ldi     r30, 0x89       ; 137
 346:   f0 e0           ldi     r31, 0x00       ; 0
 348:   84 91           lpm     r24, Z
 34a:   88 23           and     r24, r24
 34c:   99 f0           breq    .+38            ;  0x374
 34e:   90 e0           ldi     r25, 0x00       ; 0
 350:   88 0f           add     r24, r24
 352:   99 1f           adc     r25, r25
 354:   fc 01           movw    r30, r24
 356:   e8 59           subi    r30, 0x98       ; 152
 358:   ff 4f           sbci    r31, 0xFF       ; 255
 35a:   a5 91           lpm     r26, Z+
 35c:   b4 91           lpm     r27, Z
 35e:   fc 01           movw    r30, r24
 360:   ee 58           subi    r30, 0x8E       ; 142
 362:   ff 4f           sbci    r31, 0xFF       ; 255
 364:   85 91           lpm     r24, Z+
 366:   94 91           lpm     r25, Z
 368:   8f b7           in      r24, 0x3f       ; 63
 36a:   f8 94           cli
 36c:   ec 91           ld      r30, X
 36e:   e2 2b           or      r30, r18
 370:   ec 93           st      X, r30
 372:   8f bf           out     0x3f, r24       ; 63
 374:   c0 e0           ldi     r28, 0x00       ; 0
 376:   d0 e0           ldi     r29, 0x00       ; 0
 378:   81 e0           ldi     r24, 0x01       ; 1
 37a:   0e 94 70 00     call    0xe0    ;  0xe0
 37e:   0e 94 dd 00     call    0x1ba   ;  0x1ba
 382:   80 e0           ldi     r24, 0x00       ; 0
 384:   0e 94 70 00     call    0xe0    ;  0xe0
 388:   0e 94 dd 00     call    0x1ba   ;  0x1ba
 38c:   20 97           sbiw    r28, 0x00       ; 0
 38e:   a1 f3           breq    .-24            ;  0x378
 390:   0e 94 00 00     call    0       ;  0x0
 394:   f1 cf           rjmp    .-30            ;  0x378
 396:   f8 94           cli
 398:   ff cf           rjmp    .-2             ;  0x398

I only found the numbers 200 in line 1d2, I think this is the duration of the pauses between commands for LED.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.