Sei sulla pagina 1di 26


User Manual

Table of Contents
2.1. Features 2.2 Parts description and connection details Voltage Regulator Level converter Motor Driver Buzzer Serial port LCD interface Switches LEDs PSMAIN PSMOT

3 4
4 5 5 5 5 5 5 5 6 6 6 6


4.1 Description 4.2. FEATURES: 4.3. Block diagram: 4.4 Typical Circuit 4.5. Pin configuration 4.6 Using KEIL Environment

7 7 8 8 9 10

1. Package Contents
1 2 3
4 5 6 7 8 9

RoboCub mother board (102011) 16x2 LCD module Chassis for building robot
DC geared motor Battery Battery snaper

1 1 1
2 2 2 2 1 1

Sensor (102930) Serial cable CD containing user manual software and sample codes

2. Motherboard Description:
2.1. Features
This board is the main board which controls all the functionalities, actions and motions of a robot. This board have the following features. Compatible with most of the 8051 and 8052 series of 40 pin microcontrollers. Available with P89v51rd2 micro controller On board motor driver for driving 2 DC motors or 1 stepper motors Motor enable disable control switch Onboard 4 channel ADC optional LCD interface PC interface through UART 11.0592 MHz crystal Exposed all I/O port for general-purpose application five tact switches for external input, reset and interrupt Four test LEDs for status and debugging purpose Buzzer for generating audible response Exposed ISP pins for Programming on board programmer for p89v51rd2 microcontroller On board regulated power supply Dual power supply for logic and driving load

2.2 Parts description and connection details

Voltage Regulator Here IC1117 is used as a voltage regulator. It is a 5V voltage regulator IC used to provide a constant voltage of 5Vto the micro controller and other peripherals attached in the main board. Level converter Here IC 232 is used it is basically use to connect the motherboard with the PC. It provides a voltage level conversion in between the serial port of PC and serial port of our motherboard. Motor Driver Here IC L293NE is used as a motor driver. It takes input from micro controller and can able to drive high current high voltage inductive loads, relays, solenoids, DC motors and stepper motors. The L293NE is a high-current H bridge driver. The L293NE is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. The connection details of this IC is given below In0- Port2_4 Out 0- M0 In1- Port2_5 Out 1- M1 In2- Port2_6 Out 2- M2 In3- Port2_7 Out 3- M3 Buzzer Active low It can be easily use to get audible response from the controller. The connection details is given below.

Serial port This is use to download program in the micro controller through PC and can be use to communicate with the PC through UART. LCD interface It can be used to interface a16x2 LCD in 4 bit mode or it can also be used as a general purpose input output port. The pin connections for interfacing a LCD are given bellow. RSPort0_0 RW- Port 0_1 EPort0_2 D4Port0_4 D5Port0_5 D6Port0_6 D7Port0_7

Switches S1-Port3_2 S2-Port3_3 S3-Port3_4 S4-Port3_5 These switches are connected to port pins of micro controller to give external inputs and interrupt. All this switches are active low. RST-Reset This switch can be use to reset the micro controller. POWER-Power on
This is basically a slide switch. It is use to switch on or off the main power supply of the motherboard.

This is basically a slide switch. It is use to enable or disable the motor driver.

LEDs LED1-Port2_0 LED2- Port2_1 LED3-Port2_2 LED4-Port2_3 These LEDs are connected to port pin in active high mode. LED5-Power ON/OFF indicator LED PSMAIN This is use to connect power supply to the Main board (minimum 6VDC maximum 16VDC) PSMOT This is use to connect power supply to the motor (minimum 5VDC maximum 32VDC)

4. The P89v51RD2 Microcontroller

4.1 Description
The P89V51RD2 is an 80C51 microcontroller with 64 kB Flash and 1024 bytes of data RAM. A key feature of the P89V51RD2 is its X2 mode option. The design engineer can choose to run the application with the conventional 80C51 clock rate (12 clocks per machine cycle) or select the X2 mode (6 clocks per machine cycle) to achieve twice the throughput at the same clock frequency. Another way to benefit from this feature is to keep the same performance by reducing the clock frequency by half, thus dramatically reducing the EMI. The Flash program memory supports both parallel programming and in serial In-System Programming (ISP). Parallel programming mode offers gang-programming at high speed, reducing programming costs and time to market. ISP allows a device to be reprogrammed in the end product under software control. The capability to field/update the application firmware makes a wide range of applications possible. The P89V51RD2 is also In- application Programmable (IAP), allowing the Flash program memory to be reconfigured even while the application is running.

80C51 Central Processing Unit 5 V Operating voltage from 0 to 40 MHz 64 KB of on-chip Flash program memory with ISP (In-System Programming) and IAP (In-Application Programming) Supports 12-clock (default) or 6-clock mode selection via software or ISP SPI (Serial Peripheral Interface) and enhanced UART PCA (Programmable Counter Array) with PWM and Capture/Compare functions Four 8-bit I/O ports with three high-current Port 1 pins (16 mA each) Three 16-bit timers/counters Programmable Watchdog timer (WDT) Eight interrupt sources with four priority levels Second DPTR register Low EMI mode (ALE inhibit) TTL- and CMOS-compatible logic levels Brown-out detection Low power modes Power-down mode with external interrupt wake-up Idle mode PDIP40, PLCC44 and TQFP44 packages

4.3. Block diagram:

4.4 Typical Circuit

Power Supply Port 1 P 8 9 V 5 EA 1 R D 2 Port 0



R=8.2K Port 3 33pF

Port 2


4.5. Pin configuration

4.6 Using KEIL Environment

KEIL uVision is the name of a software dedicated to the development and testing of a family of microcontrollers based on 8051 technology, like the 89S52 which we are going to use along this manual. You can download an evaluation version of KEIL at their website: Most versions share merely the same interface, this manual uses KEIL C51 uVision 3 with the C51 compiler v8.05a. To create a project, write and test the example source code, follow the following steps: STEPWISE OPERATION TO WRITE PROGRAM IN KEIL:STEP 1:-

Once the Keil software is installed, to load go to start menu, then programs and select Keil uVision3, click on it. STEP 2:-

Vision Keil is getting loaded...

STEP 3:-

Once the Keil is loaded an empty work space is displayed. If any project was opened previously, then the same will get displayed.

STEP 4:-

To create new project go to Project -drop down menu select New Project.

STEP 5:-

Once you select the New project, it asks you where to save the project. Specify the path.

STEP 6:-

Once the path has been specified select the chip to be programmed. In our case select Philips, then P89V51RD2 and click OK. STEP 7:-

Once the chip is selected a message box will be displayed asking for whether to load the startup code into the project. Click yes if you want the startup code.(always click on yes) STEP 8:-

This will be the startup code, Now go to File menu and click on New this is will be giving you the new editor where you can write your program codes. STEP 9:-

Towards the right of the project workspace is the new Text editor. Type your program in this new editor. Add the header file of <reg51.h> (copy the header given in CD to C:\Keil\C51\INC\Philips ), which include header file as shown in above. STEP 10:-

Save the file under the already created project with .c extension.

STEP 11:Here I have mentioned source code of led blinking program with description, copy this code to your new text editor . #include < REG51.h > /* Include header file */ /*-----------------------------------------------delay function ------------------------------------------------*/ void delay (void) { unsigned int i,j; /* wait function */ for(i=0;i<100;i++) { for(j=0;j<100;j++) { ; }

} } /*-----------------------------------------------MAIN C function ------------------------------------------------*/ void main(void) { P3 = 0; /* Initialize ZERO to P3. Make it as output port*/ while(1) { P3=0x00; delay(); P3=0xff; delay(); } } STEP 12:To add the file to the project right click on the Source Group and click on Add Files to Group 'Source Group' as show below.

STEP 13:-

Select the file to be added and click on Add.

STEP 14:-

Under project Select Build target to compile the project. STEP 15:-

Once the project is built the result can be seen at the bottom. If any errors or warnings detected will get detected, else if no errors the build is successful. This only complies and links all the files in the project, no Hex files are created.

STEP 16:-

To create the Hex File right click on Target and select Options for Target.

STEP 17:-

Under Output option select Create HEX File and click OK. Save and compile once again to generate the HEX file.

STEP 18:-

Once the downloadable HEX file is created it gets saved in the folder where the project is saved. STEP 19:-

To enter into the debug mode go to Debug and select Start/Stop Debug Session.

STEP 20:-

Once entered into Debug mode you can perform step by step operation by clicking F10 key to debug the code. You can see the output in the GPIO port window resides in the Peripherals menu.

The hex file of LED program has created. Now to download the hex file into P89V51RD2 Flash magic software is required and UART0. you can also download the hex file over the IN-System Programming interface.

4.7. Using Flash Magic

Following notes described you to how to download the hex file into the P89V51RD2 using flash magic.
STEP 1:-

Once the Keil software is installed, to load goto start menu, then programs and select flash magic, click on it.
STEP 2:-

Flash magic is getting loaded...

STEP 3:-

Once the flash magic is loaded a work space is displayed. If any hex file was opened previously, then the same will get displayed on browse text box. STEP 4:-

Select the file to be download and click on START. STEP5:-

When you will click on START button to download program, it will display reset device message as show in above figure. STEP6:-

When you will press the Reset Switch, It will start downloading.