Line 1: Line 1:
 
[[Category:8051_tutorials]]
 
[[Category:8051_tutorials]]
{{box|type=green_dark|text='''Setting up the tools for 8051'''}}
+
The Explore Ultra PIC Kit comes with all the things required, not just for this experiment but for the entire series. And even if you think of migrating to PIC or Arduino, you'll have breakout boards that fit on to this, hence we believe it is a great investment for learning hands on Embedded Systems. 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 one.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 latest version of Ultra PIC dev kit is modular  in both hardware and software.  The kit comprises of the Ultra One Base Board and PIC breakout board as the main components.
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=====
+
The PIC breakout board comes with 16F877A, however  you may use any other 40 pin PIC MCUs like the 18F4550. The 16F877A comes with a UART bootloader hence no external programmer is required.
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."
+
=====Creating a Project=====
+
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:
+
  
[[File:01Kiel.PNG]]
+
The Ultra One baseboard can additionally be used with  several AVR, 8051 and Arduino Microcontrollers, we beleive this kit to is a solid gate way to Embedded Systems. This is not it, even the USB to Serial Convertor on board is moduler, you can take it off and use it any of the other projects. 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.
'''Step 1:''' ''Open the Keil software and select the New Microvision project from Project Menu as shown below.''
+
[[File:1Microvision_Project.png|720x480px]]
+
  
'''Step 2:''' ''Browse to your project folder and provide the project name and click on save.''
+
The newer version also supports 128x64 Graphics display as well as 128x64 OLED display. 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 you're embedded development. What are you waiting for?
[[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.''
+
Kit Contents:
[[File:3Select_DeviceForTarget.png|720x480px]]
+
Explore ULTRA PIC Development Board with following Modules, ICs and Interfaces:
 +
#DS1307 RTC.
 +
#24C16 EEPROM
 +
#Micro SD
 +
#Four Seven Segment Displays
 +
#Eight  LEDs
 +
#4 x 4 Keypad
 +
#Temperature Sensor LM35
 +
#LDR
 +
#Buzzer
 +
#L293D Motor Driver.
 +
#Two Relays.
 +
#Eight DIP switches.
 +
#Breakout for 20X4 character LCD.
 +
#Breakout for 128X64 LCD.
 +
#Breakout for OLED.
 +
#Breakout for Zigbee.
  
'''Step 4:''' ''Once the project is created add a new header group to include the library header files.''
+
=Driver Installation=
[[File:4Add_NewHeaderGroup.png|720x480px]]
+
*Check [[Cp2102 Usb-to-Serial Driver Installation|this tutorial]] for Usb2Serial Driver Installation.
  
'''Step 5: ''' ''Add the library files to the project .c files to Source group and .h files to header group.''<br\>
+
=Software Setup=
''Note:''
+
*Compiler Installation: Download and Install the MPlabx IDE and x8 compiler.
*''Copy the library files into the project folder before including them into the project.''
+
*Check [[PIC Software Setup|this tutorial]] for setting up the project to generate the .hex file.
[[File:5Add_LibraryFiles.png|720x480px]]
+
*Check this tutorial for [[Flashing Hex File Using Pickit2|Uploading Hex File Using Pickit2.]]
 +
*Check this tutorial for [[Uploading Hex File Using Ds30 Bootloader|Uploading Hex File Using Ds30 Bootloader.]]
  
'''Step 6:''' ''Add the .c files by selecting “C Source files” from “Files of type drop down”. ''
+
=Complete Board Test=
[[File:6C_SourceFiles.png|720x480px]]
+
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] and reset the Controller. Follow the below procedure to test all the peripherals.
  
'''Step 7:''' ''Add the header( .h)  files by selecting “Text file(.txt, .h, .inc)” from “Files of type” drop down.''
+
===GPIO Test===
[[File:7Add_HeaderFiles.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 .
[[File:7.1AddFiles_toHeader.png|720x480px]]
+
<b>*Note:</b>The Rx,Tx pins will not blink as they are controlled by CP2102(Usb2Serial).
 +
[[File:PIC GPIO Testing.png]]<br><br>
  
'''Step 8:''' ''After including the library  files, create a new .c file to write the main program.''
 
[[File:8Create_NewCFile.png|720x480px]]
 
  
'''Step 9:''' ''Write your program using the library functions and save it.''<br\>
+
===LCD 8-bit Test===
''Note:''
+
Below table shows the LCD 8-bit pin connection.
*''Include the respective header files before calling any library functions. ''
+
{| class="table table-striped table-hover table-condensed table-bordered"
[[File:9Write_Program.png|720x480px]]
+
|-class="info"
 +
!RS || RW || EN || D0  || D1  || D2  || D3  || D4 || D5 || D6 || D7
 +
|-
 +
|PB_0  || PB_1  || PB_2  || PD_0 || PD_1 || PD_2 || PD_3 || PD_4 || PD_5 || PD_6 || PD_7
 +
|}
 +
<br>
 +
[[File:PIC LCD 8-bit Test.png]]<br><br>
  
'''Step 10:''' ''Provide the suitable file name(main.c) and save it in the same project folder.''
 
[[File:10Suitable_FileName.png|720x480px]]
 
  
'''Step 11:''' ''Include your source file to the project.''
+
===LCD 4-bit Test===
[[File:11Include_SourceFiles.png|720x480px]]
+
Below table shows the LCD 4-bit pin connection.
[[File:11.1AddFile_SrcGrp.png|720x480px]]
+
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!RS || RW || EN || D0  || D1  || D2  || D3  || D4 || D5 || D6 || D7
 +
|-
 +
|PB_0  || PB_1  || PB_2  || P_NC || P_NC || P_NC || P_NC || PD_4 || PD_5 || PD_6 || PD_7
 +
|}
 +
*P_NC: Pin Not Connected
 +
<br>
 +
[[File:PIC LCD 4-bit Test.png]]<br><br>
  
'''Step 12:''' ''Configure the project to generate the hex file after compilation.''
+
===Seven Segment Test===
[[File:12Configure_Project.png|720x480px]]
+
Below table shows the Seven Segment Connection.
 +
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!Seg1|| Seg2 || Seg3 || Seg4 || a  || b  || c || d || e || f || g || h
 +
|-
 +
|PB_0  || PB_1  || PB_2  || PB_3 || PD_0 || PD_1 || PD_2 || PD_3 || PD_4 || PD_5 || PD_6 || PD_7
 +
|}
 +
<br>
 +
[[File:PIC SevenSegment.png]]<br><br>
  
'''Step 13:''' ''Select the output menu and check the Create Hex File option to generate the hex file.''
+
===RTC Test===
[[File:13Check_CreateHexFile.png|720x480px]]
+
The DS1307 RTC module will be connected I2C(SCL-RC.3,SDA-RC.4) pins as shown in below image.
 +
[[File:PIC RTC Testing.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.''
+
===EEprom Test===
[[File:14Compile_Project.png|720x480px]]  
+
(A-Z) is wriiten to eeprom and then read it back. Same is transmitted on UART.
 +
[[File:PIC Eeprom Testing.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.''
+
===Adc Test===
[[File:15Built_Completed.png|720x480px]]
+
Ultra Board has a Pot, LDR and a temperature sensor. ADC values from these sensors is read and transmtted on UART. Below table shows the sensor pin connection.
 +
{| class="table table-striped table-hover table-condensed table-bordered"
 +
|-class="info"
 +
!Sensor || Adc Channel || Port Pin
 +
|-
 +
|Temperature || AN0 || RA0
 +
|-       
 +
|POT || AN1|| RA1
 +
|-       
 +
|LDR || AN2|| RA2
 +
|}
 +
[[File:PIC ADC Testing.png]]<br><br>
  
'''Step 16:''' ''Hex file will be generated with the project name in the selected project folder.''
+
===Keypad Test===
[[File:16HexFile_Generated.png|720x480px]]
+
Below table shows the hex keypad Row-Col pin connection.
=====Transferring the hex file to microcontroller with flash magic=====
+
{| class="table table-striped table-hover table-condensed table-bordered"
 
+
|-class="info"
'''Step 1:''' ''Run the Flash magic Software .''
+
!R1  || R2 || R3  || R4  || C1  || C2  || C3  || C4
[[File:1Run_FlashMagic.png|720x480px]]
+
|-
 
+
|PD_0 || PD_1 || PD_2 || PD_3 || PD_4 || PD_5 || PD_6 || PD_7
'''Step 2:'''
+
|}
*''a.'' ''Select the Com port to which the controller(targed board) is connected.''
+
[[File:PIC Hex Keypad.png]]<br><br>
*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}}
+

Revision as of 08:51, 19 August 2016

The Explore Ultra PIC Kit comes with all the things required, not just for this experiment but for the entire series. And even if you think of migrating to PIC or Arduino, you'll have breakout boards that fit on to this, hence we believe it is a great investment for learning hands on Embedded Systems. 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 one.PNG

The latest version of Ultra PIC dev kit is modular in both hardware and software. The kit comprises of the Ultra One Base Board and PIC breakout board as the main components.

The PIC breakout board comes with 16F877A, however you may use any other 40 pin PIC MCUs like the 18F4550. The 16F877A comes with a UART bootloader hence no external programmer is required.

The Ultra One baseboard can additionally be used with several AVR, 8051 and Arduino Microcontrollers, we beleive this kit to is a solid gate way to Embedded Systems. This is not it, even the USB to Serial Convertor on board is moduler, you can take it off and use it any of the other projects. 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 newer version also supports 128x64 Graphics display as well as 128x64 OLED display. 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 you're embedded development. What are you waiting for?

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

  1. DS1307 RTC.
  2. 24C16 EEPROM
  3. Micro SD
  4. Four Seven Segment Displays
  5. Eight LEDs
  6. 4 x 4 Keypad
  7. Temperature Sensor LM35
  8. LDR
  9. Buzzer
  10. L293D Motor Driver.
  11. Two Relays.
  12. Eight DIP switches.
  13. Breakout for 20X4 character LCD.
  14. Breakout for 128X64 LCD.
  15. Breakout for OLED.
  16. Breakout for Zigbee.

Driver Installation

Software Setup

Complete Board Test

The board is shipped with test software loaded in the controller. Connect the board to the System, Open the Serial Terminal and reset the Controller. Follow the below procedure to test all the peripherals.

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). PIC 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
PB_0 PB_1 PB_2 PD_0 PD_1 PD_2 PD_3 PD_4 PD_5 PD_6 PD_7


PIC 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
PB_0 PB_1 PB_2 P_NC P_NC P_NC P_NC PD_4 PD_5 PD_6 PD_7
  • P_NC: Pin Not Connected


PIC 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
PB_0 PB_1 PB_2 PB_3 PD_0 PD_1 PD_2 PD_3 PD_4 PD_5 PD_6 PD_7


PIC SevenSegment.png

RTC Test

The DS1307 RTC module will be connected I2C(SCL-RC.3,SDA-RC.4) pins as shown in below image. PIC RTC Testing.png

EEprom Test

(A-Z) is wriiten to eeprom and then read it back. Same is transmitted on UART. PIC Eeprom Testing.png

Adc Test

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

Sensor Adc Channel Port Pin
Temperature AN0 RA0
POT AN1 RA1
LDR AN2 RA2

PIC ADC Testing.png

Keypad Test

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

R1 R2 R3 R4 C1 C2 C3 C4
PD_0 PD_1 PD_2 PD_3 PD_4 PD_5 PD_6 PD_7

PIC Hex Keypad.png