问题描述:

Memory in pic microcontrollers is cleared by ones so we get 3FFF for an empty word (of 14 bits). But 0b11 1111 1111 1111 is ADDLW 255 according to the datasheet. Why not fill everything with zeros (NOPs) or GOTO 0000h? What if code execution gets to those 3FFFs, will it get to reset vector 0000h eventually? If yes will there be any side effects?

Also interrupt vector 0004h is 3FFF by default, does it mean that the code after it will be executed on interrupt?

网友答案:

A typical FLASH (also EEPROM) memory is erased when all bits of memory are set to the one. During programming of FLASH memory bits can only be set to zero. So before programming of FLASH we must do a special sequence named erasing, after that the memory is ready to be programmed.

The "0b11 1111 1111 1111" opcode is ADDLW 255 and ALU should always executed it. Normally compiler translate your program and the programmer program opcodes to appropriate FLASH memory locations, after that the memory check is made, so don't care about wrong opcode execution!

相关阅读:
Top