Dev Board Manual - FINAL
Dev Board Manual - FINAL
Dev Board Manual - FINAL
A Product from THE ARELAB
FEATURES
DB01 Page 2
Contents
1. Block Diagram Page 4
2. On Board Pin Connections Page 5
3. Identifying the components Page 6
4. P89V51RD2 Microcontroller Page 7
5. Input Keys Page 9
6. Light Emitting Diodes Page 11
7. Motor Driving using L293D Page 11
8. Motor Driving using ULN2803 Page 15
9. Sensor Interfacing using LM339 Page 16
10.RS 232 interfacing. Page 19
11.Using Keil Software Page 23
12.Transferring the program Page 24
13.Troubleshooting Page 25
Note: This manual is based on DB01 kit and includes the Hardware components, their
details and circuit connections and the use of supplied functions to drive the different
components. It excludes the theory of operation of different components and also how
to write the driver routines.
DB01 Page 3
BLOCK DIAGRAM:
2 Servo 2 LEDs
Fig 2: I/O Block Diagram
DB01 Page 4
Identifying the Components:
RESET SWITCH
DB01 Page 5
On Board Pin Connections:
Name Port Pin Defined as (in DB01.H)
Number
Left Input Key P3.2 L_KEY
Sensor 4 P1.0 S4
Sensor 2 P1.1 S2
Sensor 3 P1.2 S3
Sensor 1 P1.3 S1
Sensor 7 P1.4 S7
Sensor 8 P1.5 S8
Sensor 5 P1.6 S5
Sensor 6 P1.7 S6
DB01 Page 6
P89V51RD2 Microcontroller:
The Phillips 89V51RD2 is an 80C51 Microcontroller with 64kB Flash
and 1024 Bytes of data RAM.
GENERAL FEATURES:
DB01 Page 7
Connection Diagram:
The VDD pin is connected to the
+5V Supply Bus. And VSS is
connected to the Ground the
Clocking circuitry is made by an
11.0592 MHz Crystal and two 33 pF
Capacitors. The ‘Power On reset
Circuitry’ consist of one 10UF
capacitor and one 8.2K Resistance.
The remaining port Pins are
connected to various input and
output ports as described by the
Table in Page 5.
#include<reg52.h>
void main ()
{
P1=0x00; /// Send the data 00 in port 1 ///
while (1);
}
The Delay Function: You will need the function to generate some
time delay. The easiest way of generating the time delay is to
write some loops and inside the loop do nothing. Obviously the
time of execution of the delay routine depends on the
microcontroller execution Speed. In DB01 the clock frequency is
DB01 Page 8
11.0592 MHz. Depending on this speed the following function
generates delay routine of 1 ms interval.
tic--;
}
}
void main()
{
while(1)
{
P1^0 = ~P1^0;
Delay(1000);
}
}
Interfacing Simple Keys:
89V51RD2
Keys act as input device. Keys can be used to operate Menu based
programs or inputting some value or parameters. Only 2 keys have
DB01 Page 9
been provided in this board to minimize PCB area and also to
minimize the microcontroller pins associated with it. In menu
based programs left and right key can be used to navigate
between menu items. You can input some numeric values also by
these 2 keys (like your digital wrist watch).
else return 0;
}
void main(void)
{
unsigned char val,count=0;
while(1)
DB01 Page 10
{
val=Scan_Key();
switch(val)
{
case 1: count++;
break;
case 3: count--;
break;
}
}
}
Light Emitting Diodes:
The LED is connected to the
microcontroller I/O pin directly and
the microcontroller pins cannot source
current required to drive the LED, but
it can sink the required current. So,
the LED s are connected in such a way
that the LED will glow when the
microcontroller will sink current. The
anode of the LED is connected to Vcc
via a series resistance and the cathode
is directly connected to the pin.
Bipolar Motor Driving: L293D
L293D is a bipolar motor driver IC. This is a high voltage, high
current push-pull four channel driver compatible to TTL logic
levels and drive inductive loads. It has 600 mA output current
capabilities per channel and internal clamp diodes.
DB01 Page 11
CONNECTION DIAGRAM FOR DRIVING BIPOLAR STEPPER MOTOR
DB01 Page 12
As shown below there are connectors provided in the development
board to connect DC motors with L293D. Each connector contains
3pins. The center pin is ground. The left and right pins should be
connected to the two motor terminals. The motor driver has 3 input
pins for each motor. They are EN, A, B. A truth table is provided
below to relate the input conditions with the motor action.
EN A B Motor Action
0 X X Stopped
1 0 0 Brake
1 1 1 Brake
1 0 1 Clockwise
Rotation
1 1 0 Anti-Clockwise
Rotation
DB01 Page 13
Software Interfacing:
Software Interfacing:
void main()
{
While(1)
{
LED_RED = 1;
LED_GREEN = 1;
DCM_Forward();
Delay(1000);
LED_RED = 0;
LED_GREEN = 0;
DCM_Back();
Delay(1000);
LED_RED = 1;
LED_GREEN = 0;
DCM_Right();
Delay(1000);
LED_RED = 0;
LED_GREEN = 1;
DCM_Left();
Delay(1000);
DCM_Stop();
Delay(1000);
}
}
DB01 Page 14
Note: If your robot is not moving according to the program (i.e. it is
moving left, but displaying ‘forward’) then there is a connection
problem with the motors, simply reverse one of the motor’s polarity to
solve the problem.
Note: Never make the motor driver terminals short circuited or drive a
motor with load current more than 600 mA. It will damage the IC.
Unipolar Motor Driving: ULN2803
ULN 2803 is a unipolar motor
driver IC with maximum output
voltage 50 V and output current
500 mA. It contains eight
Darlington pair transistors, each
having a peak rating of 600 mA and
can withstand 50 V in off-state.
Outputs may be paralleled for
higher current capability.
DB01 Page 15
CONNECTION DIAGRAM FOR DRIVING UNIPOLAR STEPPER MOTOR
Sensor Interfacing: LM339
Depending on applications, different types of sensors can be
interfaced with this Robotics development Board. Whether the
sensors are Light Dependent Resistors, laser diode, Infrared
Sensors, Ultrasonic Sensors or anything else, the outputs of the
sensor modules are fed to the Non-inverting input of a comparator.
The reference voltage of the comparator is fed to the inverting
input of the comparator by a trim pot or a tuning device connected
between the supply lines. LM339 is a comparator IC that digitizes
the analog signal from the sensor array. Since the output of LM339
is TTL compatible it can be directly fed to the master
microcontroller.
DB01 Page 16
A single LM339 contains 4 Comparators. 4 sensors can be interfaced
directly with the DB01. A potentiometer is provided in the DB01
for setting the threshold voltage of the comparator. The
potentiometer is 10K and 22 turns. 3 wired interface is provided
to connect the sensors. The three wires are RED (+5V), BLACK
(Analog data Input) and BROWN (Ground).The sensor module should
contain one or more resistive transducer, one pull-up device, and
LEDs for extra illumination. The generalized connection diagram of
Sensor Interfacing with microcontroller is shown below.
INFRARED MODULE
DB01 Page 17
LDR Line sensor array:
S1
S2
S3
S4
The sensor pins are defined in the DB01.H in the names S1, S2, S3,
S4, S5, S6, S7, S8.
Software interfacing:
void main()
{
while(1)
{
if(S1==1)
{
LED_RED = 0;
}
else
{
DB01 Page 18
LED_RED = 1;
}
}
}
INTERFACING THE RS 232:
RS-232 (Recommended Standard 232) is a standard for serial binary
data signals connecting between a DTE (Data Terminal Equipment)
and a DCE (Data Circuit-terminating Equipment). It is commonly
used in computer serial ports.
1) RS232 Voltage levels.
2) RS 232 Connectors.
3) Common 8 bit or 9 bit Data framing.
4) Baud Rate for communication.
DB01 Page 19
The DB9 connector behind Computers or in typical serial-to-USB
connector exhibits proper RS232 voltage levels. But the in-built
UART (a module present in the microcontroller which can send or
receive data in RS232) present in 8051 microcontroller exhibit a
TTL level voltage. So a TTL to RS232 voltage interfacing circuitry
is needed to interface a microcontroller to a ‘true’ RS232 port of
a PC. MAX 232 is an IC which can interface these voltage logic
levels. A schematic diagram of MAX232 with the necessary
components is given below illustrating the connection between PC
and microcontroller. Although there are 9 pins present in a DB-9
connector, we have used only 3 pins named as GND, TX and RX.
Data Framing:
DB01 Page 20
for error checking/parity or other purposes. The internal UART
takes care of generating or detecting start or stop bits.
BAUD rate:
Connecting wire:
Software interfacing:
This function sends one byte data to the serial port and returns
when the transmission is complete.
Receive Data:
This function waits for any data arrival in the serial port, and
returns the received data.
Sample program:
This program transmits the String “HELLO WORLD” in the RS232 port.
void main(void)
{
RS232_Init(9600);
char* str=”HELLO WORLD”;
while(*str)
RS232_Send(*str++)
while(1);
}
void main(void)
{
RS232_Init(9600);
RS232_Send(“HELLO WORLD”);
while(1);
}
Note:
DB01 Page 22
1) Only 2400, 4800, 9600 and 19200 baud rates are supported by
the RS232_Init function.
Using the KEIL software:
For using the Keil software to compile the programs the following
steps should be done.
3. In the save dialog box Select the file location and name.
4. In the “select devices for Target” tab, select “NXP” from the
left hand list, expand it and select “P89V51RD2”. Click OK.
Uploading the HEX file to DB01
DB01 Page 23
After successful compilation, the
final output file or the *.hex file
is generated. The hex file can be
found inside the same folder where
the project is saved.
Next comes the settings part. Click on ‘EDIT’ button. The settings
will be enabled. Select device “P89V51RD2” from the list, baud
rate “9600”. For desktop users, the com port number is usually
COM1, but sometimes it differs. For LAPTOP users, the com port is
virtually generated when the USB-Serial converter is inserted.
Make sure the USB-Serial converter’s Driver is properly installed.
To view the COM number in this case, please visit Control Panel-
>Device manager->COM and LPT ports. Get the appropriate COM number
select that COM port in settings.
Now select the Hex file you have created by the browse button.
Note: once you have selected one hex file, the file name and path
is automatically saved and loaded next time. So while burning the
same file again and again, there is no need to select the file.
The final step is clicking the Burn Button located on the TOP LEFT
corner. The software will be ready to communicate with DB01 board.
Message will be displayed as “Press Reset”. After this, pressing
Reset switch in the DB01 board starts the burn procedure. The
software will automatically verify the burn after it is completed.
Audio sound and message will notify if the burn is successful or
not. If the burn is successful, pressing the reset switch in the
DB01 board runs the program.
DB01 Page 24
Troubleshooting:
Some Troubleshooting techniques are provided below. For
troubleshooting sometimes a multi meter or continuity tester is
required.
DB01 Page 25