ckmain.c
来自「Hitech microchip PIC C18 Compiler」· C语言 代码 · 共 28 行
C
28 行
#include <htc.h>#include "cksum.h"/** A simple example of how one can runtime-verify a checksum * that was generated using the compiler's --checksum option * The pre-compiled result is found in the const variable, _checksum0. * The header, cksum.h has settings that need to be adjusted to match the * --checksum specifications. */void main(void){ TRISB = 0; // output mode PORTB = 0xFF; if( cksum() != _checksum0){ while(1); // checksum error - no effect on PORTB /* My calculated checksum doesn't match the pre-compiled result... * 1) do all of the variables in cksum.h match the --checksum settings? * 2) are the ranges of calculation realistic? * 3) the size of calculation range should be a multiple of the algorithm variable. */ }else{ unsigned int delay; while(1){ // success for(delay=1000;delay;delay--) PORTB ^= 0xFF; // blink all of PORTB } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?