Use a PIC programmer/debugger to connect to the microcontroller
Read the device memory through the programmer software
Save or export the contents as a HEX file
Use MPLAB X IDE with a supported programmer such as PICkit or ICD
Open the programmer tool and select the target PIC device
Choose the read memory or export HEX option
If the device is protected, disable code protection first if possible
Use a bootloader if the PIC was programmed to allow firmware upload/download
Read program memory, configuration bits, and EEPROM if needed
Verify the exported HEX file by reopening it in the IDE or programmer software
Use command-line tools if supported by the programmer
Ensure the correct device family and memory size are selected
Back up the HEX file immediately after reading it
