Hallo PickNick,
irgendwie finde ich den unterschied zwischen deinem und meinem Code nicht, außer die UND Verknüpfung deren Sinn ich nicht sehe :/

Ergebnis ist bei mir genau das gleiche


Hier mal der Inline Assembler:
Code:
0000011E:   93CF        PUSH    R28              Push register on stack
+0000011F:   93DF        PUSH    R29              Push register on stack
+00000120:   B7CD        IN      R28,0x3D         In from I/O location
+00000121:   B7DE        IN      R29,0x3E         In from I/O location
+00000122:   9728        SBIW    R28,0x08         Subtract immediate from word
+00000123:   B60F        IN      R0,0x3F          In from I/O location
+00000124:   94F8        CLI                      Global Interrupt Disable
+00000125:   BFDE        OUT     0x3E,R29         Out to I/O location
+00000126:   BE0F        OUT     0x3F,R0          Out to I/O location
+00000127:   BFCD        OUT     0x3D,R28         Out to I/O location
47:         uint32_t i=0, t;
+00000128:   821D        STD     Y+5,R1           Store indirect with displacement
+00000129:   821E        STD     Y+6,R1           Store indirect with displacement
+0000012A:   821F        STD     Y+7,R1           Store indirect with displacement
+0000012B:   8618        STD     Y+8,R1           Store indirect with displacement
52:         for(i=0; i<20; i++)
+0000012C:   821D        STD     Y+5,R1           Store indirect with displacement
+0000012D:   821E        STD     Y+6,R1           Store indirect with displacement
+0000012E:   821F        STD     Y+7,R1           Store indirect with displacement
+0000012F:   8618        STD     Y+8,R1           Store indirect with displacement
+00000130:   C01D        RJMP    PC+0x001E        Relative jump
54:           t = 1<<i;

Hier fängs an:

+00000131:   812D        LDD     R18,Y+5          Load indirect with displacement
+00000132:   813E        LDD     R19,Y+6          Load indirect with displacement
+00000133:   E081        LDI     R24,0x01         Load immediate
+00000134:   E090        LDI     R25,0x00         Load immediate
+00000135:   2E02        MOV     R0,R18           Copy register
+00000136:   C002        RJMP    PC+0x0003        Relative jump
+00000137:   0F88        LSL     R24              Logical Shift Left
+00000138:   1F99        ROL     R25              Rotate Left Through Carry
+00000139:   940A        DEC     R0               Decrement
+0000013A:   F7E2        BRPL    PC-0x03          Branch if plus
+0000013B:   27AA        CLR     R26              Clear Register
+0000013C:   FD97        SBRC    R25,7            Skip if bit in register cleared
+0000013D:   95A0        COM     R26              One's complement
+0000013E:   2FBA        MOV     R27,R26          Copy register
+0000013F:   8389        STD     Y+1,R24          Store indirect with displacement
+00000140:   839A        STD     Y+2,R25          Store indirect with displacement
+00000141:   83AB        STD     Y+3,R26          Store indirect with displacement
+00000142:   83BC        STD     Y+4,R27          Store indirect with displacement
+00000143:   818D        LDD     R24,Y+5          Load indirect with displacement
+00000144:   819E        LDD     R25,Y+6          Load indirect with displacement
+00000145:   81AF        LDD     R26,Y+7          Load indirect with displacement
+00000146:   85B8        LDD     R27,Y+8          Load indirect with displacement
+00000147:   9601        ADIW    R24,0x01         Add immediate to word
+00000148:   1DA1        ADC     R26,R1           Add with carry
+00000149:   1DB1        ADC     R27,R1           Add with carry
+0000014A:   838D        STD     Y+5,R24          Store indirect with displacement
+0000014B:   839E        STD     Y+6,R25          Store indirect with displacement
+0000014C:   83AF        STD     Y+7,R26          Store indirect with displacement
+0000014D:   87B8        STD     Y+8,R27          Store indirect with displacement
+0000014E:   818D        LDD     R24,Y+5          Load indirect with displacement
+0000014F:   819E        LDD     R25,Y+6          Load indirect with displacement
---- No Source ------------------------------------------------------------------------------------
+00000150:   81AF        LDD     R26,Y+7          Load indirect with displacement
+00000151:   85B8        LDD     R27,Y+8          Load indirect with displacement
+00000152:   3184        CPI     R24,0x14         Compare with immediate
+00000153:   0591        CPC     R25,R1           Compare with carry
+00000154:   05A1        CPC     R26,R1           Compare with carry
+00000155:   05B1        CPC     R27,R1           Compare with carry
+00000156:   F2D0        BRCS    PC-0x25          Branch if carry set
ich glaube das das Problem bei Speicherstelle +00000131 und folgenden liegt. Hier werden Y+5 und Y+6 in R18 und R19 kopiert. Das sind aber nur 2 byte, meine uint32_t Variablen haben ja 4 .
Gleiches geschieht an Stelle +00000133 wo R24 und R5 beschrieben werden, nicht jedoch R26 und R27.

Kann eigentlich kein Assembler, aber liege ich richtig in der Annahme das hier der Fehler liegt?

lg MoFe