(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:8051_tutorials]]
 
[[Category:8051_tutorials]]
{{box|type=green_dark|text='''Setting up the tools for 8051'''}}
+
The Explore Ultra 8051 Kit comes with all the things required, not just for this experiment but for the entire series. The base board is fully open, no peripheral is directly connected to the MCU breakout board. You may connect any peripheral to any port/pin you wish. The kit is fully open source, you may use the schematics, the design files and all of the source code and build something cool on your own.  And when you do that do not forget to share with us what you've done. We would be happy to see you building something cool.
  
{{box|type=l_green_light|text=<br />
+
[[File:0ultra 8051.png]]
=====Introduction=====
+
There are various software and hardware tools required to get started with the 8051 micrcontroller. In this tutorial we will discuss, how you can set them up and get going.
+
  
=====Software Tools=====
+
The story of the Ultra Kit does not end here, we have even made the code libraries for all major 8-bit microcontrollers modular. It means you can simple upgrade or even switch your project to a different microcontroller/architecture without changing your application code. The kit ships with all the additional stuff mentioned below to get you started; kickstart your embedded development. What are you waiting for?
Following software tools are required before proceeding with the 8051 tutorials.
+
1. Compiler and Integrated Development Environment(IDE): We will be using  Kiel in all the  tutorials. A Evaluation version of the software can be downloaded [https://www.keil.com/c51/demo/eval/c51.htm here.]
+
2. Programmer Software: Used to transfer hex file from computer to micrcontroller; Flash Magic, can be downloaded [http://www.flashmagictool.com/ here]
+
  
=====Development Boards=====
+
Kit Contents:
Each of the hardware interfacing tutorials, may require varied hardware setup. We recommend you to choose a platform on which you can test and develop a number of peripheral. From Xplore Labz we recommend you the [http://xplorelabz.com/product_details.php?sel_prod=10 ULTRA_X51] development board. Or if you're low on budget you could go for [http://xplorelabz.com/product_details.php?sel_prod=6 STARTER_X51] and request for additional peripherals as required. Having said that you could implement hardware on your own for all the tutorials; only ensure that you've thoroughly verified the schematics with the ones mentioned in the tutorials."
+
Explore ULTRA PIC Development Board with following Modules, ICs and Interfaces:
=====Creating a Project=====
+
#USB Communication with CP2102
Assuming you have installed Kiel, let us proceed with creating a project. We have developed a [[8051_Family_C_Library|library]] of commonly used functions for most of the standard peripherals for the 8051 microcontroller family. This will be required in most of the tutorials. We would be required to import the required library files in each of the tutorials.It can be downloaded [http://xplorelabz.com/uploads/product_sample_code/Ultra_X51_SampleCode.zip here] Hence you could refer to the step by step procedure below:
+
#Eight 5mm LEDs
 +
#Eight Switches in DIP package
 +
#LCD 16x2
 +
#Four Seven Segment Displays
 +
#ADC 0808 with 555 timer for sampling frequency
 +
#POT for ADC
 +
#Light Sensor(LDR).
 +
#Temperature sensor(LM35).
 +
#Two Relays for Switching AC devices.
 +
#4x4 Keypad.
 +
#L293D Motor Driver for DC and Stepper Motors.
 +
#DS1307 based Real Time Clock.
 +
#AT2404 EEPROM.
 +
#USB cable.
 +
#Power Adapter
 +
#Single wire female connectors. <br><br>
  
'''Step 1:''' ''Open the Keil software and select the New Microvision project from Project Menu as shown below.''
+
=Supported Controllers=
[[File:1Microvision_Project.png|720x480px]]
+
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!Controller || Flashing Software || External Programmer || Comments
 +
|-
 +
|At89s52|| XploreFlash/ProgIsp  || UsbAsp Programmer ||IC is cheap and easily available but needs external programmer 
 +
|-class="active"                                                               
 +
|P89v519d2|| Flash Magic  || Not required, uses on board USB ||NXP has stopped manufacturing the IC and only the stock items are being sold.
 +
|-                                                           
 +
|SST8951RD2|| Easy ISP || Not required, uses on board USB ||IC is good but the programming software is not stable, doesn't save the configuration, needs manual reset and many other problems.
 +
|-class="active"                                                               
 +
|w78e052d || Nuvoton ISP  || Not required, uses on board USB  ||IC is cheap and good GUI for flasing the code. FLashing hex file takes less time compared to all   
 +
|}<br><br>
  
'''Step 2:''' ''Browse to your project folder and provide the project name and click on save.''
 
[[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.''
+
=Driver Installation=
[[File:3Select_DeviceForTarget.png|720x480px]]
+
*Check [[Cp2102 Usb-to-Serial Driver Installation|this tutorial]] for Usb2Serial Driver Installation.
  
'''Step 4:''' ''Once the project is created add a new header group to include the library header files.''
+
=Software Setup=
[[File:4Add_NewHeaderGroup.png|720x480px]]
+
*Compiler Installation: Download and Install the Keil software [https://github.com/ExploreEmbedded/Keil4_For_8051/archive/master.zip from this link].
 +
*Check [[Keil Setup For 8051|this tutorial]] for setting up the Keil project to generate the .hex file.
 +
*Check [[Xplore Flash for At89s52|this tutorial]] for Uploading Hex File Using Xplore Flash for AT89S52.
 +
*Check [[NuvoTon ISP For 8051|this tutorial]] for Uploading Hex File Using Nuvoton ISP..
  
'''Step 5: ''' ''Add the library files to the project .c files to Source group and .h files to header group.''<br\>
+
=Complete Board Test=
''Note:''
+
<font color="red"> The board is shipped with test software loaded in the controller. Connect the board to the System, Open the [https://github.com/ExploreEmbedded/terminalSoftware/archive/master.zip Serial Terminal], Set the baud rate to 9600 and reset the Controller. Below Test menu will appear, Select the required peripheral and follow the below procedure to test all the peripherals.</font>
*''Copy the library files into the project folder before including them into the project.''
+
[[File:8051 TestMenu.png ]]
[[File:5Add_LibraryFiles.png|720x480px]]
+
  
'''Step 6:''' ''Add the .c files by selecting “C Source files” from “Files of type drop down”. ''
+
===GPIO Test===
[[File:6C_SourceFiles.png|720x480px]]
+
Connect the LED's, Buzzer and Relays to any of the port pins and observe the Led Blink, Buzzer-Beep, and Relay-Chattering .
 +
<b>*Note:</b>The Rx,Tx pins will not blink as they are controlled by CP2102(Usb2Serial).
 +
[[File:GpioTest.png]]<br>
 +
[[File:8051 GPIO Testing.png]]<br><br>
  
'''Step 7:''' ''Add the header( .h)  files by selecting “Text file(.txt, .h, .inc)” from “Files of type” drop down.''
 
[[File:7Add_HeaderFiles.png|720x480px]]
 
[[File:7.1AddFiles_toHeader.png|720x480px]]
 
  
'''Step 8:''' ''After including the library files, create a new .c file to write the main program.''
+
===LCD 8-bit Test===
[[File:8Create_NewCFile.png|720x480px]]
+
Below table shows the LCD 8-bit pin connection.
 +
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!RS || RW || EN || D0  || D1  || D2  || D3  || D4 || D5 || D6 || D7
 +
|-
 +
|P0_0 || P0_1  || P0_2  || P2_0 || P2_1 || P2_2 || P2_3 || P2_4 || P2_5 || P2_6 || P2_7
 +
|}
 +
[[File:Lcd8bit.png]]<br>
 +
[[File:8051 LCD 8-bit Test.png]]<br><br>
  
'''Step 9:''' ''Write your program using the library functions and save it.''<br\>
 
''Note:''
 
*''Include the respective header files before calling any library functions. ''
 
[[File:9Write_Program.png|720x480px]]
 
  
'''Step 10:''' ''Provide the suitable file name(main.c) and save it in the same project folder.''
+
===LCD 4-bit Test===
[[File:10Suitable_FileName.png|720x480px]]
+
Below table shows the LCD 4-bit pin connection.
 +
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!RS || RW || EN || D0  || D1  || D2  || D3  || D4 || D5 || D6 || D7
 +
|-
 +
|P0_0  || P0_1  || P0_2  || P_NC || P_NC || P_NC || P_NC || P2_4 || P2_5 || P2_6 || P2_7
 +
|}
 +
*P_NC: Pin Not Connected
 +
[[File:Lcd4bitTestCode.png]]<br>
 +
[[File:8051 LCD 4-bit Test.png]]<br><br>
  
'''Step 11:''' ''Include your source file to the project.''
+
===Seven Segment Test===
[[File:11Include_SourceFiles.png|720x480px]]
+
Below table shows the Seven Segment Connection.
[[File:11.1AddFile_SrcGrp.png|720x480px]]
+
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!Seg1|| Seg2 || Seg3 || Seg4 || a  || b  || c || d || e || f || g || h
 +
|-
 +
|P0_0  || P0_1  || P0_2  || P0_3 || P2_0 || P2_1 || P2_2 || P2_3 || P2_4 || P2_5 || P2_6 || P2_7
 +
|}
 +
[[File:SevenSegmentTest.png]]<br>
 +
[[File:8051 SevenSegment.png]]<br><br>
  
'''Step 12:''' ''Configure the project to generate the hex file after compilation.''
+
===RTC Test===
[[File:12Configure_Project.png|720x480px]]
+
The DS1307 RTC pins are connected to P0 (SCL-P0.6,SDA-P0.7).
 +
[[File:RtcEeprom.png]]<br>
 +
[[File:8051 RTC Testing.png]]<br><br>
  
'''Step 13:''' ''Select the output menu and check the Create Hex File option to generate the hex file.''
+
===EEprom Test===
[[File:13Check_CreateHexFile.png|720x480px]]
+
(A-Z) is written to EEPROM and then read it back. Same is transmitted on UART.<br>
 +
The AT24cxx Eeprom pins are connected to P0 (SCL-P0.6,SDA-P0.7).
 +
[[File:RtcEeprom.png]]<br>
 +
[[File:8051 Eeprom Test.png]]<br><br>
  
'''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.''
+
===Adc Test===
[[File:14Compile_Project.png|720x480px]]  
+
Ultra Board has a Pot, LDR and a temperature sensor. ADC values from these sensors is read and transmitted on UART. Below table shows the sensor pin connection.
 +
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!ADC DataBus(D0:D7)|| A || B || C || ALE  || START  || EOC || OE
 +
|-
 +
|P2(P2_0:P2_7) || P1_0  || P1_1  || P1_2 || P1_3 || P1_4 || P1_5 || P1_6
 +
|}
 +
[[File:Adc0809 Interafce.png]]
 +
[[File:8051 ADC Test.png]]<br><br>
  
'''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.''
+
===Keypad Test===
[[File:15Built_Completed.png|720x480px]]
+
Below table shows the hex keypad Row-Col pin connection.
 +
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!R1  || R2  || R3  || R4  || C1  || C2  || C3  || C4
 +
|-
 +
|P2_0 || P2_1 || P2_2 || P2_3 || P2_4 || P2_5 || P2_6 || P2_7
 +
|}
 +
[[File:KeyPad.png]]<br>
 +
[[File:8051 Hex Keypad.png]]<br><br>
  
'''Step 16:''' ''Hex file will be generated with the project name in the selected project folder.''
+
=Downloads=
[[File:16HexFile_Generated.png|720x480px]]
+
*Download the design files and sample codes from [https://github.com/ExploreEmbedded/8051_DevelopmentBoard this link]
=====Transferring the hex file to microcontroller with flash magic=====
+
*Download  the Keil software from [https://github.com/ExploreEmbedded/Keil4_For_8051/archive/master.zip this link]
  
'''Step 1:''' ''Run the Flash magic Software .''
 
[[File:1Run_FlashMagic.png|720x480px]]
 
  
'''Step 2:'''
+
Have an opinion, suggestion , question or feedback about the article let it out here!
*''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:{{#setmainimage:7Reset_Controller.png}}|720x480px]]
+
 
+
}}
+
 
+
[[File:8051Arch.png|left|thumbnail|x120px|link=8051_Architecture|'''''PREVIOUS TUTORIAL''''']]
+
 
+
[[File:8051_LED_Interface_Cover.png|right|thumbnail|x240px|{{Box|type=l_blue_light|text=LED Interfacing with 8051}}|link=LED_Interfacing_with_8051|'''''NEXT TUTORIAL''''']]
+
 
+
{{#seo:
+
|title=8051_ToolsSetup
+
|titlemode=append
+
|keywords=8051,AT89s51,at89c51,p89v51rd2,XploreLabz,8051 Software Tools,8051 Development Boards,Burning Hex File,Flashing Hex File,Flash Magic,Keil
+
|description= 8051 ToolsSetup
+
}}
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
Would like to have your feedback and suggestions here;
+
 
{{DISQUS}}
 
{{DISQUS}}

Latest revision as of 13:00, 22 November 2016

The Explore Ultra 8051 Kit comes with all the things required, not just for this experiment but for the entire series. The base board is fully open, no peripheral is directly connected to the MCU breakout board. You may connect any peripheral to any port/pin you wish. The kit is fully open source, you may use the schematics, the design files and all of the source code and build something cool on your own. And when you do that do not forget to share with us what you've done. We would be happy to see you building something cool.

0ultra 8051.png

The story of the Ultra Kit does not end here, we have even made the code libraries for all major 8-bit microcontrollers modular. It means you can simple upgrade or even switch your project to a different microcontroller/architecture without changing your application code. The kit ships with all the additional stuff mentioned below to get you started; kickstart your embedded development. What are you waiting for?

Kit Contents: Explore ULTRA PIC Development Board with following Modules, ICs and Interfaces:

  1. USB Communication with CP2102
  2. Eight 5mm LEDs
  3. Eight Switches in DIP package
  4. LCD 16x2
  5. Four Seven Segment Displays
  6. ADC 0808 with 555 timer for sampling frequency
  7. POT for ADC
  8. Light Sensor(LDR).
  9. Temperature sensor(LM35).
  10. Two Relays for Switching AC devices.
  11. 4x4 Keypad.
  12. L293D Motor Driver for DC and Stepper Motors.
  13. DS1307 based Real Time Clock.
  14. AT2404 EEPROM.
  15. USB cable.
  16. Power Adapter
  17. Single wire female connectors.

Supported Controllers

Controller Flashing Software External Programmer Comments
At89s52 XploreFlash/ProgIsp UsbAsp Programmer IC is cheap and easily available but needs external programmer
P89v519d2 Flash Magic Not required, uses on board USB NXP has stopped manufacturing the IC and only the stock items are being sold.
SST8951RD2 Easy ISP Not required, uses on board USB IC is good but the programming software is not stable, doesn't save the configuration, needs manual reset and many other problems.
w78e052d Nuvoton ISP Not required, uses on board USB IC is cheap and good GUI for flasing the code. FLashing hex file takes less time compared to all



Driver Installation

Software Setup

  • Compiler Installation: Download and Install the Keil software from this link.
  • Check this tutorial for setting up the Keil project to generate the .hex file.
  • Check this tutorial for Uploading Hex File Using Xplore Flash for AT89S52.
  • Check this tutorial for Uploading Hex File Using Nuvoton ISP..

Complete Board Test

The board is shipped with test software loaded in the controller. Connect the board to the System, Open the Serial Terminal, Set the baud rate to 9600 and reset the Controller. Below Test menu will appear, Select the required peripheral and follow the below procedure to test all the peripherals. 8051 TestMenu.png

GPIO Test

Connect the LED's, Buzzer and Relays to any of the port pins and observe the Led Blink, Buzzer-Beep, and Relay-Chattering . *Note:The Rx,Tx pins will not blink as they are controlled by CP2102(Usb2Serial). GpioTest.png
8051 GPIO Testing.png


LCD 8-bit Test

Below table shows the LCD 8-bit pin connection.

RS RW EN D0 D1 D2 D3 D4 D5 D6 D7
P0_0 P0_1 P0_2 P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7

Lcd8bit.png
8051 LCD 8-bit Test.png


LCD 4-bit Test

Below table shows the LCD 4-bit pin connection.

RS RW EN D0 D1 D2 D3 D4 D5 D6 D7
P0_0 P0_1 P0_2 P_NC P_NC P_NC P_NC P2_4 P2_5 P2_6 P2_7
  • P_NC: Pin Not Connected

Lcd4bitTestCode.png
8051 LCD 4-bit Test.png

Seven Segment Test

Below table shows the Seven Segment Connection.

Seg1 Seg2 Seg3 Seg4 a b c d e f g h
P0_0 P0_1 P0_2 P0_3 P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7

SevenSegmentTest.png
8051 SevenSegment.png

RTC Test

The DS1307 RTC pins are connected to P0 (SCL-P0.6,SDA-P0.7). RtcEeprom.png
8051 RTC Testing.png

EEprom Test

(A-Z) is written to EEPROM and then read it back. Same is transmitted on UART.
The AT24cxx Eeprom pins are connected to P0 (SCL-P0.6,SDA-P0.7). RtcEeprom.png
8051 Eeprom Test.png

Adc Test

Ultra Board has a Pot, LDR and a temperature sensor. ADC values from these sensors is read and transmitted on UART. Below table shows the sensor pin connection.

ADC DataBus(D0:D7) A B C ALE START EOC OE
P2(P2_0:P2_7) P1_0 P1_1 P1_2 P1_3 P1_4 P1_5 P1_6

Adc0809 Interafce.png 8051 ADC Test.png

Keypad Test

Below table shows the hex keypad Row-Col pin connection.

R1 R2 R3 R4 C1 C2 C3 C4
P2_0 P2_1 P2_2 P2_3 P2_4 P2_5 P2_6 P2_7

KeyPad.png
8051 Hex Keypad.png

Downloads

  • Download the design files and sample codes from this link
  • Download the Keil software from this link


Have an opinion, suggestion , question or feedback about the article let it out here!