DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

SN8P1602B Ver la hoja de datos (PDF) - Sonix Technology Co., Ltd

Número de pieza
componentes Descripción
Fabricante
SN8P1602B
SONiX
Sonix Technology Co., Ltd SONiX
SN8P1602B Datasheet PDF : 76 Pages
First Prev 11 12 13 14 15 16 17 18 19 20 Next Last
SN8P1602B
8-Bit Micro-Controller
CHECKSUM CALCULATION
The ROM addresses 0004H~0007H and last address are reserved area. User should avoid these addresses
(0004H~0007H and last address) when calculate the Checksum value.
Example:
The demo program shows how to avoid 0004H~0007H when calculated Checksum from 00H to the end of
user’s code
MOV
A,#END_USER_CODE$L
B0MOV END_ADDR1,A
;save low end address to end_addr1
MOV
A,#END_USER_CODE$M
B0MOV END_ADDR2,A
;save middle end address to end_addr2
CLR
Y
;set Y to 00H
CLR
Z
;set Z to 00H
@@:
CALL
YZ_CHECK
;call function of check yz value
MOVC
;
B0BSET FC
;clear C flag
ADD
DATA1,A
;add A to Data1
MOV
A,R
ADC
DATA2,A
;add R to Data2
JMP
END_CHECK
;check if the YZ address = the end of code
AAA:
INCMS Z
;Z=Z+1
JMP
@B
;if Z!= 00H calculate to next address
JMP
Y_ADD_1
;if Z=00H increase Y
END_CHECK:
MOV
A,END_ADDR1
CMPRS A,Z
;check if Z = low end address
JMP
AAA
;if Not jump to checksum calculate
MOV
A,END_ADDR2
CMPRS A,Y
;if Yes, check if Y = middle end address
JMP
AAA
;if Not jump to checksum calculate
JMP
CHECKSUM_END
;if Yes checksum calculated is done.
YZ_CHECK:
;check if YZ=0004H
MOV
A,#04H
CMPRS A,Z
;check if Z=04H
RET
;if Not return to checksum calculate
MOV
A,#00H
CMPRS A,Y
;if Yes, check if Y=00H
RET
;if Not return to checksum calculate
INCMS Z
;if Yes, increase 4 to Z
INCMS Z
INCMS Z
INCMS Z
RET
;set YZ=0008H then return
Y_ADD_1:
INCMS Y
;increase Y
NOP
JMP
@B
;jump to checksum calculate
CHECKSUM_END:
……….
……….
END_USER_CODE:
;Label of program end
SONiX TECHNOLOGY CO., LTD
Page 17
Version 1.2

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]