|
;Update CRC:
;Input: temp - data byte
;Z - pointer to Rx_Str or Tx_Str
;Out: [Z+x_Crc] - new CRC valueDo_CRC: push YL
push YH
ldi Cnt,8 ;Set to shift eight bits
ldd YH,Z+x_Crc
CRCL: mov YL,temp
eor YL,YH ;Calculate DQIN xor CRCT0
ror YL ;Move it to the carry
brcc ZERO ;Skip if DQIN xor CRCT0 = 0
ldi YL,0x18
eor YH,YL ;Update the CRC value
ZERO: ror YH ;Position the new CRC
lsr temp ;Position next bit in LSB
dec Cnt
brne CRCL ;Repeat for eight bits
std Z+x_Crc,YH
pop YH
pop YL
ret ;Return
E-mail: info@telesys.ru