| 
 All about PIC microcontrollers
 
 Within these pages, you can find many useful pieces of code mostly in assembly for the Microchip PIC micro controller family. A lot of people have spend many hours trying to put the bits and bytes together. If the code is NOT written by a member of the PCB Heaven community, then a link will be added above the code with the original website that this code was found.
 Because the code is copied to our servers, you should know that:
 
 
 
The responsible web master of the website that the code is taken, has been informed and he has agreed to copy the codeAll emails from the above contact have been kept as records but due to personal privacy cannot be shown in public. The author of the code is always clearly indicated above the code. In some cases the author is unknown. If you happen to be the author of the code or you know the person who wrote it, please inform us by email and it will be added ASAP. We would personally like to send the credits to all the people that managed to write some very interesting code and publish it, and special thanx to the people that originally hosted those code snippets and gave us the permission to copy them.
 
 
 View code
 Binary to ASCII, 8 bit to 3 digits
 Unknown author
 This code was originally located @ http://www.piclist.com
 
 
 Follow this link to go back
 
 
 | BIN2BCD 
 ;---------------------
 
 
 ;in: BIN
 ;out huns. tens, ones
 
 ;uses ADD-3 algoerthm
 
 movlw 8
 movwf count
 clrf huns
 clrf tens
 clrf ones
 
 BCDADD3
 
 movlw 5
 subwf huns, 0
 btfsc STATUS, C
 CALL ADD3HUNS
 
 movlw 5
 subwf tens, 0
 btfsc STATUS, C
 CALL ADD3TENS
 
 movlw 5
 subwf ones, 0
 btfsc STATUS, C
 CALL ADD3ONES
 
 decf count, 1
 bcf STATUS, C
 rlf BIN, 1
 rlf ones, 1
 btfsc ones,4 ;
 CALL CARRYONES
 rlf tens, 1
 
 btfsc tens,4 ;
 CALL CARRYTENS
 rlf huns,1
 bcf STATUS, C
 
 movf count, 0
 btfss STATUS, Z
 GOTO BCDADD3
 
 
 movf huns, 0 ; add ASCII Offset
 addlw h'30'
 movwf huns
 
 movf tens, 0 ; add ASCII Offset
 addlw h'30'
 movwf tens
 
 movf ones, 0 ; add ASCII Offset
 addlw h'30'
 movwf ones
 
 RETURN
 
 ADD3HUNS
 
 movlw 3
 addwf huns,1
 
 RETURN
 
 ADD3TENS
 
 movlw 3
 addwf tens,1
 
 RETURN
 
 ADD3ONES
 
 movlw 3
 addwf ones,1
 
 RETURN
 
 CARRYONES
 bcf ones, 4
 bsf STATUS, C
 RETURN
 
 CARRYTENS
 bcf tens, 4
 bsf STATUS, C
 RETURN
 | 
 Follow this link to go back
 
 
 
 
 
 
 | 
 
 
 
 |  HOT in heaven! 
 
   | 
 
 |