简体   繁体   中英

Assembly AVR Instruction LDI r22, 0x3D

Hi guys I'm trying to work out an AVR Instruction to machine code

LDI r22, 0x3D

LDI Rd, K 

1110 KKKK dddd KKKK 

so far I've got

1110 0011 dddd 1101 

, how can dddd be covered in 4 bits if the maximum is 15.. ?

any help would be greatly appreciated.

LDI - Load Immediate

Description: Loads an 8 bit constant directly to register 16 to 31.

To encode a value of 16-31, you only need 4 bits (3-0) if you assume bit 4 to always be 1.

In your case, the encoding would be;

1110 0011 0110 1101 (where dddd is 6 since 16 + 6 = 22)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM