here are a couple of BIN to ASCII converters I wrote, might be useful.;********************************************************************** ; Routine:BINtoASCII ; Input Registers:BUFFER ; Output Registers: ASCII_MSW, ASCII_LSW ; Internal Registers:None ; CALLS:None ; Function: Receives a binary number in the input register BUFFER. This ; is then converted into two ASCII output bytes. ;********************************************************************** BINtoASCII CLRF ASCII_MSW ;Clear output registers CLRF ASCII_LSW SWAPF BUFFER,W ;Get upper nibble ANDLW h'0F' ;Mask off unwanted bits MOVWF ASCII_MSW ;Save MOVLW 10 ;For BCD lower nibble only (lower 4 bits) SUBWF ASCII_MSW,W MOVLW h'30' ;If numerical add ascii value (-10) BTFSC StatusREG,C MOVLW h'37' ;If alphabetical, then add a different ascii value (-10) ADDWF ASCII_MSW,1 ;save in output reg MOVF BUFFER,W ;get lower nibble of input byte ANDLW h'0F' ;mask off unwanted data MOVWF ASCII_LSW MOVLW 10 SUBWF ASCII_LSW,W MOVLW h'30' BTFSC StatusREG,C MOVLW h'37' ADDWF ASCII_LSW,1 ;and save in output reg retlw 0
file: /Techref/microchip/math/radix/b2a-8b2d-pw.htm, 2KB, , updated: 2004/6/28 17:35, local time: 2025/5/1 16:45,
18.118.151.13:LOG IN
|
©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.piclist.com/Techref/microchip/math/radix/b2a-8b2d-pw.htm"> PIC Microcontoller Radix Math Method Binary to ASCII hexadecimal</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to www.piclist.com! |
.