??? 01/28/05 01:47 Read: times |
#85975 - hex to bin Responding to: ???'s previous message |
I'm feeling generous today! mov a,#67 call hex2bin loop: sjmp loop ; value to convert in A ; uses A,R2,R3 hex2bin: mov r3,a ;save value in R3 mov R2,#8 ;8 bits to convert h1_loop: mov a,r3 rlc a ;get bit into carry mov r3,a jc one mov a,#'0' ;if a '0' bit sjmp h2 one: mov a,#'1' ;if a '1' bit h2: call plcd ;char in A to lcd djnz r2,h1_loop ;do for the 8 bits ret This should print 8 bits of 1's and 0's depending on the input value. Is this what you wanted? This code was concocted off the top of my head so there may be errors, but the basic concept is there. |
Topic | Author | Date |
Hex 2 Bin problem with program 8051 | 01/01/70 00:00 | |
you do it first | 01/01/70 00:00 | |
hex to bin | 01/01/70 00:00 | |
Re: hex to bin | 01/01/70 00:00 | |
Surely: BCD to bin (hex is bin?) | 01/01/70 00:00 | |
like this | 01/01/70 00:00 | |
brackets![]() | 01/01/70 00:00 | |
Posting | 01/01/70 00:00 | |
better code | 01/01/70 00:00 | |
if you can't explain | 01/01/70 00:00 |