Searching \ for '[PIC]: 16F877 Checksum of program' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/method/errors.htm?key=checksum
Search entire site for: '16F877 Checksum of program'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F877 Checksum of program'
2000\11\21@125209 by Wynn Rostek

flavicon
face
I've designed a 16F877 into our new product, and now I've been asked to provide some diagnostics.
One of the things they are very interested in is having the CPU run a checksum of the program
it is running to insure it is running a good copy of the program. (As part of the power on self test.)

Since the code was written in Hi-Tech C I was wondering if anyone out there has attempted
this before?

TIA

Wynn Rostek

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2000\11\21@130033 by Sam Linder

flavicon
face
I have successfully implemented the ROM checksum test. Microchip provides an
example in their document TB026 "Calculating Program Memory Checksums Using
a PIC16F87X".
However, to make life easier, I'm including my code here. Hope it works ok
for you.

// addresses used for ROM Checksum test
#define ChecksumL 0x7E
#define ChecksumH 0x7F

CalcChecksum:
   bsf     STATUS,RP1      // Go to Bank 2
   bcf     STATUS,RP0
   clrf    ChecksumL       // Clear the Checksum
   clrf    ChecksumH       //   registers
   clrf    EEADR           // Set the Program Memory
   clrf    EEADRH          //   address to 0x0000

CLoop:                      // Loop for each location
   bsf     STATUS,RP1      // Required sequence
   bsf     STATUS,RP0      //   to read memory location
   bsf     EECON1,EEPGD    // Set for program mem
   bsf     EECON1,RD       // Set for read operation
   nop
   nop
   bcf     STATUS,RP0      // Go to Bank 2

   movf    EEDATA,w        // Add low byte to Checksum
   addwf   ChecksumL,f
   btfsc   STATUS,C        // Check for overflow
   incf    ChecksumH,f     // Yes, increment Checksum
   movf    EEDATH,w        // Add high byte
   addwf   ChecksumH,f

   incf    EEADR,f         // Incr. low address
   btfsc   STATUS,Z        // Check for overflow
   incf    EEADRH,f        // Increment high address

   movf    EEADRH,f        // Check to see if
   btfss   STATUS,Z        //   address wrapped
   goto    CLoop           //     from 0x0fff to 0x0000
   movf    EEADR,f
   btfss   STATUS,Z
   goto    CLoop
                           // Checkcum calculation complete
   bcf     ChecksumH,7     // Clear upper 2 bits
   bcf     ChecksumH,6     //   only 14-bit checksum
   movf    ChecksumH,f     // Checksum should be 0
   btfss   STATUS,Z
   goto    ROMError        // Checksum failed
   movf    ChecksumL,f
   btfss   STATUS,Z
   goto    ROMError        // Checksum failed
   goto    RAMTest         // Checksum passed

ROMError:
       // error handler here

RAMTest:
       // continue on with rest of boot-up tests



{Original Message removed}

2000\11\21@142647 by Andrew Kunz

flavicon
face
Wynn,

Send me a note at .....andyKILLspamspam@spam@montanadesign.com tonight and I'll send you the C source
we used.  We would force a checksum of 0 by using the Carmacon programmer, which
would automatically compute the necessary codes to do that for us.

Andy








Wynn Rostek <wynnrspamKILLspamGOLDENPRS.COM> on 11/21/2000 12:51:12 PM

Please respond to pic microcontroller discussion list <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU>








To:      EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU

cc:      (bcc: Andrew Kunz/TDI_NOTES)



Subject: [PIC]: 16F877 Checksum of program








I've designed a 16F877 into our new product, and now I've been asked to provide
some diagnostics.
One of the things they are very interested in is having the CPU run a checksum
of the program
it is running to insure it is running a good copy of the program. (As part of
the power on self test.)

Since the code was written in Hi-Tech C I was wondering if anyone out there has
attempted
this before?

TIA

Wynn Rostek

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...