新闻  |   论坛  |   博客  |   在线研讨会
张明峰书8-7
chen3bing | 2024-05-12 08:00:37    阅读:43   发布文章

代码

#include<p16f877.inc>

CRC_RESULT equ	0x20
	
	org 0x000
	goto main
	org 0x020
main
	MOVLW 	0X00
	MOVWF	CRC_RESULT
	movlw 	0x96
	CALL	CRC_CAL2
	GOTO	$

CRC_CAL2
	XORWF	CRC_RESULT,F
	CALL	CRC_Lookup
	movwf	CRC_RESULT
	return

CRC_Lookup
	movlw	high(CRC_TABLE)
	MOVWF	PCLATH
	MOVLW	low(CRC_TABLE)
	ADDWF	CRC_RESULT,W
	SKPNC
	INCF	PCLATH,F
	MOVWF	PCL

CRC_TABLE

dt 00h,5eh,0bch,0e2h,61h,3fh,0ddh,83h
dt 0c2h,9ch,07eh,020h,0a3h,0fdh,01fh,41h
dt 9dh,0c3h,021h,07fh,0fch,0a2h,040h,1eh
dt 5fh,1h,0e3h,0bdh,3eh,60h,82h,0dch

dt 23h,7dh,9fh,0c1h,42h,1ch,0feh,0a0h
dt 0e1h,0bfh,5dh,03h,80h,0deh,3ch,62h
dt 0beh,0e0h,2h,5ch,0dfh,81h,63h,3dh
dt 7ch,22h,0c0h,9eh,1dh,43h,0a1h,0ffh

dt 46h,18h,0fah,0a4h,27h,79h,9bh,0c5h
dt 84h,0dah,38h,66h,0e5h,0bbh,59h,7h
dt 0dbh,85h,67h,39h,0bah,0e4h,6h,58h
dt 19h,47h,0a5h,0fbh,78h,26h,0c4h,9ah    ;12

dt 65h,3bh,0d9h,87h,4h,5ah,0b8h,0e6h
dt 0a7h,0f9h,1bh,45h,0c6h,98h,7ah,24h
dt 0f8h,0a6h,44h,1ah,99h,0c7h,25h,7bh
dt 3ah,64h,86h,0d8h,5bh,5h,0e7h,0b9h		;16

dt 8ch,0d2h,30h,06eh,0edh,0b3h,51h,0fh
dt 4eh,10h,0f2h,0ach,2fh,71h,93h,0cdh
dt 11h,4fh,0adh,0f3h,70h,2eh,0cch,92h
dt 0d3h,8dh,6fh,31h,0b2h,0ech,0eh,50h   ;20

dt 0afh,0f1h,13h,4dh,0ceh,90h,72h,02h
dt 6dh,33h,0d1h,8fh,0ch,52h,0b0h,0eeh
dt 32h,6ch,8eh,0d0h,53h,0dh,0efh,0b1h
dt 0f0h,0aeh,4ch,12h,91h,0cfh,2dh,73h   ;24

dt 0cah,94h,76h,28h,0abh,0f5h,17h,49h
dt 08h,56h,0b4h,0eah,69h,37h,0d5h,08bh
dt 57h,9h,0ebh,0b5h,36h,68h,8ah,0d4h
dt 95h,0cbh,29h,77h,0f4h,0aah,48h,16h   ;28

dt 0e9h,0b7h,55h,0bh,88h,0d6h,34h,6ah
dt 2bh,75h,97h,0c9h,4ah,14h,0f6h,0a8h
dt 74h,2ah,0c8h,96h,15h,4bh,0a9h,0f7h
dt 0b6h,0e8h,0ah,54h,0d7h,89h,6bh,35h

end

仿真效果图


*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
1
最近文章
方波振荡电路
2024-09-14 14:59:39
6V3A电路
2024-09-14 14:18:10
MOS管点灯仿真
2024-09-12 15:43:13
推荐文章
最近访客