This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ASM CRC

Hello All,

I have this asm crc calculation code:

            ADDCHECK   PUSH    ACC                 ;for 8031
                         ADD     A,CHEKSUM
                         RLC     A
                         JC      ADCK3
                           XRL     A,#11011101b    ;(#0DDh)
            ADCK3        MOV     CHEKSUM,A
                         CLR     C                 ;if CHK >= 244 then CHK= CHK-244
                         SUBB    A,#224            ;(#0E0h)
                         JC      ADCK4
                           MOV     CHECKSUM,A      ;<CHK> always < 224 !!!
            ADCK4      POP     ACC
                       RET
;==============================================================

            ADDCHECK:  PUSH    AX                  ;for 8086
                         ADD     AL,CHECKSUM
                         RCL     AL,1
                         JC      ADCK3
                           XOR     AL,11011101b
            ADCK3:       MOV     CHECKSUM,AL
                         SUB     AL,224
                         JC      ADCK4
                           MOV     CHECKSUM,AL
            ADCK4:     POP     AX
                       RET


I want to adapt for my current MCU C8051F340, as included asm code or "C" source code.
(I'm "C" proggramer). Can you help me?

Thank you for Attention!

Parents Reply Children