Last active
June 6, 2020 00:33
-
-
Save joeynovak/ad825078df70c26715d698681e7a2677 to your computer and use it in GitHub Desktop.
Pic16 debugging by pulling RB7 Low
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define bump(x) LATB7 = 1; __delay_us(x); LATB7 = 0; __delay_us(x); | |
#define bumpIfBitSet(x, y) if(x){ bump(y * 2) } else { bump(y) } | |
TRISBbits.TRISB7 = 0; | |
bump(10); | |
bumpIfBitSet(PCONbits.STKOVF, 50); | |
bumpIfBitSet(PCONbits.STKUNF, 50); | |
bumpIfBitSet(PCONbits.nRWDT, 50); | |
bumpIfBitSet(PCONbits.nRMCLR, 50); | |
bumpIfBitSet(PCONbits.nRI, 50); | |
bumpIfBitSet(PCONbits.nPOR, 50); | |
bumpIfBitSet(PCONbits.nBOR, 50); | |
bumpIfBitSet(STATUSbits.nTO, 50); | |
bumpIfBitSet(STATUSbits.nPD, 50); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Allows you to easily see the status and pcon bits that indicate why a device reset.