Difference between revisions of "PIC Library Usage Guide"
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | ||
*''Below example demonstrates the step by step procedure to include the libraries into any applications.'' | *''Below example demonstrates the step by step procedure to include the libraries into any applications.'' | ||
− | + | '''Step 1:''' ''Open the Mplab software and select the Project Wizard from Project Menu as shown below.'' | |
− | [[File:open_mplab.png]] | + | [[File:open_mplab.png|720x480px]] |
'''Step 2:''' '' A new window opens which will guide to create and configure the project. Click next to proceed.'' | '''Step 2:''' '' A new window opens which will guide to create and configure the project. Click next to proceed.'' | ||
− | [[File:guide_createproj.png]] | + | [[File:guide_createproj.png|720x480px]] |
− | + | '''Step 3:''' ''After clicking next a new window opens to select the device, select Pic16f877A from the drop down and click next.'' | |
− | [[File:step_one.png]] | + | [[File:step_one.png|720x480px]] |
− | + | '''Step 4:''' ''Once the device is selected a new window opens to select the compiler, select Hitech Universal ToolSuite from the drop down and click next.''<br/> | |
− | Note: | + | '''Note:''' |
*''Ensure the HiTech tool chain is installed before creating the project. Evaluation version of Hitech Compiler is embedded in Mplab Setup which needs to be installed along with Mplab.'' | *''Ensure the HiTech tool chain is installed before creating the project. Evaluation version of Hitech Compiler is embedded in Mplab Setup which needs to be installed along with Mplab.'' | ||
− | [[File:step_two.png]] | + | [[File:step_two.png|720x480px]] |
− | + | '''Step 5:''' ''Upon selecting the ToolChain, Browse to the project folder and provide the suitable project name and save it. .'' | |
− | [[File:step_three.png]] | + | [[File:step_three.png|720x480px]] |
− | + | '''Step 6:''' | |
− | + | ||
+ | [[File:project_saveas.png|720x480px]] | ||
− | |||
− | |||
+ | '''Step 7:''' ''Click next to proceed as there are no files(.c/.h) to be added at this stage.'' | ||
+ | [[File:step_four.png|720x480px]] | ||
− | |||
− | |||
+ | '''Step8:''' ''Finally click finish to create the project. Now the project will be created with no initial files.'' | ||
+ | [[File:summary.png|720x480px]] | ||
− | |||
− | |||
+ | '''Step 9:''' ''Create a new .c file to write the main program.'' | ||
+ | [[File:create_newfile.png|720x480px]] | ||
− | + | ||
− | Note: | + | '''Step 10:''' ''Write your program using the library functions and save it.''<br/> |
+ | '''Note:''' | ||
*''Include the respective header files before calling any library functions. '' | *''Include the respective header files before calling any library functions. '' | ||
− | [[File:program_using_library.png]] | + | [[File:program_using_library.png|720x480px]] |
− | [[File:program_using_library1.png]] | + | [[File:program_using_library1.png|720x480px]] |
− | + | '''Step 11:''' ''Provide the suitable file name(main.c) and save it in the same project folder. '' | |
− | [[File:suitable_name.png]] | + | [[File:suitable_name.png|720x480px]] |
− | + | '''Step 12:''' ''Include your source files to the project.. '' | |
− | [[File:include_sourcefile.png]] | + | [[File:include_sourcefile.png|720x480px]] |
− | + | '''Step 13:''' ''Select all the source files which needs to be included in the project and click open.''<br/> | |
− | Note: | + | '''Note:''' |
*''Library files should be copied to the project folder before including them into the project'' | *''Library files should be copied to the project folder before including them into the project'' | ||
− | [[File:select_allsrcfiles.png]] | + | [[File:select_allsrcfiles.png|720x480px]] |
+ | |||
+ | |||
+ | '''Step 14:''' ''Include your header files to the project.. '' | ||
+ | [[File:include_headerfiles.png|720x480px]] | ||
+ | |||
+ | |||
+ | '''Step 15:''' ''Select all the header files which needs to be included in the project and click open.'' | ||
+ | [[File:select_allheaderfiles.png|720x480px]] | ||
+ | |||
+ | |||
+ | '''Step 16:''' ''The included files will be visible in the left side project navigator, if any file is missing then it should be copied to the Project folder and included as shown in step 11.'' | ||
+ | *''Compile the project by clicking on Build as shown below Project complies if there are no errors. If there are any errors fix them and re-compile.'' | ||
+ | [[File:compile.png|720x480px]] | ||
+ | |||
+ | |||
+ | '''Step 17:''' ''Once the project is built(compiled), hex file will be generated with the project name in the selected project folder. '' | ||
+ | [[File:hex_files.png|720x480px]] | ||
+ | |||
+ | '''Configuration Bits''' | ||
+ | |||
+ | '''Step 18:''' ''Configuration Bits : Select the Configuration bits option from Configure menu.'' | ||
+ | [[File:select_configuremenu.png|720x480px]] | ||
+ | |||
+ | |||
+ | '''Step 19:''' ''Uncheck the “Configuration bits Ste in Code” and update the configuration bits as below to get value as 3F3A. Finally check the option “Configuration bits Ste in Code” to save the configuration.'' | ||
+ | |||
+ | [[File:Configurationbits_in_Code.png|720x480px]] | ||
− | + | '''Flashing the hex file into the controller ''' | |
− | [[File: | + | '''Step 1:''' ''Connect the Pickit2/3 programmer and select the same from programmer drop down menu.'' |
+ | [[File:Connect_the_Pickit.png|720x480px]] | ||
− | + | '''Step 2:''' ''Once the programmer is detected below message will be displayed, if there is any errors double-check the connection and follow step1.'' | |
− | [[File: | + | [[File:message.png|720x480px]] |
− | + | '''Step 3:''' ''Once the programmer is connected click the program option from the prommer menu to program the IC.'' | |
− | + | [[File:program_the_IC.png|720x480px]] | |
− | + | ||
− | + | '''Step 4:''' ''The controller will be programmed and the application starts running else reset the targed.'' | |
− | [[File: | + | [[File:debug.png|720x480px]] |
Latest revision as of 14:47, 5 December 2013
- Below example demonstrates the step by step procedure to include the libraries into any applications.
Step 1: Open the Mplab software and select the Project Wizard from Project Menu as shown below.
Step 2: A new window opens which will guide to create and configure the project. Click next to proceed.
Step 3: After clicking next a new window opens to select the device, select Pic16f877A from the drop down and click next.
Step 4: Once the device is selected a new window opens to select the compiler, select Hitech Universal ToolSuite from the drop down and click next.
Note:
- Ensure the HiTech tool chain is installed before creating the project. Evaluation version of Hitech Compiler is embedded in Mplab Setup which needs to be installed along with Mplab.
Step 5: Upon selecting the ToolChain, Browse to the project folder and provide the suitable project name and save it. .
Step 6:
Step 7: Click next to proceed as there are no files(.c/.h) to be added at this stage.
Step8: Finally click finish to create the project. Now the project will be created with no initial files.
Step 9: Create a new .c file to write the main program.
Step 10: Write your program using the library functions and save it.
Note:
- Include the respective header files before calling any library functions.
Step 11: Provide the suitable file name(main.c) and save it in the same project folder.
Step 12: Include your source files to the project..
Step 13: Select all the source files which needs to be included in the project and click open.
Note:
- Library files should be copied to the project folder before including them into the project
Step 14: Include your header files to the project..
Step 15: Select all the header files which needs to be included in the project and click open.
Step 16: The included files will be visible in the left side project navigator, if any file is missing then it should be copied to the Project folder and included as shown in step 11.
- Compile the project by clicking on Build as shown below Project complies if there are no errors. If there are any errors fix them and re-compile.
Step 17: Once the project is built(compiled), hex file will be generated with the project name in the selected project folder.
Configuration Bits
Step 18: Configuration Bits : Select the Configuration bits option from Configure menu.
Step 19: Uncheck the “Configuration bits Ste in Code” and update the configuration bits as below to get value as 3F3A. Finally check the option “Configuration bits Ste in Code” to save the configuration.
Flashing the hex file into the controller
Step 1: Connect the Pickit2/3 programmer and select the same from programmer drop down menu.
Step 2: Once the programmer is detected below message will be displayed, if there is any errors double-check the connection and follow step1.
Step 3: Once the programmer is connected click the program option from the prommer menu to program the IC.
Step 4: The controller will be programmed and the application starts running else reset the targed.