Write subroutines Bin2BCD, BCD2Bin to achieve the conversion of binary to compressed BCD code. The binary number to be converted is stored in the w register. The BCD code obtained after the subroutine call is completed is still stored in the w register. E.g: Movlw .45 ; w=45 Call Bin2BCD ; Nop ; w=0x45 The method of converting binary code to BCD code is to shift the binary code to the left 8 times. After each shift, check whether the lower four bits are greater than 4. If the number is greater than 4 then the lower four bits are added to 3; otherwise, they are not added; the higher 4 bits are the same. deal with. Block diagram: Since the compressed BCD code is a decimal number, so long as it takes the upper four bits and the lower four bits, the upper four bits are multiplied by 10D plus the lower four bits. For programming convenience, multiply 10D into cumulative 10 times. Block diagram: Conecting Terminals Without Screws Conecting Terminals Without Screws,Cold Pressing Terminals,Low Pressure Cold Shrinkage Terminal,Cold Shrinkage Cable Terminals Taixing Longyi Terminals Co.,Ltd. , https://www.longyicopperlugs.com