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

Code for Checksum

I am working on this PLM51 code written for 80552 written many years ago.I am basically trying to re-write the whole code in embedded c using Keil.The statement given below is part of PLM51 code that deals with checksum error detection method.

DECLARE MEM$PTR WORD IDATA; /* Variables used for EPROM test */
DECLARE MEM$VAL BASED MEM$PTR BYTE CONSTANT;
DECLARE CONTROL1 WORD AT (7FFEH) CONSTANT (0FFFFH); /* checksum Eprom */
DECLARE CHECK WORD IDATA;

DO MEM$PTR=0H TO 7FFDH; CHECK=CHECK+MEM$VAL; END; CHECK=CHECK+0FFH+0FFH;/* sum last 2 bytes */ IF CHECK<>CONTROL1 THEN DO; INITIAL$ERROR=90; END;

Can someone PLEASEEEE interpret the statements above to convert to C..Else can anyone suggest a method to program checksum error detection method in embedded C.

Kat