(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
       '''Libray usage guide'''
+
        
 
*''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 Keil software and select the New Microvision project from Project Menu as shown below.''
 
'''Step 1:''' ''Open the Keil software and select the New Microvision project from Project Menu as shown below.''
[[File:1Microvision_Project.png|720x480px|720x480px]]
+
[[File:1Microvision_Project.png|720x480px]]
  
 
'''Step 2:''' ''Browse to your project folder and provide the project name and click on save.''
 
'''Step 2:''' ''Browse to your project folder and provide the project name and click on save.''
[[File:2Project_Folder.png|720x480px|720x480px]]
+
[[File:2Project_Folder.png|720x480px]]
  
 
'''Step 3:''' ''Once the project is saved a new dialog box “Select Device for Target” opens, Select the controller(Atmel:At89s52/NXP:P89v51rd2) and click on OK.''
 
'''Step 3:''' ''Once the project is saved a new dialog box “Select Device for Target” opens, Select the controller(Atmel:At89s52/NXP:P89v51rd2) and click on OK.''
Line 19: Line 19:
  
 
'''Step 6:''' ''Add the .c files by selecting “C Source files” from “Files of type drop down”. ''
 
'''Step 6:''' ''Add the .c files by selecting “C Source files” from “Files of type drop down”. ''
[[File:6C_SourceFiles.png]]
+
[[File:6C_SourceFiles.png|720x480px]]
  
 
'''Step 7:''' ''Add the header( .h)  files by selecting “Text file(.txt, .h, .inc)” from “Files of type” drop down.''
 
'''Step 7:''' ''Add the header( .h)  files by selecting “Text file(.txt, .h, .inc)” from “Files of type” drop down.''
[[File:7Add_HeaderFiles.png]]
+
[[File:7Add_HeaderFiles.png|720x480px]]
[[File:7.1AddFiles_toHeader.png]]
+
[[File:7.1AddFiles_toHeader.png|720x480px]]
  
 
'''Step 8:''' ''After including the library  files, create a new .c file to write the main program.''
 
'''Step 8:''' ''After including the library  files, create a new .c file to write the main program.''
[[File:8Create_NewCFile.png]]
+
[[File:8Create_NewCFile.png|720x480px]]
  
 
'''Step 9:''' ''Write your program using the library functions and save it.''<br\>
 
'''Step 9:''' ''Write your program using the library functions and save it.''<br\>
 
''Note:''
 
''Note:''
 
*''Include the respective header files before calling any library functions. ''
 
*''Include the respective header files before calling any library functions. ''
[[File:9Write_Program.png]]
+
[[File:9Write_Program.png|720x480px]]
  
 
'''Step 10:''' ''Provide the suitable file name(main.c) and save it in the same project folder.''
 
'''Step 10:''' ''Provide the suitable file name(main.c) and save it in the same project folder.''
[[File:10Suitable_FileName.png]]
+
[[File:10Suitable_FileName.png|720x480px]]
  
 
'''Step 11:''' ''Include your source file to the project.''
 
'''Step 11:''' ''Include your source file to the project.''
[[File:11Include_SourceFiles.png]]
+
[[File:11Include_SourceFiles.png|720x480px]]
[[File:11.1AddFile_SrcGrp.png]]
+
[[File:11.1AddFile_SrcGrp.png|720x480px]]
  
 
'''Step 12:''' ''Configure the project to generate the hex file after compilation.''
 
'''Step 12:''' ''Configure the project to generate the hex file after compilation.''
[[File:12Configure_Project.png]]
+
[[File:12Configure_Project.png|720x480px]]
  
 
'''Step 13:''' ''Select the output menu and check the Create Hex File option to generate the hex file.''
 
'''Step 13:''' ''Select the output menu and check the Create Hex File option to generate the hex file.''
[[File:13Check_CreateHexFile.png]]
+
[[File:13Check_CreateHexFile.png|720x480px]]
  
 
'''Step 14:''' ''Compile the project by clicking on Build target (or press F7). Project complies if there are no errors. If there are any errors fix them and re-compile.''
 
'''Step 14:''' ''Compile the project by clicking on Build target (or press F7). Project complies if there are no errors. If there are any errors fix them and re-compile.''
[[File:14Compile_Project.png]]  
+
[[File:14Compile_Project.png|720x480px]]  
  
 
'''Step 15:''' ''Once the project is built(compiled), hex file will be generated with the message as shown below. If the hex file is not generated then follow Step 12.''
 
'''Step 15:''' ''Once the project is built(compiled), hex file will be generated with the message as shown below. If the hex file is not generated then follow Step 12.''
[[File:15Built_Completed.png]]
+
[[File:15Built_Completed.png|720x480px]]
  
 
'''Step 16:''' ''Hex file will be generated with the project name in the selected project folder.''
 
'''Step 16:''' ''Hex file will be generated with the project name in the selected project folder.''
[[File:16HexFile_Generated.png]]
+
[[File:16HexFile_Generated.png|720x480px]]
 +
 
 +
 
 +
                              '''Flashing the hex file into the controller  '''
 +
 
 +
'''Step 1:''' ''Run the Flash magic Software .''
 +
[[File:1Run_FlashMagic.png|720x480px]]
 +
 
 +
'''Step 2:'''
 +
*''a.'' ''Select the Com port to which the controller(targed board) is connected.''
 +
*b.'' ''Configure the baud rate as 4800/7200/19200 etc. from drop down. (9600 is recommended).''
 +
*''c.'' ''Select the device as 89V51RD2 from the Device drop down menu.''
 +
*''d.'' ''Select None ISP mode from Interface menu''
 +
*''e.'' ''Check the option Erase blocks used by Hex File.''
 +
*''f.'' ''Check the option Verify the after programming.''
 +
[[File:2Select_ComPort.png|720x480px]]
 +
 
 +
'''Step 3:''' ''Browse and select the hex file to be flashed into the controller.''
 +
[[File:3Select_HexFile.png|720x480px]]
 +
 
 +
'''Step 4:''' ''Click on Start to flash the hex file into the controller. It is recommeded to Hold the reset botton before clicking the start button of flash magic.''
 +
[[File:4Start_FlashHexFile.png|720x480px]]
 +
 
 +
'''Step 5:''' ''Once the start button is clicked a message pops up asking to rest the device, now reset the device.If the below message is not displayed then double check the ComPort Connection, Max232  or reduce the baudrate.If still the problem persist then Turn OFF the board, Click on start button and now Turn ON the board.''
 +
[[File:5Message_PopUp.png|720x480px]]
 +
 
 +
'''Step 6:''' ''Flash magic starts programming the controller. Do not disturb the connection or Power Off while the controller is being programmed.''
 +
[[File:6Start_ProgrammingCtrl.png|720x480px]]
 +
 
 +
'''Step 7:''' ''Once the hex file is successfully programmed, Reset the controller to run the Program.''
 +
[[File:7Reset_Controller.png|720x480px]]

Latest revision as of 14:46, 5 December 2013

  • Below example demonstrates the step by step procedure to include the libraries into any applications.

Step 1: Open the Keil software and select the New Microvision project from Project Menu as shown below. 1Microvision Project.png

Step 2: Browse to your project folder and provide the project name and click on save. 2Project Folder.png

Step 3: Once the project is saved a new dialog box “Select Device for Target” opens, Select the controller(Atmel:At89s52/NXP:P89v51rd2) and click on OK. 3Select DeviceForTarget.png

Step 4: Once the project is created add a new header group to include the library header files. 4Add NewHeaderGroup.png

Step 5: Add the library files to the project .c files to Source group and .h files to header group.<br\> Note:

  • Copy the library files into the project folder before including them into the project.

5Add LibraryFiles.png

Step 6: Add the .c files by selecting “C Source files” from “Files of type drop down”. 6C SourceFiles.png

Step 7: Add the header( .h) files by selecting “Text file(.txt, .h, .inc)” from “Files of type” drop down. 7Add HeaderFiles.png 7.1AddFiles toHeader.png

Step 8: After including the library files, create a new .c file to write the main program. 8Create NewCFile.png

Step 9: Write your program using the library functions and save it.<br\> Note:

  • Include the respective header files before calling any library functions.

9Write Program.png

Step 10: Provide the suitable file name(main.c) and save it in the same project folder. 10Suitable FileName.png

Step 11: Include your source file to the project. 11Include SourceFiles.png 11.1AddFile SrcGrp.png

Step 12: Configure the project to generate the hex file after compilation. 12Configure Project.png

Step 13: Select the output menu and check the Create Hex File option to generate the hex file. 13Check CreateHexFile.png

Step 14: Compile the project by clicking on Build target (or press F7). Project complies if there are no errors. If there are any errors fix them and re-compile. 14Compile Project.png

Step 15: Once the project is built(compiled), hex file will be generated with the message as shown below. If the hex file is not generated then follow Step 12. 15Built Completed.png

Step 16: Hex file will be generated with the project name in the selected project folder. 16HexFile Generated.png


                              Flashing the hex file into the controller  

Step 1: Run the Flash magic Software . 1Run FlashMagic.png

Step 2:

  • a. Select the Com port to which the controller(targed board) is connected.
  • b. Configure the baud rate as 4800/7200/19200 etc. from drop down. (9600 is recommended).
  • c. Select the device as 89V51RD2 from the Device drop down menu.
  • d. Select None ISP mode from Interface menu
  • e. Check the option Erase blocks used by Hex File.
  • f. Check the option Verify the after programming.

2Select ComPort.png

Step 3: Browse and select the hex file to be flashed into the controller. 3Select HexFile.png

Step 4: Click on Start to flash the hex file into the controller. It is recommeded to Hold the reset botton before clicking the start button of flash magic. 4Start FlashHexFile.png

Step 5: Once the start button is clicked a message pops up asking to rest the device, now reset the device.If the below message is not displayed then double check the ComPort Connection, Max232 or reduce the baudrate.If still the problem persist then Turn OFF the board, Click on start button and now Turn ON the board. 5Message PopUp.png

Step 6: Flash magic starts programming the controller. Do not disturb the connection or Power Off while the controller is being programmed. 6Start ProgrammingCtrl.png

Step 7: Once the hex file is successfully programmed, Reset the controller to run the Program. 7Reset Controller.png