Question: how hex file is generated?
Answer: When you create a software program for a Microchip PIC, the compiler will produce an assembly file that gets assembled into a binary file, with a . hex suffix, to be loaded into the microcontroller.