Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 12th November 2007, 05:49 PM   (permalink)
Default ATmega16

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 by tuck; 12th November 2007 at 06:20 PM.
tuck is offline  
Old 13th November 2007, 01:09 AM   (permalink)
Default

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
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a
straight answer, har har."

Last edited by Sceadwian; 13th November 2007 at 01:11 AM.
Sceadwian is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 03:04 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker