Re: 8051 Programming




<luisdanielsilva@xxxxxxxxx> schreef in bericht
news:1163360427.487718.18100@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I need to convert a 32 bit binary number to gray code. i know how to do
it bit by bit, but i need to do a function to do it, so that i don't
need to repeat code 32 times. Can anybody help me?

Thanks

LDS


Mmm... It's quite some time I wrote 8051 assembler, but if memory serves
it's done like this:

num1 equ 64
num2 equ 65
num3 equ 66
num4 equ 67

clr c
mov a,num1
rlc a
xrl a,num1
mov a,num2
rlc a
xrl a,num2
mov a,num3
rlc a
xrl a,num3
mov a,num4
rlc a
xrl a,num4
end

petrus bitbyter


.



Relevant Pages

  • Re: 8051 Programming
    ... num1 equ 64 ... mov a,num1 ... xrl a,num1 ...
    (sci.electronics.basics)
  • Re: Why is my nasm program killing itself?
    ... ORIGIN equ 8048000h ... mov bl, al ... mov eax, 1 ... push edx ...
    (alt.lang.asm)
  • Win x64 Questions
    ... r0d equ eax ... mov ecx,eax ... ; End strlen Function Code; ...
    (alt.lang.asm)
  • Re: 89C51ED2
    ... .EQU EMPTYS,H'2000;"NO ENERGY" will be replaced with new version ... .EQU DEFGMF,H'00;TEAM DEFAULT GAME STYLE ... MOV R3,A;STORE IT READY FOR NEXT TIME INTERRUPT ... JB GFLAG,TIMERC;GAME OVER, NO LEDS ...
    (sci.electronics.design)
  • Re: 89C51ED2
    ... ..EQU EMPTYS,H'2000;"NO ENERGY" will be replaced with new version ... MOV R3,A;STORE IT READY FOR NEXT TIME INTERRUPT ... JB GFLAG,TIMERC;GAME OVER, NO LEDS ... LJMP CKLEDS;CLOCK LEDS ROUND ...
    (sci.electronics.design)