Searching \ for 'Anyone have 32 bit Binary to Ascii conversion code' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=anyone+bit+binary
Search entire site for: 'Anyone have 32 bit Binary to Ascii conversion code'.

Truncated match.
'Anyone have 32 bit Binary to Ascii conversion code'
1996\10\02@114101 by

One of the things I need to get a 16C57 to do is to convert a 32 bit binary
number to ascii for output to an LCD display.  I know an algorithm for doing
this but being new to this pic world I wondered if anyone would share code
or offer some suggestions or 'tricks' that might be helpful for doing this.

Thanks

One of the things I need to get a 16C57 to do is to convert a 32 bit binary
number to ascii for output to an LCD display.  I know an algorithm for doing
this but being new to this pic world I wondered if anyone would share code
or offer some suggestions or 'tricks' that might be helpful for doing this.

Thanks

Ted Linn wrote:
>
> One of the things I need to get a 16C57 to do is to convert a 32 bit binary
> number to ascii for output to an LCD display.  I know an algorithm for doing
> this but being new to this pic world I wondered if anyone would share code
> or offer some suggestions or 'tricks' that might be helpful for doing this.
>
> Thanks

This routine converts a 32 bit binary number to BCD compacted,
to convert to ASCII just split the nibbles and add '0'
;******************************************************
; BIN2BCD
;RECEIVE BINARY NUMBER IN REG4,REG3,REG2,REG1 AND RETURN
DIG4,DIG3,DIG2,DIG1 AS BCD
;******************************************************
BIN2BCD
BCF     STATUS,C
MOVLW   32
MOVWF   COUNT
CLRF    DIG6
CLRF    DIG5
CLRF    DIG4
CLRF    DIG3
CLRF    DIG2
CLRF    DIG1
LOOP24  RLF     REG1,1
RLF     REG2,1
RLF     REG3,1
RLF     REG4,1
RLF     DIG1,1
RLF     DIG2,1
RLF     DIG3,1
RLF     DIG4,1
RLF     DIG5,1
RLF     DIG6,1
DECFSZ  COUNT,1
RETURN
MOVLW   DIG1
MOVWF   FSR
MOVLW   DIG2
MOVWF   FSR
MOVLW   DIG3
MOVWF   FSR
MOVLW   DIG4
MOVWF   FSR
GOTO    LOOP24

MOVLW   3
MOVWF   TEMP
BTFSC   TEMP,3
MOVWF   0
MOVLW   0x30
MOVWF   TEMP
BTFSC   TEMP,7
MOVWF   0
RETLW   0

Octavio
--
========================================================
Octavio Nogueira
e-mail:   nogueiramandic.com.br
homepage: http://ourworld.compuserve.com/homepages/tato
voice/fax: +55 11 240-6474
========================================================
"ProPic" The first Production PIC Programmer running in
Windows and under US\$ 20.00.
Avaible at http://ourworld.compuserve.com/homepages/tato

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...