Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/10/09 08:53
Read: times


 
#165967 - conver ASCII to bin and viceversa and interface
Responding to: ???'s previous message
I enter a part of code that translate ASCII to binary :

I must use 8251 because it build in in my kit:
I have now problem that HyperTerminal can"t run when I run my compiler kit
and so I can't see the result,
about speed I send data in 4800 baudrate so it's not so fast
ASC2BIN: ;Convert from ASCII to Binary
MOV A,R2 ;Inputs: R2,R3
LCALL BIN ;Output: A
SWAP A ;R2 - M.S.D R3 - L.S.D
MOV R2,A
MOV A,R3
LCALL BIN
ADD A,R2
RET
;
BIN: CLR C
SUBB A,#3AH
JNC BIN2
ADD A,#0AH
RET
BIN2: ADD A,#3
RET

BIN2ASC:
MOV R4,A ;Convert from Binary to ASCII
SWAP A ;Input: A
LCALL ASC ;Outputs: R2,R3
MOV R2,A ;R2 - M.S.D R3 - L.S.D
MOV A,R4
LCALL ASC
MOV R3,A
RET
;
ASC: ANL A,#0FH
CLR C
SUBB A,#0AH
JNC ASC2
ADD A,#3AH
RET
ASC2: ADD A,#41H
RET

List of 12 messages in thread
TopicAuthorDate
transmit/recieve character by using 8051 and USART            01/01/70 00:00      
   Be sure your 8251 is fast enough            01/01/70 00:00      
      conver ASCII to bin and viceversa and interface            01/01/70 00:00      
         translate ASCII to binary ? [edited]            01/01/70 00:00      
            65 base 10 = 41 base 16            01/01/70 00:00      
               Corrected!            01/01/70 00:00      
         binary to hex            01/01/70 00:00      
            Text representation of numbers            01/01/70 00:00      
               connection with HyperLink            01/01/70 00:00      
                  unplug and plug            01/01/70 00:00      
   Question about Polling method for send recieve data            01/01/70 00:00      
      yes, and no            01/01/70 00:00      

Back to Subject List