mit lo8 oder hi8 wird erst richtig klar, wenn man Unsinn programmiert.
Ich habe so ein Beispiel gerade verwendet:
Ergebnis:Code:uint16_t i; uint16_t a = 0x0AED; while(1) { i = (PINB<<8)|PIND; i +=a; PORTB = (uint8_t)i; PORTC = (uint8_t)(i>>8); }Interessant ist hier vielleicht, daß hier subtrahiert und nicht addiert wird...Code:15:bubu.c **** i +=a; 95 .LM3: 96 001c 8351 subi r24,lo8(-(2797)) 97 001e 954F sbci r25,hi8(-(2797)) 16:bubu.c **** PORTB = (uint8_t)i; 99 .LM4: 100 0020 88BB out 56-0x20,r24 17:bubu.c **** PORTC = (uint8_t)(i>>8); 102 .LM5: 103 0022 892F mov r24,r25 104 0024 9927 clr r25 105 0026 85BB out 53-0x20,r24







Zitieren

Lesezeichen