Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ATmega16

Status
Not open for further replies.

tuck

New Member
Sorry to intrupt.
Can anyone help me to solve this question?
I was trying to write a macro in ATmega16 assembly language,
that will make 76543210 to become 01237654.
but i don't know how to write it, can anyone pls help me solve it?
thank you.
(the number above is the number of bits of the register)
 
Last edited:
I didn't check it but quick and dirty

MACRO MAPBITS
clr @2
sbrc @1,7
sbr @2,0
sbrc @1,6
sbr @2,1
sbrc @1,5
sbr @2,2
sbrc @1,4
sbr @2,3
sbrc @1,3
sbr @2,7
sbrc @1,2
sbr @2,6
sbrc @1,1
sbr @2,5
sbrc @1,0
sbr @2,4
.ENDMACRO

Should work, mapbits @1 @2
The mapped contents of @1 will be in @2 at the end. Both registers need to be between 16 and 31
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top