# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# PIC24FJ32MC10X -- Family Data Sheet

- 1
- 2
…
- 156
- 157
- 158
- 159
- 160
…
- 349
- 350

PIC24FJ16MC101/102 AND PIC24FJ32MC101/102/104
DS39997C-page 158 Preliminary © 2011-2012 Microchip Technology Inc.
EXAMPLE 15-1: ASSEMBLY CODE EXAMPLE FOR WRITE-PROTECTED REGISTER UNLOCK
AND FAULT CLEARING SEQUENCE
EXAMPLE 15-2: C CODE EXAMPLE FOR WRITE-PROTECTED REGISTER UNLOCK AND FAULT
CLEARING SEQUENCE
; FLTA1 pin must be pulled high externally in order to clear and disable the fault
; Writing to P1FLTBCON register requires unlock sequence
mov #0xabcd,w10 ; Load first unlock key to w10 register
mov #0x4321,w11 ; Load second unlock key to w11 register
mov #0x0000,w0 ; Load desired value of P1FLTACON register in w0
mov w10, PWM1KEY ; Write first unlock key to PWM1KEY register
mov w11, PWM1KEY ; Write second unlock key to PWM1KEY register
mov w0,P1FLTACON ; Write desired value to P1FLTACON register
; FLTB1 pin must be pulled high externally in order to clear and disable the fault
; Writing to P1FLTBCON register requires unlock sequence
mov #0xabcd,w10 ; Load first unlock key to w10 register
mov #0x4321,w11 ; Load second unlock key to w11 register
mov #0x0000,w0 ; Load desired value of P1FLTBCON register in w0
mov w10, PWM1KEY ; Write first unlock key to PWM1KEY register
mov w11, PWM1KEY ; Write second unlock key to PWM1KEY register
mov w0,P1FLTBCON ; Write desired value to P1FLTBCON register
; Enable all PWMs using PWM1CON1 register
; Writing to PWM1CON1 register requires unlock sequence
mov #0xabcd,w10 ; Load first unlock key to w10 register
mov #0x4321,w11 ; Load second unlock key to w11 register
mov #0x0077,w0 ; Load desired value of PWM1CON1 register in w0
mov w10, PWM1KEY ; Write first unlock key to PWM1KEY register
mov w11, PWM1KEY ; Write second unlock key to PWM1KEY register
mov w0,PWM1CON1 ; Write desired value to PWM1CON1 register
// FLTA1 pin must be pulled high externally in order to clear and disable the fault
// Writing to P1FLTACON register requires unlock sequence
// Use builtin function to write 0x0000 to P1FLTACON register
__builtin_write_PWMSFR(&P1FLTACON, 0x0000, &PWM1KEY);
// FLTB1 pin must be pulled high externally in order to clear and disable the fault
// Writing to P1FLTBCON register requires unlock sequence
// Use builtin function to write 0x0000 to P1FLTBCON register
__builtin_write_PWMSFR(&P1FLTBCON, 0x0000, &PWM1KEY);
// Enable all PWMs using PWM1CON1 register
// Writing to PWM1CON1 register requires unlock sequence
// Use builtin function to write 0x0077 to PWM1CON1 register
__builtin_write_PWMSFR(&PWM1CON1, 0x0077, &PWM1KEY);

- 1
- 2
…
- 156
- 157
- 158
- 159
- 160
…
- 349
- 350