In this post we shall discuss the following common problems faced by newbies & their solutions.
1. My .c file is not showing under Source files.
2. After selecting HITECH UNIVERSAL TOOLSUITE from under Toolsuite Contents , there is an X mark seen near the Location.
3. I do not see the .HEX file generated.
4. My Build is successful. Fusing of HEX file is ok , but my project is not working.
5. PICKIT2 complains that there is no Configuration bits ,while importing HEX file.
1. When you try to add your C code file .c by right clicking Source files , it lands up under Other Files.The reason is , you’ve not selected the Tool suite for HITECH C compiler & it is in Microchip ASM tool suite for Assembly language.Unless you select the Hitech C you can’t add a .c file to Source files.
Open your Project & select from
Project –> Select Language ToolSuite
Under Active Toolsuite select the HITECH UNIVERSAL TOOLSUITE
Now your .c file will appear under Source Files.
2. You see an X mark near the Location while selecting Hitech Universal Toolsuite.
The reason is that while installing the HITECH C Compiler you’ve selected a different location other than C: or you might not have checked the “Set environment path “ while installing Hitech C compiler.
Click on browse next to Location bar & go to the location where you’ve installed the C compiler & select it.
By default it is under location
Under /bin folder the executable C compiler file is picc.exe
3. Your BUILD is successful , but you do not see the HEX file.
The HEX file generated along with other files inside the Project folder. But you do not see the extension .hex
Go to Tools –> Folder Options of the Windows Explorer .
Under VIEW tab Un tick “Hide extensions for known file types “ & click OK.
Now you can see the .hex file.
4 & 5 . Setting the Configuration bits & including it in the C code is important.
Under Configure select Configuration Bits.
A new window opens. Uncheck the box “Configuration Bits set in code “ to enable editing the bits.
By default the Oscillator is set to RC Oscillator.But in your project you use an external crystal of 8 or 20MHz.From the drop down menu select HS Oscillator which stands for usage of High Frequency oscillator.
Disable Watch Dog timer,Power up timer & Brown out Reset.
Generally LVP (Low Voltage Programming) is not used .So select “RB3 is Digital I/O,HV on MCLR must be used for programming “ .
The final hex value is generated & shown under Value .(3F3A)
This Hex value should be added in your CONFIG statement of C code.Note the usage of two underscores __ before CONFIG.
Now build your project to generate HEX code with Configuration bits.
Watch this support video :