Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
Built-in Functions
2012-2013 Microchip Technology Inc. DS50002071C-page 325
__builtin_tblwth
Description: Issues the tblwth.w instruction to write a word to Flash or EEDATA memory. You must set
up the TBLPAG to point to the appropriate page. To do this, you may make use of
__builtin_tbloffset() and __builtin_tblpage().
Please refer to the data sheet or dsPIC30F Family Reference Manual (DS70046) for com-
plete details regarding reading and writing program Flash.
Prototype: void __builtin_tblwth(unsigned int offset
unsigned int data);
Argument: offset desired memory offset
data data to be written
Return Value: None.
Assembler Operator/
Machine Instruction:
tblwth
Error Messages None.
__builtin_tblwtl
Description: Issues the tblrdl.w instruction to write a word to Flash or EEDATA memory. You must set
up the TBLPAG to point to the appropriate page. To do this, you may make use of
__builtin_tbloffset() and __builtin_tblpage().
Please refer to the data sheet or dsPIC30F Family Reference Manual (DS70046) for com-
plete details regarding reading and writing program Flash.
Prototype: void __builtin_tblwtl(unsigned int offset
unsigned int data);
Argument: offset desired memory offset
data data to be written
Return Value: None.
Assembler Operator/
Machine Instruction:
tblwtl
Error Messages None.
__
builtin_write_NVM
Description: Enables the Flash for writing by issuing the correct unlock sequence and enabling the Write
bit of the NVMCON register.
Interrupts may need to be disable for proper operation.
This builtin function can be used as a part of a complex sequence discussed in the data
sheet or family reference manual.
See this documentation for more information.
Prototype: void __builtin_write_NVM(void);
Argument: None.
Return Value: None.
Assembler Operator/
Machine Instruction:
mov #0x55, Wn
mov Wn, _NVMKEY
mov #0xAA, Wn
mov Wn, _NVMKEY
bset _NVMCON, #15
nop
nop
Error Messages None.
Protego_Release_01_05-Related-OEM-Documentation-MPLAB-XC16-C-Compiler.pdf