8051 robot manual
TRANSCRIPT
-
7/29/2019 8051 Robot Manual
1/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 1www.nex-robotics.com
P89V51RD2 ROBOTIC
DEV BOARD
Fig.1
-
7/29/2019 8051 Robot Manual
2/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 2www.nex-robotics.com
Introduction:
P89V51RD2 robotics board is a low cost development board designed for robotics
hobbyists and enthusiasts. The board is most ideal for developing robotic applications
which includes Line Follower, Adaptive cruise control, Autonomous Navigator etc. As
mentioned earlier the board has the legacy P89V51RD2 microcontroller running on11.0592MHz crystal oscillator. The onboard peripherals include L293D, 600mA DC
motor driver with position and velocity control, RS-232 to TTL logic converter, 16X2
LCD and an 8-bit/8 Channel Analog to Digital converter (ADC0808). For further
expansion the rest of the on-chip peripherals and microcontroller pins can be accessed
through open pads. It has reverse polarity protection and 7805 voltage regulator with the
heat sink for high load handling capacity. The PCB is a high quality double sided PTH
type for giving extra strength to the connectors.
Specification:
Microcontroller: P89V51RD2 Crystal: 11.0592MHz Programming: ISP using Flash Magic or any other software via serial port Operating Supply: 9V to 15V DC Regulated 5V, 500mA output for external load 5V 7805 voltage regulator with heat sink for high load handling 8 channel Analog inputs using ADC0808 Analog to Digital Converter Potentiometer for Analog input 16x2 Character alphanumeric LCD interface SPI Expansion port Reconfigurable three 8 bit I/O ports Motor Driver: L293D dual motor driver with 600mA current capacity per motor Four Motor output status indicator LEDs Velocity control: PWM (Pulse Width Modulation) RS232 serial interface Switches: Interrupt, General purpose and Reset Buzzer
Kit contains
P89V51RD2 Robot Board RS232 serial cable 1-Documentation CD
-
7/29/2019 8051 Robot Manual
3/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 3www.nex-robotics.com
Hardware Overview:
Fig. 2
1. ADC0808 Analog to Digital converter:ADC0808 is an 8-bit/8channel Analog to digital converter. The ADC pot is connected
to channel 0 of ADC0808. The ADC pot can be disabled by removing jumper J1.
ADC0808 pin details are as follows:
ADC0808 P89V51RD2 controller
Start-pin 6 P3.6
EOC-pin 7 P3.2
Output Enable-pin9 P3.78 ADC channels Port 0
-
7/29/2019 8051 Robot Manual
4/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 4www.nex-robotics.com
2. LCD Display:2x16 characters alphanumeric LCD connected to Port 2 of P89V51RD2
microcontroller. The contrast pot can be used to adjust the contrast level of the LCD
display. The LCD interface pin description is as follows:
LCD P89V51RD2
RS P2.6
RW P2.5
E P2.4
4 Data lines P2.3 to P2.0
3. L293D Motor Driver:L293D is a 600mA dual motor driver to control position and velocity of DC motors.The motor outputs are indicated on motor direction LEDs to indicate motor directions.
The motor wires can be connected to terminal blocks as shown in fig. 2.The L293D
pin details are mentioned in the table below.
L293D P89V51RD2
Pin 2(input1) P1.0
Pin 7(input2) P1.1
Pin 10(input3) P1.2
Pin 15(input4) P3.4
Pin 1 (Chip Inhibit1) P1.3
Pin 9 (Chip Inhibit2) P1.4
4. Buzzer:The continuous tone Buzzer is connected to Port Pin 2.7. A logic low on pin P.27 will
keep buzzer OFF whereas logic high will turn ON buzzer.
5. Switch:The board has Interrupt switch is connected to INT0 interrupt pin. Apart from
interrupt switch it also has a general purpose switch connected to P3.5.
Note: P3.5 is also used selecting a slave device on the SPI expansion header.
6. Power port:The power port can be used as auxiliary supply to power additional circuit boards or
sensors. The power port pin details are as follows:
-
7/29/2019 8051 Robot Manual
5/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 5www.nex-robotics.com
Vcc 5V regulated
Vin Input supply (9-15V)
Gnd Board Ground
Note: The power port should be used only to supply power to external circuit. Do not
connect external supply to these pins.
List of sample experiments in the documentation CD (compiler: - Keil):
1. IO operation Buzzer Beep2. IO operation Motor direction control3. Position control using Interrupt control4. PWM using PCA5. Timer as Delay6. LCD interfacing string display7. LCD interfacing data array display8. ADC data display on LCD9. Serial communication echo
-
7/29/2019 8051 Robot Manual
6/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 6www.nex-robotics.com
Loading Firmware on Development Board
P89V51RD2 Development Board programming involves two steps. First step is to
write and compile the code and generate the *.hex file. Second step is to load this
*.hex file on the microcontroller using Flash Magic software provided by NXP
(formerly Phillips)
We are going to use Keil uVision (Version 4) software for writing the code for the
microcontroller. We can also use any other open source of proprietary software
supporting P89V51RD2 microcontroller. P89V51RD2 Development Board CD
contains free version of the uVision 4 software. You can also download latest version
from http://www.keil.com/dd/chip/3711.htm and clickC51 Evaluation Software
Writing program in KEIL uVision3.1
Start with Keil-U-Vision
Steps for writing program in uVision3
Go to project and start new project.
Name your project and save it in your project folder. (always create new folder for
new project)
-
7/29/2019 8051 Robot Manual
7/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 7www.nex-robotics.com
A dialogue box will open asking you to select your device used. Select the
appropriate device for e.g. P89V51RD2.Then click OK. P89V51RD2 can be found in
the NXP (founded by Philips) directory.
-
7/29/2019 8051 Robot Manual
8/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 8www.nex-robotics.com
Next it will ask you if you want to add the A51STARTUP code.
Say NO
-
7/29/2019 8051 Robot Manual
9/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 9www.nex-robotics.com
In the Project Workspace right click on Target 1 and select options for target as
shown. A dialogue box to choose different options will open.
Click on the Target tab. Enter the frequency of the crystal. For Development Board
its 11.0592 MHz.
-
7/29/2019 8051 Robot Manual
10/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 10www.nex-robotics.com
Go to the output tab and tick on the file to create HEX-file. Then click OK to save
your options. Other tabs can be left with the default options.
After this is done, open a new file and save it with the project file as a C file i.e. with
the extension .c.
-
7/29/2019 8051 Robot Manual
11/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 11www.nex-robotics.com
Add this file to the project by Right-clicking on Source Group and choosing to add
files to group. Select the appropriate .C file to be added.
-
7/29/2019 8051 Robot Manual
12/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 12www.nex-robotics.com
You can write macros and save them with an .h extension and add them to your
project files. Write your C code and save the file.
Add (write): #include
Add (write): #include "p89v51rx2.h"
Copy file: p89v51rx2.h from the folder Experiments from the documentation CD
and paste it in your existing project folder before building target.
Note: A declaration with the following syntax #include would direct the
compiler to look for the .h file in its own parent directory whereas the syntax #include
intrins.h would direct the compiler to search for the .h file in the parent directory
where the current project is stored. Therefore the double quotes are used to
declare the files specific to the Microcontroller chip and its peripherals where as < >
are used to declare more generic files which are compatible with multiple chips. Copy
following code in your C (#include and #include "p89v51rx2.h" are
already written in the C file)
//code for buzzer beep
//connect Buzzer to Port pin 2.7.
#include
#include "p89v51rx2.h"
sbit buzzer=P2^7; //buzzer = 1; buzzer off, buzzer = 0; buzzer on,
// function for giving a delay of ms milliseconds
void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i
-
7/29/2019 8051 Robot Manual
13/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 13www.nex-robotics.com
Now click on the Project tab and choose to Build Target as shown.
Check for any errors in the Output Window.
If there are no errors then Hex file will be created and stored in the Project folder.
You can then download this file onto your microcontroller using the In System
Programming (ISP) software i.e. using flash tools like Flash Magic or FLIP or
parallel programming as supported by your microcontroller.
Note: Use rebuild all target files option if you are including multiple header file
-
7/29/2019 8051 Robot Manual
14/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 14www.nex-robotics.com
Loading the generated Hex file on the microcontroller using Serial Port
Flash Magic is Windows software which allows easy access to all the In System
Programming (ISP) features provided by the devices.
These features include:
Erasing the Flash memory (individual blocks or the whole device)
Programming the Flash memory
Reading Flash memory
Reading the signature bytes
Reading and writing the security bits
Direct load of a new baud rate (high speed communications) Sending commands to place device in Boot loader mode
Flash Magic provides a clear and simple user interface to these features
Go to Flash Magic Icon, it will open the main window as show below.
-
7/29/2019 8051 Robot Manual
15/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 15www.nex-robotics.com
In main window you can see five types of sections.
1. Communications2. Erase3. Hex File4. Options5. Start
Go to Option in the toolbar, and select first menu Advance options.
-
7/29/2019 8051 Robot Manual
16/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 16www.nex-robotics.com
It will show you extracted window with many options.
Uncheck the box which is highlighted to dont allow Flash Magic to control PSEN &
RST using DTR & RTS. Now go for Communication selection, select COM 1 from
COM PORT Option if you are using serial port. If you are using USB to serial
converter from NEX Robotics then find out COM port number with the help of
documentation provided with the USB to serial converter.
-
7/29/2019 8051 Robot Manual
17/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 17www.nex-robotics.com
Select Baud Rate 9600 from Baud Rate option.
Select proper Device 89V51RD2 from Device option.
-
7/29/2019 8051 Robot Manual
18/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 18www.nex-robotics.com
Go to Erase section for erasing the all Flash or Blocks used by HEX File
Check on the check box to Erase all Flash.
Go to HEX File section click Browse to select proper Hex file.
-
7/29/2019 8051 Robot Manual
19/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 19www.nex-robotics.com
Go to Option section to select Verify after programming option. This will verify
hex file after loading.
After doing all the required settings, connect serial cable between Development
Board and PC. Turn on the Board and click on the Start, it will ask to RESET TO
DEVICE IN TO ISP MODE, now press RESET Switch on the Development Board,
Flash magic will load hex file on the robot and verify it for correctness. If you are
using USB to serial converter from NEX Robotics then find out COM port numberwith the help of documentation provided with the USB to serial converter.
-
7/29/2019 8051 Robot Manual
20/20
P89V51RD2 Robotic Dev board
Remote Control
NEX Robotics Pvt. Ltd. 20www.nex-robotics.com
Notice
The contents of this manual are subject to change without notice. All efforts have
been made to ensure the accuracy of contents in this manual. However, should any
errors be detected, NEX Robotics welcomes your corrections. You can send us yourqueries / suggestions at
Content of this manual is released under the Creative Commence cc by-nc-sa license.
For legal information refer to:
http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
Products electronics is static sensitive. Use the product in static free
environment.
Read the user manuals completely before start using this product
Recycling:
Almost all the part of this product are recyclable. Please send this product to the
recycling plant after its operational life. By recycling we can contribute to cleaner
and healthier environment for the future generations.