You are on page 1of 89

8051 Advanced Development Board

User Manual

1
www.pantechsolutions.net

8051 Advanced Development Board User Manual

CONTENTS
1. Introduction
Technical/Customer Support .............................................................3
Package contains .............................................................................4
Board Introduction...........................................................................5
2. Connectors and Jumper Details................................................................9
3. Power Supply Block .............................................................................. 12
4. ZIF Socket Details ............................................................................... 12
5. Flash programmers .............................................................................. 13
6. Onboard Peripheral/Interface Details ...................................................... 17
6.1 - Point LEDs ............................................................................ 18
6.2 Digital Inputs Toggle Switches ................................................ 21
6.3 - LCD 2x16 in 8-bit mode .......................................................... 23
6.4 - GLCD 128x64 ....................................................................... 27
6.5 - UART RS-232 Communication ................................................. 32
6.6 - Real Time Clock ..................................................................... 36
6.7 I2C EEPROM ......................................................................... 43
6.8 - 7 Segment LED ..................................................................... 48
6.9 - Interrupts ............................................................................. 52
6.10 - DS1820 (Digital Thermometer) .............................................. 53
6.11 - Matrix keypad...................................................................... 57
6.12 - Stepper Motor Driver ............................................................ 62
6.13 - Relay Driver ........................................................................ 64
6.14 SPI DAC ............................................................................. 66
6.15 RS-485 .............................................................................. 68
6.16 PS/2 ................................................................................. 70
6.17 Ethernet ............................................................................ 73
6.18 ADC On-Chip ...................................................................... 76
6.19 CAN .................................................................................. 79
7. Board Layout....................................................................................... 81
9. Easy Programming Steps ...................................................................... 82

2
www.pantechsolutions.net

8051 Advanced Development Board User Manual

Technical or Customer Support

E-mail questions to support@pantechsolutions.net

Send questions by mail to


Pantech Solutions Pvt Ltd.,
#3/2, Ramachandran Street,
Off: North Usman Road,
T.Nagar
Chennai 600 017.
Tamilnadu
India
Phone

: +91-44-4260 6470

Fax

: +91-44-4260 6480

Website : www.pantechsolutions.net

3
www.pantechsolutions.net

8051 Advanced Development Board User Manual

Packages

8051 ADB Development module

Serial Port Cable (Dallas/Philips Controller Program)

Parallel to Serial Cable (Atmel ISP)

10-pin FRC Cables

Printed User Manual

CD contains
o

Software (Programmers, IDE)

Example Programs

User Manual

Simple Projects

4
www.pantechsolutions.net

8051 Advanced Development Board User Manual

1. Introduction

Pantech Solutions Embedded Advanced Development module is proposed to smooth


the progress of developing and debugging of various designs encompassing 8051
Microcontrollers from Philips / Atmel/ Dallas. The intention of the design is to endorse
the engineers to exercise and explore the capabilities of 8051 microcontrollers with
many communication protocol ease. The board is compatible with 40-DIP/44-PLCC
pin Microcontrollers. The kit is designed so as to facilitate separate On-board ISP
Programmer for Atmel microcontrollers and Philips Microcontroller through ISP on
serial port. Programming can be done without detaching the Microcontroller from the
ZIF socket.

It provides a complete development platform with different modules interface that


accelerates the task of designers to run application software on target 8051
hardware, thereby paving a platform to benchmark their system, save time &
expense of building their own application test board and enabling them to get their
designs to market quickly. Many real world applications can be tested on the board.
RS485,

RTC,

DAC,

Digital

Temperature

controllers,

Motor

drivers,

Memory

interfacing, counters, timers...


5
www.pantechsolutions.net

8051 Advanced Development Board User Manual

General Block Diagram

9V AC/DC Input
5V Regulator

3.3V Regulator
Ethernet supply

Parallel/Serial
ISP Programmer

10Mbps
Ethernet

128x64 GLCD
2x16 LCD

CAN 2.0
(MCP2551)

10-bit ADC
(AT89C51CC03)

SPI DAC
MCP4921

PS/2
Keyboard

I2C
EEPROM

PWM
(AT89C51CC03)

AT89SXX
AT89C51CC0X
DS89C4XX
P89C51RD2

I2C
Real Time Clock

Two Relay
Outputs

1-Wire
Temp Sensor

4x4 Matrix
Keypad

RS485

4 Nos. Seven
Segment Display

Stepper Motor
Termination

2XRS232

Two
Ext Interrupts

8 Nos.
Point LEDs

8 Nos.
Digital Inputs

6
www.pantechsolutions.net

8051 Advanced Development Board User Manual

Specifications

Supported Microcontrollers :
SOCKET1 (40-DIP)
Atmel :
AT89S51/52/8252 and AT89Sxx
NXP

Dallas :

P89V51Rxx
DS89C420/430/450

SOCKET2 (44-PLCC)
Atmel :

AT89S51/52/8252 and AT89Sxx MCUs

NXP

P89V51Rxx

Dallas :

DS89C420/430/450

SOCKET3 (44-PLCC)
Atmel :

AT89C51CC01/02/03 (CAN Controllers)


T89C51CC01/02/03

External Peripheral Modules




128X64 GLCD Interface

2x16 Character LCD with Contrast adjust

10Mbps Ethernet Interface.

4-Nos. of common anode seven segment display.

8-Nos. General purpose Point LEDs.

8-Nos. of Toggle switches (Digital Inputs).

4x4 Matrix keypad.

Stepper Motor Driver Output.

Two Nos. of 5V Relay with termination.

PS/2 keyboard Interface.

Communication Protocols


CAN (2.0A and 2.0B) (Bosch)

I2C Two Wire Interface (Philips-NXP)

SPI (Motorola)

1-wire Technology (Maxim-Dallas)

Two Full Duplex UART (EIA)

RS485 (EIA)

7
www.pantechsolutions.net

8051 Advanced Development Board User Manual

Other Features


Digital to Analog Converter.

Real Time Clock with Battery Backup.

Serial EEPROM memory.

Digital Temperature sensor

RS485 serial communication through long distance(>200m)

Two UART for serial port communication through PC.

ISP In-System Programming for NXP, Dallas and Atmel CAN controllers.

Parallel programmer for Atmel AT89S5X family controllers.

Two pushbuttons for Interrupts study.

Two Nos. of On-board potentiometer for ADC input testing of Atmel AT89C51CC03
controller

Easy to mount 40-pin DIP Devices (ZIF socket).

MCU Socket selectable jumpers.

Controlling of multifunction through DIP Switch.

8
www.pantechsolutions.net

8051 Advanced Development Board User Manual

2. Connectors and Jumper Details


CN3 - 10PIN Box Header ( PORT 0 )
P0.[0..7]

P0.0
P0.2
P0.4
P0.6

VCC

P0.[0..7]

CN3
1
3
5
7
9

P0.1
P0.3
P0.5
P0.7

2
4
6
8
10

PORT 0

Connector
Pin
Numbers

MCU Pin
Name

Connector
Pin
Numbers

MCU Pin
Name

P0.0

P0.1

P0.2

P0.3

P0.4

P0.5

P0.6

P0.7

VCC

10

GND

CN2 - 10PIN Box Header ( PORT 1 )


P1.[0..7]

P1.0
P1.2
P1.4
P1.6

VCC

P1.[0..7]

CN2
1
3
5
7
9

P1.1
P1.3
P1.5
P1.7

2
4
6
8
10

PORT 1

Connector
Pin
Numbers

MCU Pin
Name

Connector
Pin
Numbers

MCU Pin
Name

P1.0

P1.1

P1.2

P1.3

P1.4

P1.5

P1.6

P1.7

VCC

10

GND

9
www.pantechsolutions.net

8051 Advanced Development Board User Manual

CN4 - 10PIN Box Header ( PORT 2 )


P2.[0..7]

P2.[0..7]

CN4

P2.0
P2.2
P2.4
P2.6

1
3
5
7
9

VCC

P2.1
P2.3
P2.5
P2.7

2
4
6
8
10

PORT 2

Connector
Pin
Numbers

MCU Pin
Name

Connector
Pin
Numbers

MCU Pin
Name

P2.0

P2.1

P2.2

P2.3

P2.4

P2.5

P2.6

P2.7

VCC

10

GND

CN5 - 10PIN Box Header ( PORT 3 )


P3.[0..7]

P3.0
P3.2
P3.4
P3.6

VCC

P3.[0..7]

CN5
1
3
5
7
9

P3.1
P3.3
P3.5
P3.7

2
4
6
8
10

PORT 3

Connector
Pin
Numbers

MCU Pin
Name

Connector
Pin
Numbers

MCU Pin
Name

P3.0

P3.1

P3.2

P3.3

P3.4

P3.5

P3.6

P3.7

VCC

10

GND

10
www.pantechsolutions.net

8051 Advanced Development Board User Manual

JP2 6pin Header (Power select for MCU)


VCC

JP2
PWRSLT_MC
1
3
5

2
4
6

MC1_VCC
MC2_VCC
CAN_VCC

Jumper for Enable Power to MCU

Short Pin 1&2 of JP2(+5V, to MCU1 socket)

Short Pin 3&4 of JP2(+5V, to 44pin plcc socket MCU)

Short Pin 5&6 of JP2(+5V, to 44pin plcc AT89C51CC03 CAN controller)

Connector
Pin
Numbers

Signal
Name

Connector
Pin
Numbers

Signal
Name

VCC

MCU1(40-Dip)-8051

VCC

MCU2(44-PLCC)-8051

VCC

MCU3(AT89C51CC03CAN

Note : short jumpers only one at a time, otherwise it executes fault operation.

11
www.pantechsolutions.net

8051 Advanced Development Board User Manual

3. Power Supply

The external power can be AC or DC, with a voltage between (9V/12V,1A output) at
230V AC input. The 8051 board produces +5V using an LM7805 voltage regulator,
which provides supply to the entire device on the board. USB socket meant for power
supply only, user can select either USB or Ext power supply through JP1. Separate
On/Off Switch for controlling power to the board.
JP1
POWER

CN1 USB
5

1
2
3
1
D1

J1
1
2

2 -

VIN

VOUT

1
2
3
4
3
SW3

BRIDGE

78XX/TO
GND

U1

+ 4

VCC
DD+
GND

GNDGND

R1
330E

D2
SW KEY -SPST
3

POWER JACK

C2
470uf

C3
0.1uf

5V1
D3
LED

4. MCU Sockets

The 8051-development board is delivered with ATMELs 40-pin & 44pin CAN
Controller Microcontroller. User can remove this and fit different microcontroller
DIP40 packages of an adequate pin out.

NOTE : Since all packages have parallel connections, there must not be more than
One Microcontroller on the board at a time.

12
www.pantechsolutions.net

8051 Advanced Development Board User Manual

5. Flash Programming Utility


1. NXP (Philips)
NXP Semiconductors produce a range of Microcontrollers that feature both on-chip
Flash memory and the ability to be reprogrammed using In-System Programming
technology.
SW4

P3.0
P3.1

M_RXD0
M_TXD0

SW DIP-10

Programming Mode
SW4 (pin 9) make it on
(PSEN low), program
mode NXP (Philips)
microcontrollers.

Execution Mode
SW4 (pin 9) make it off
(PSEN nil), execution
mode NXP (Philips)
microcontrollers.

Note : Detailed Manual available at Flash Magic Help menu - Manual.

13
www.pantechsolutions.net

8051 Advanced Development Board User Manual

2. ATMEL Microcontroller ISP

Note : Atmel Microcontrollers (PGM mode), user can select switch settings to color
shaded position.(EXE Mode) disable switches to off position.
SW32
P1.7
P1.5
MC_RST
P1.6
SW DIP-4

Note : Detailed Manual available for


\8051ADB\Softwares\Programmers\AT89ISP\User Manual.pdf

14
www.pantechsolutions.net

8051 Advanced Development Board User Manual

2. Dallas Microcontroller ISP

SW4

P3.0
P3.1

M_RXD0
R2
M_TXD0
4K7

PSEN
MC_RST

VCC

VCC

EA

VCC

R3
4K7

R4
330E

LED
D4

SW DIP-10

Note : Dallas Microcontrollers (PGM mode), user can select switch settings to color
shaded position.(EXE Mode) disable switches to off position.

15
www.pantechsolutions.net

8051 Advanced Development Board User Manual

2. ATMEL CAN Microcontroller ISP

VCC
P3.0
P3.1

M_RXD0
R2
M_TXD0
4K7

EA

SW4

R3
4K7

VCC

R4
330E

PSEN
LED
D4

VCC
SW DIP-10

Note : Atmel CAN Microcontrollers (PGM mode), user can select switch settings to
color shaded position(EXE Mode) disable switches to off position.

16
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6. On-board Peripherals
The Development board comes with many interfacing options

8-Nos. of Point LEDs (Digital Outputs).

8-Nos. of Toggle switches (Digital Inputs).

2 Lines X 16 Character LCD Display.

128X64 GLCD Interface

Real Time Clock with battery backup.

4 Nos. of Seven-segment display.

Digital Temperature Sensor

4 X 4 Matrix keypad.

Relay / Stepper Motor driver circuit.

Digital to Analog Converter.

Serial EEPROM memory.

RS485 serial communication through long distance(>200m)

Two UART for serial port communication through PC.

PS/2 keyboard Interface.

10Mbps Ethernet Interface.

17
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.1 - Light Emitting Diodes

Light Emitting Diodes (LEDs) are the most commonly used components, usually
for displaying pins digital states.

The 8051 Development Board have 8 nos., of Point LED, user can interface the
point LEDs with any port. User can use P0, P1, P2 and P3 ports.

Connector CN8 for LED connector, when High Level goes to the pin LED glows.

R11

D1

D2

D3

D4

D5

D6

D7

LED8

LED7

LED6

LED5

LED4

LED3

LED2

LED1

2
3
4
5
6
7
8
9

470E

D8

CN8
D1
D3
D5
D7

1
3
5
7
9

2
4
6
8
10

D2
D4
D6
D8

LED

18
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program to shift LEDs Left and Right
*/
/*--------------------------------------------------------------------------*/
/* Filename :LED_Flash.c
Date:29/05/06
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/*
LED Port(CN8) : Port1 P1(CN2)
*/
/*--------------------------------------------------------------------------*/
#include <stdio.h>
#include <REG51.H>
#define LED P1
//define prot for LED
void delay(void);
void led_left(void);
void led_right(void);

//Delay function
//LED_Left
//LED_Right

unsigned int j;
//---------------------------------//LED LEFT FUNCTIONS
//---------------------------------void led_left()
{
for (j=0x01; j<=0x80; j<<=1)
{
LED = j;
delay();
}
}
//---------------------------------//LED RIGHT FUNCTIONS
//---------------------------------void led_right()
{
for (j=0x40; j>=0x01; j>>=1)
{
LED = j;
delay();
}
}

19
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//---------------------------------//Delay Functions
//---------------------------------void delay(void)
{
unsigned int i;
for (i=0;i<10000;i++)
{;}
}

//---------------------------------//
Main Program Starts
//---------------------------------void main (void)
{
LED = 0x00;
//Initialize to 0x00
while (1)
//Loop forever
{
led_left();
//scroll left
delay();
led_right();
//scroll right
}
}

20
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.2 Digital Inputs Toggle Switch

This is another simple interface, 8-Nos. of toggle switch, mainly used to give an
input to the port lines, and for some control applications also.

User can change the level of digital inputs whatever they want, either high or low
by simply selecting the jumper J3. The switches are connected to +5V, in order to
detect a switch state, pull-up or pull-down resistors should be used.

J3
1

GND

3
2
1

10K R10

CN6

VCC

SS1
SS3
SS5
SS7

2
4
6
8
10

SS2
SS4
SS6
SS8

1
SS8

SW25

1
2
SS7

SS6

SW24

SLIDE_SWITCH

SW23

1
SS5

SW22

1
SS4

SW21

1
SS3

SW20

1
SS2

SW19
SS1

SW18

2
3
4
5
6
7
8
9

CON3

1
3
5
7
9

21
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program for DIP Switch Interface
*/
/*--------------------------------------------------------------------------*/
/* Filename :DIPswitch.c
Date:29/05/06
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Note
: The DIP switch is connected to the port-2 active low '0'
*/
/*
and the LED to the port-0.
*/
/*--------------------------------------------------------------------------*/
#include<reg51.h>
//Define 8051 Registers
#define SW P2
#define Led P0
//---------------------//
Main Function
//---------------------void main()
{
P2=0xff;
P0=0x00;
while(1)
{
Led=SW;
}
}

//Define Switch to Port2


//Define Led to Port0

//Port-2 as input to FFh


//Port-0 as output to 00h
//Loop Forever
//Assign the Switch value to Led

22
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.3 - LCD 2x16 IN 8-BIT MODE

When using a character LCD in an 8-bit mode, the connector CN10 connects the LCD
to Microcontroller port lines. User can use LCD Data lines to Port P0, P1 and P2, not
P3, because P3 lines P3.5 (RS), P3.6(R/W) and P3.7 (Enable) connected by default.
The LCDs contrast can be adjusted by varying the trimpot (R13).

Before using LCD insert the shunt or shorting link of jumper J5 mentioned to CHAR
legend mark.

Place 2x16 Character LCD to proper place, mentioned legend in PCB.

J4

GND
VCC

R13
10K

VCC

CHAR
J5

3
2
1
VCC

CON3

R19 10E

GLCD

2x16 LCD

2
P3.5
P3.6
P3.7
GD0
GD1
GD2
GD3
GD4
GD5
GD6
GD7
RST

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

GLCD128X64
CN10

GD0
GD2
GD4
GD6

1
3
5
7
9

2
4
6
8
10

GD1
GD3
GD5
GD7

GLCD

Note: Possible ways to interface LCD (Not CN5).


LCD CON

MCU CON

1.

CN10

CN2

2.

CN10

CN3

3.

CN10

CN4

23
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example :Program to Display Message in LCD 8 Bit Mode
*/
/*--------------------------------------------------------------------------*/
/* Filename :lcd8bit.c
Date:29/05/06 */
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Note
:To display a message in LCD 8 bit mode.
*/
/*--------------------------------------------------------------------------*/
#include <reg51.h>
//Define 8051 Registers
#include <stdio.h>
//Define I/O Functions
#define DATA P1
//Define DATA to Port1

//Define control pins


sbit RS
= P3^5;
sbit RW
= P3^6;
sbit lcd_e = P3^7;
code unsigned char msg[]
code unsigned char msg1[]

//Register Select
//LCD Read/Write
//LCD Enable
= ("
= ("

8051 ADVANCED "); //Display the message


ADB BOARD ");

//---------------------------------//
LCD Functions
//---------------------------------void lcd_init(void);
void lcd_cmd(unsigned char);
void lcd_display(unsigned char);
void DelayMs(int);
//---------------------------------//
LCD command Function
//---------------------------------void lcd_cmd(unsigned char cmnd)
{
DATA = cmnd;
RS = 0;
RW = 0;
lcd_e = 1;
DelayMs(35);
lcd_e = 0;
}

24
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//---------------------------------//
LCD Data Function
//---------------------------------void lcd_display(unsigned char dat)
{
DATA = dat;
RS = 1;
RW = 0;
lcd_e = 1;
DelayMs(35);
lcd_e = 0;
}
//---------------------------------//
LCD Delay Function
//---------------------------------void DelayMs(int k)
{
unsigned int a;
for(a=0;a<=k;a++);
}
//---------------------------------//
LCD Initialization
//---------------------------------void lcd_init(void)
{
unsigned char i;
lcd_cmd(0x38);
DelayMs(15);
lcd_cmd(0x0c);
DelayMs(15);
lcd_cmd(0x06);
DelayMs(15);
lcd_cmd(0x01);
DelayMs(15);

//2x16 Character 5x7 dot


//matrix LCD,8-bit format
//Display On, cursor off
//Shift Cursor to right
//Clear display screen

//------------------------------------------//
First Line Message Display
//------------------------------------------lcd_cmd(0x80);
//First Line Initialization
DelayMs(35);
i=0;

25
www.pantechsolutions.net

8051 Advanced Development Board User Manual

while(msg[i]!='\0')
{
lcd_display(msg[i]);
i++;
}
DelayMs(50);
//------------------------------------------//
Second Line Message Display
//------------------------------------------lcd_cmd(0xc0);
//Second Line Initialization
DelayMs(35);
i=0;
while(msg1[i]!='\0')
{
lcd_display(msg1[i]);
i++;
}
DelayMs(50);
while(1);
}
//---------------------------------//
LCD Main Program
//---------------------------------void main(void)
{
lcd_init();
DelayMs(50);
while(1);
}

//LCD Initialization
//Loop Forever

26
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.4 - 128X64 Graphic LCD

When using a Graphic LCD, the connector CN10 connects the LCD to Microcontroller
port lines. User can use GLCD Data lines to Port P0, P1 and P2, not P3, because P3
lines P3.3(CS1), P3.4(CS2), P3.5(RS), P3.6(R/W) and P3.7 (Enable) connected by
default. The LCDs contrast can be adjusted by varying the trimpot(R13).

Before using LCD insert the shunt or shorting link of jumper J5 mentioned to GLCD
legend mark. Adjust(R13) for GLCD Negative Voltage

Place GLCD to proper place, mentioned in PCB.

J4

1
VCC
J5

3
2
1
VCC

CON3

GND
VCC

2
P3.5
P3.6
P3.7
GD0
GD1
GD2
GD3
GD4
GD5
GD6
GD7
RST
R19 10E

GLCD

GLCD128x64

R13
10K

CS1
CS2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

GLCD128X64
CN10

GD0
GD2
GD4
GD6

1
3
5
7
9

2
4
6
8
10

GD1
GD3
GD5
GD7

GLCD

Note: Possible ways to interface LCD (Not CN5).


LCD CON

MCU CON

1. CN10

CN2

2. CN10

CN3

3. CN10

CN4
27

www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example :Program to Display Picture in GLCD 128x64
*/
/*--------------------------------------------------------------------------*/
/* Filename :GLCD.c
Date:10/01/08 */
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Note
:To display a image in page0 & 1
*/
/*--------------------------------------------------------------------------*/
#include <reg51.h>
#include <stdio.h>
#define DATA P2

//Define 8051 Registers


//Define I/O Functions
//Define DATA to Port1

//Define control pins


sbit CS1
= P3^3;
sbit CS2
= P3^4;

//CS1 select LCD IC1


//CS2 select LCD IC2

sbit RS
sbit RW
sbit lcd_e

= P3^5;
= P3^6;
= P3^7;

//Register Select
//LCD Read/Write
//LCD Enable

//sbit RST

= P3^7;

//#define size 1024


void GLCD_PutPicture(const unsigned char *); //For method 3
void Select_page(unsigned char);
int i;
code unsigned char carsun_bmp[1024] ={ 0,
0,
0,
0,
4, 10, 58,
62,122,210,208,208,208,208,208, 48,
188, 60,172,172,246,247,255,110,254,190,126,126, 92,152, 96, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,128,128,128,
0,129,129,141,143,136,192, 80,208,200, 8, 8,
140, 12, 58, 58, 71,130,135, 0,161,208,112,240,160,166,166,153, 139,142,141,143, 15,
27, 23, 23, 27, 15, 15,143,190,187,191,159,
204,140,143,246,246,246,230,189,255,177,189,238,195, 76, 0, 0, 0, 0, 0, 0, 0,
0, 0, 24, 28,222,126,123, 57, 63,125,120,
15, 15, 3, 3, 65,193,225,193,192,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0, 98, 99, 29, 153,192,
66,199,132,132,133,135, 0, 0,128, 80,120, 81,113,118,
126,
63,
31,
22,227,253,248,224,192,193,194,194,194,195,129,
0,
1,131,131,191,191,230,234,234,188,248,241,195, 66, 71,129,133,
133,174,255,255,247,255,255,254,254,255,251,253,210,208, 0,
0, 0, 0, 0, 0, 32,
60, 52,247,254,241,245,239,255,188,182,254,
252,230,243,233,247,151,153,255,247,243,223,221,252,120,120,248, 104,120,248,112,112,
48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 17, 17, 17, 17, 16, 16, 16, 16, 16,
16, 16, 16, 16, 31, 31, 31, 31, 17, 17, 17, 17, 17, 17, 17, 18, 18, 25, 25, 44, 15,
31, 63, 63,111,127, 58, 63,119,119,255,191,
53, 22, 31, 11, 31, 31, 47, 63, 63,255,207,255,255, 47, 37, 0, 0, 0, 0, 0, 0,
0, 32,251,255,255,255,255,255,131,129,193,

28
www.pantechsolutions.net

8051 Advanced Development Board User Manual

227,227, 51, 55,229,199, 7, 15, 11, 27, 31, 28, 56,240, 96, 96, 97, 97, 97, 97, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96,224, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 97,
99, 98,102,108,248,240, 96, 96, 0,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 2,
23, 29, 33, 33,255,255,255,255,167,167, 58,
24,120,248,232,121,123,122,158,144,
0,252,158,159,127, 96,128, 14, 10, 10, 10, 10,
10, 10, 14, 0, 0, 0, 14, 10, 10, 10, 10,
10, 14, 14, 0, 0,128,255,248,232,192,192,254,254,254, 34, 34, 34, 34, 34, 34,254,
34, 34, 34, 34, 34, 34, 34,254,254,254, 50,
0, 0, 0,254,130,186, 58, 58, 98, 98, 98, 98, 2,254, 0, 0, 0,254,254,254,254,
34, 34, 34, 34,254,254, 34, 34, 34, 34, 34,
254,254,254,224,127,255,194,222,126,255,255,255,255,
0,
0,
0, 0,
0,
0,
0,
0,128,128,128, 96,191,255,127,255,255,225,195,
207,140,137, 8, 8, 8, 8, 25, 63, 59, 11, 79, 79, 73,233,254, 168,160,160, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 60, 63, 39, 47, 63, 63,125, 73, 9,225, 64, 72, 120,120,120,121, 73,
65, 77, 81, 25,121, 73,121, 49,113, 73, 73,
200,200,120,127, 80, 81, 64, 64, 64, 80, 80,240,224,127, 24,152, 144,201,233,249,249,
56,136, 8,144,241,121,120,160,248,240,112,
9,121, 63,127,120,104, 77, 76,124,255,255,255,255,248, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 3, 3,
6, 6, 12, 12, 24, 24, 16, 48, 32, 96, 96,
192,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 6, 6, 0, 0,
4, 0, 0, 2, 2, 34, 98, 98,208,209,145,
145, 16, 16, 16, 8, 8, 8, 4, 6, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,128,128,192,192,224,224,248,231,239,255,119, 67, 0, 0, 0, 0, 0, 0, 0,
0, 0,128,128, 0,192,192,192,192,192,192,
192,192,192,192,192,192,192,192,192,192,192,192,192, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 96,
64, 64, 65, 65, 99, 99, 98,102,102,108,108,120,120,120,112,112, 32, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 3, 2, 6, 6, 12, 12, 24, 24, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 16, 16, 0, 0, 0, 0, 0, 0,};

//---------------------------------//
LCD Functions
//---------------------------------void GLCD_Init();
void GLCD_Data(unsigned char);
void GLCD_Comd(unsigned char);
void DelayMs(int);

29
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//---------------------------------//
LCD command Function
//---------------------------------void GLCD_Comd(unsigned char cmnd)
{
DATA = cmnd;
//send command to port
RS = 0;
//make it RS to Low
RW = 0;
//make it RW to low
lcd_e = 1;
//enable high
DelayMs(10);
lcd_e = 0;
//enable low
}
//---------------------------------//
LCD Data Function
//---------------------------------void GLCD_Data(unsigned char dat)
{
DATA = dat;
//send command to port
RS = 1;
//make it RS to high
RW = 0;
//make it RW to low
lcd_e = 1;
//enable high
DelayMs(10);
lcd_e = 0;
//enable low
}

//---------------------------------//
LCD Delay Function
//---------------------------------void DelayMs(int k)
{
unsigned int a;
for(a=0;a<=k;a++);
}
//---------------------------------//
GLCD Initialization Function
//---------------------------------void GLCD_Init()
{
unsigned char Comd[5]={0xc0,0xb8,0x40,0x3f};//LCD Command list
Select_page(1);
//send commands to page1
for(i=0;i<4;i++)
GLCD_Comd(Comd[i]);
Select_page(0);
//send commands to page0
for(i=0;i<4;i++)
GLCD_Comd(Comd[i]);
}

30
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//---------------------------------//
Page Selection
//---------------------------------void Select_page(unsigned char Page)
{
if(Page)
{
CS1=0;
//Page 0 LCD IC1
CS2=1;
}
else
{
CS1=1;
//Page 1 LCD IC2
CS2=0;
}
}
//------------------------------------//
Display Picture for page0 & page1
//------------------------------------void GLCD_PutPicture(const unsigned char *ip) //Change here for method 1,2 & 3
{
int Page=0,i=0;
int Column=0;
for (Page = 0; Page < 8; Page++)
{
Select_page(1);
GLCD_Comd(0xb8 | Page);
GLCD_Comd(0x40);

//Display part of image to Page1

for (Column = 0; Column < 128; Column++)


{
if (Column == 64)
{
Select_page(0);
//Display part of image to Page0
GLCD_Comd(0xb8 |);
GLCD_Comd(0x40);
}
GLCD_Data(*ip++);
}
}
}
//-----------------------//
Main Program
//----------------------void main(void)
{
GLCD_Init();
DelayMs(10);
GLCD_PutPicture(carsun_bmp);
while(1);
}

//Initialize GLCD
//Display Image
//wait forever

31
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.5 - RS-232 Communication

RS-232 communication enables point-to-point data transfer. It is commonly used in


data acquisition applications, for the transfer of data between the microcontroller and
a PC.

The voltage levels of a microcontroller and PC are not directly compatible with those
of RS-232, a level transition buffer such as MAX232 be used.

VCC

11
10

M_RXD1
M_RXD0

12
9
1
C12

T1OUT
T2OUT

R1OUT
R2OUT

R1IN
R2IN

14
7

TX0_OUT
TX1_OUT

13
8

RX0_IN
RX1_IN

COM1

C1+
MAX232/DIP

3
4

C14
5

P2

C1C2+
C2-

VV+

C13 10uF

C15 10uF

CANL

15

10uF

T1IN
T2IN

GND

10uF

VCC

M_TXD1
M_TXD0

P1
5
9
4
8
RX1_IN 3
7
TX1_OUT2
6
1

16

U10

C11 100n

RX0_IN
CANH
TX0_OUT

5
9
4
8
3
7
2
6
1
COM2

: Note : Make switch positions below this UART0(P1).


SW4
P1.2
P1.3
P3.0
P3.1

M_RXD1
M_TXD1
M_RXD0
M_TXD0

SW DIP-10

32
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program to send data serially through serial port
*/
/*--------------------------------------------------------------------------*/
/* Filename :send.c
Date:29/05/06
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/*
Note : output can view by system's hyper terminal window
*/
/*
set baudrate to 9600
*/
/*--------------------------------------------------------------------------*/
#include <REG51.H>
#include <stdio.h>
void serial_init(void);

/*special function register declarations */


/*prototype declarations for I/O functions*/

//------------------------------------------------//Setup the serial port for 9600 baud at 11.0592MHz.


//------------------------------------------------void serial_init(void)
{
SCON = 0x50;
/* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20;
/* TMOD: timer 1, mode 2, 8-bit reload
*/
TH1
= 0xFD;
/* TH1: reload value for 9600 baud,11.0592MHz*/
TR1
= 1;
/* TR1: timer 1 run
*/
TI
= 1;
/* TI:
set TI to send first char of UART */
}
//Main Program Starts Here
//-------------------------void main(void)
{
serial_init();
while (1)
printf ("Hello! World\n");
}

/* Print "Hello World" */

Output

33
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program to send data serially through serial port 0 & 1
*/
/*--------------------------------------------------------------------------*/
/* Filename :UART0_1.c
Date:25/01/08
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Connection - Only Dallas MCU89c4xx
*/
/* ---------------------------------*/
/*
P3.0 - RXD0 (UART-0)
P1.2 - RXD1 (UART-1)
*/
/*
P3.1 - TXD0 (UART-0)
P1.3 - TXD1 (UART-1)
*/
/*
Note : PORT0(P1) - 9600 Baudrate
*/
/*
PORT1(P2) - 4800 Baudrate
*/
/*--------------------------------------------------------------------------*/
#include <reg420.H>
#include <stdio.h>

code unsigned char msg1[]={"Dallas UART-0"};


code unsigned char msg2[]={"Dallas UART-1"};
void DelayMs(unsigned int);
//--------------------------------//
Delay Function
//--------------------------------void DelayMs(unsigned int n)
{
unsigned int i,j;
for(j=0;j<n;j++)
for(i=0;i<1000;i++);
}

//--------------------------------------------------------------------//
This function initializes serial port 0&1 to run at 9600 , 4800
//
baud rate using the timer 1 auto-reload mode with a 11.0592MHz XTAL
//--------------------------------------------------------------------void serial_init(void)
{
PCON |= 0xC0;
SCON0 = 0x50; //serial-0 conn mode 1 - start, 8-data, 1 stop bit
SCON1
TMOD
TH1
TCON
TI_0
TI_1

= 0x52;
|= 0x21;
= -6;
= 0x50;
= 1;
= 1;

//serial-1 conn mode 1 - start, 8-data, 1 stop bit


//Timer 1 mode 2, 8-bit auto reload mode
//serial-0(9600), serial-1(4800) baud rate.
//Enable Transmit bit of serial 0
//Enable Transmit bit of serial 1

}
34
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//-------------------------//Main Program Starts Here


//-------------------------void main(void)
{
int i,j;
serial_init();
while (1)
{
while(msg1[i]!='\0')
{
SBUF0 = msg1[i++];
DelayMs(10);
}
DelayMs(10);
while(msg2[j]!='\0')
{
SBUF1 = msg2[j++];
DelayMs(10);
}
}

//UART0(9600 baudrate) msg

//UART1(4800 Baudrate) msg

}
Note : Dallas MCU User cant set 9600 baud rate for both the UART0 and UART1

PORT0(P1)

- 9600 baudrate

PORT1(P2)

4800 baudrate

Output

35
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.6 - Real Time Clock

The DS1307 Serial Real-Time Clock is a low power; full binary-coded decimal (BCD)
clock/calendar plus 56 bytes of NV SRAM. The DS1307 has a built-in power sense
circuit that detects power failures and automatically switches to the battery supply.
In

Embedded

modules

DS1307

of

pin

SDA

and

SCL

connected

to

the

Microcontrollers pin P2.1 and P2.0 respectively. Address and data are transferred
serially via a 2-wire, bi-directional bus. The clock/calendar provides seconds,
minutes, hours, day, date, month, and year information. The end of the month/ date
is automatically adjusted for months with fewer than 31 days, including corrections
for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM
indicator.

This RTC circuit is facilitated with Battery backup, when supply fails; battery voltage
goes to DS1307 RTC chip.
VCC

1K R40

D7

D9

SDA

R42
4K7

I2C_SDA

I2C_SCL

VBAT

X3
1
32.768KHz

R43
4K7

U17

1N4148

I2C_RTC

BT1

VCC

1N4148
D8

3.6V Battery
2

1N4148

X1

X2

SCLK
SQW/OUT

DS1307
P2.[0..7]
P2.0
P2.1

SW31
1
2
3
4
5
6
7
8

16
15
14
13
12
11
10
9

I2C_SCL
I2C_SDA

SW DIP-8

Note: Before using RTC make switch settings like above mentioned.

36
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program to Display I2C RTC(DS1307) to Hyper terminal window
*/
/*--------------------------------------------------------------------------*/
/* Filename :I2CRTC_Serial.c
Date:29/05/06 */
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/*
RTC(DS1307)
*/
/*
----------*/
/*
SCL : P2.0
*/
/*
SDA : P2.1
*/
/* Output : Port0(P1) ...Hyper terminal, 9600baud rate
*/
/*--------------------------------------------------------------------------*/
#include<reg51.h>
#include<stdio.h>
#include<intrins.h>
//------------------// DS1307 driver
//------------------#define ACK
1
#define NO_ACK
0
#define SLAVE
0xD0
#define WRITE
0x00
#define READ
0x01
#define ERR_ACK 0x01

unsigned char i;
const unsigned char * DayStr[7]

{{"Sun"},
{"Mon"},
{"Tue"},
{"Wen"},
{"The"},
{"Fri"},
{"Sat"}};

const unsigned char * MonthStr[12]

={{"Jan"},
{"Feb"},
{"Mar"},
{"Apr"},
{"May"},
{"Jun"},
{"Jul"},
{"Aug"},
{"Sep"},
{"Oct"},
{"Nov"},
{"Dec"}};

37
www.pantechsolutions.net

8051 Advanced Development Board User Manual

sbit SCL
sbit SDA

=
=

P2^0;
P2^1;

// connect to SCL pin (Clock)


// connect to SDA pin (Data)

unsigned char RTC_ARR[7];


unsigned char p;

// Buffer for second,minute,.....,year

//--------------------------------------// Initialize serial port


//--------------------------------------void InitSerial(void)
{
SCON = 0x52;
// setup serial port control
TMOD = 0x20;
// hardware (9600 BAUD @11.05592MHZ)
TH1 = 0xFD;
// TH1
TR1
= 1;
// Timer 1 on
}

//---------------------------------// Convert BCD 1 byte to HEX 1 byte


//---------------------------------unsigned char BCD2HEX(unsigned int bcd)
{
unsigned char temp;
temp=((bcd>>8)*100)|((bcd>>4)*10)|(bcd&0x0f);
return temp;
}
//------------------------------// start I2C
//------------------------------void Start(void)
{
SDA = 1;
SCL = 1;
_nop_();_nop_();
SDA = 0;
_nop_();_nop_();
SCL = 0;
_nop_();_nop_();
}
//------------------------------// stop I2C
//------------------------------void Stop(void)
{
SDA = 0;
_nop_();_nop_();
SCL = 1;
_nop_();_nop_();
SDA = 1;
}

38
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//------------------------------// Write I2C


//------------------------------void WriteI2C(unsigned char Data)
{
for (i=0;i<8;i++)
{
SDA = (Data & 0x80) ? 1:0;
SCL=1;SCL=0;
Data<<=1;
}
SCL = 1;
_nop_();_nop_();
SCL = 0;
}
//------------------------------// Read I2C
//------------------------------unsigned char ReadI2C(bit ACK_Bit)
{
unsigned char Data=0;
SDA = 1;
for (i=0;i<8;i++)
{
SCL
= 1;
Data<<= 1;
Data = (Data | SDA);
SCL
= 0;
_nop_();
}
if (ACK_Bit == 1)
SDA = 0;
// Send ACK
else
SDA = 1;
// Send NO ACK
_nop_();_nop_();
SCL = 1;
_nop_();_nop_();
SCL = 0;
return Data;
}

39
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//------------------------------// Read 1 byte form I2C


//------------------------------unsigned char ReadBYTE(unsigned char Addr)
{
unsigned char Data;
Start();
WriteI2C(0xD0);
WriteI2C(Addr);
Start();
WriteI2C(0xD1);
Data = ReadI2C(NO_ACK);
Stop();
return(Data);
}
//------------------------------// Write 1 byte to I2C
//------------------------------void WriteBYTE(unsigned char Addr,unsigned char Data)
{
Start();
WriteI2C(0xD0);
WriteI2C(Addr);
WriteI2C(Data);
Stop();
}
//------------------------------// Read RTC (all real time)
//------------------------------void ReadRTC(unsigned char * buff)
{
Start();
WriteI2C(0xD0);
WriteI2C(0x00);
Start();
WriteI2C(0xD1);
*(buff+0)=ReadI2C(ACK); //
*(buff+1)=ReadI2C(ACK); //
*(buff+2)=ReadI2C(ACK); //
*(buff+3)=ReadI2C(ACK); //
*(buff+4)=ReadI2C(ACK); //
*(buff+5)=ReadI2C(ACK); //
*(buff+6)=ReadI2C(NO_ACK);
Stop();

Second
Minute
hour
Day
date
month
// year

40
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//------------------------------// Write RTC


//------------------------------void WriteRTC(unsigned char *buff)
{
Start();
WriteI2C(0xD0);
WriteI2C(0x00);
WriteI2C(*(buff+0));
WriteI2C(*(buff+1));
WriteI2C(*(buff+2));
WriteI2C(*(buff+3));
WriteI2C(*(buff+4));
WriteI2C(*(buff+5));
WriteI2C(*(buff+6));
Stop();
}
//------------------------------// Convert date (BCD) to string of Day
// 1=Sanday
// 2=Monday
// And so on
//------------------------------char * Int2Day(unsigned char day)
{
return DayStr[day-1];
}
//------------------------------// Convert month (BCD) to string of Month
// 0x01=January
// 0x02=February
// ...........
// 0x12 = December
// And so on
//------------------------------char * Int2Month(unsigned char month)
{
return MonthStr[BCD2HEX(month)-1];
}
// Delay mS function
//--------------------------------------void DelayMs(unsigned int count)
{
unsigned int i;
while(count)
{
i = 115;
while(i>0) i--;
count--;
} }

// mSec Delay 11.0592 Mhz


// Keil v7.5a

41
www.pantechsolutions.net

8051 Advanced Development Board User Manual

// DELAY at 11.0592MHz crystal.


// Calling the routine takes about 22us, and then
// each count takes another 17us.
//--------------------------------------------void DelayUs(int us)
{
int i;
for (i=0; i<us; i++);
}
/***************************************
// Main program
/***************************************/
void main(void)
{
InitSerial();
// Initialize serial port
// Setup time and enable oscillator
//----------------------------------ReadRTC(&RTC_ARR[0]);
RTC_ARR[0] = RTC_ARR[0] & 0x7F;
//
RTC_ARR[1] = 0x59;
//
RTC_ARR[2] = 0x23;
//
RTC_ARR[3] = 0x04;
//
RTC_ARR[4] = 0x31;
//
RTC_ARR[5] = 0x10;
//
RTC_ARR[6] = 0x08;
//
WriteRTC(&RTC_ARR[0]);
//

enable oscillator (bit 7=0)


minute = 59
hour = 05 ,24-hour mode(bit 6=0)
Day = 1 or sunday
Date = 30
month = August
year = 05 or 2008
Set RTC

while(1) {
ReadRTC(&RTC_ARR[0]);
putchar(0x0C);
// clear Hyper terminal
printf("Day : %s\r\n",Int2Day(RTC_ARR[3]));
printf("Time : %02bX:%02bX:%02bX\r\n",RTC_ARR[2],RTC_ARR[1],RTC_ARR[0]);
printf("Data : %02bX-%s-20%02bX",RTC_ARR[4],Int2Month(RTC_ARR[5]),RTC_ARR[6]);
DelayMs(1000);
// delay about 1 second
} }
Output

42
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.7 Serial EEPROM

The AT24C01A/02/04/08/16 provides 1024/2048/4096/8192/16384 bits of serial


electrically erasable and programmable read-only memory (EEPROM) organized as
128/256/512/1024/2048 words of 8 bits each. The device is optimized for use in
many industrial and commercial applications where low-power and low-voltage
operation are essential. The AT24C01A/02/04/08/16 is available in space-saving 8pin PDIP.

Features of AT24Cxx:

Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K)

2-wire Serial Interface


Schmitt Trigger, Filtered Inputs for Noise Suppression
Bi-directional Data Transfer Protocol
100 kHz (1.8V, 2.5V, 2.7V) and 400 kHz (5V) Compatibility
Write Protect Pin for Hardware Data Protection
8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes
Partial Page Writes are Allowed
Self-timed Write Cycle (10 ms max)
High-reliability
Endurance: 1 Million Write Cycles

Data Retention: 100 Years

VCC

1
2
3
4
5
6
7
8

16
15
14
13
12
11
10
9

I2C_SDA
I2C_SCL

5
6

SDA
SCL

P2.0
P2.1

SW31

U18

GNDVCC

P2.[0..7]

A0
A1
A2
WP

1
2
3
7

AT24CXX

SW DIP-8

43
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program to write and read EEPROM data through serial port
*/
/*--------------------------------------------------------------------------*/
/* Filename :I2CEEPROM_Serial.c
Date:29/05/06 */
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/*
EEPROM(AT24C04)
*/
/*
----------*/
/*
SCL : P2.0
*/
/*
SDA : P2.1
*/
/* Output : Port0(P1) ...Hyperterminal, 9600baud rate
*/
/*--------------------------------------------------------------------------*/
#include<reg51.h>
#include<stdio.h>
#include<serial.h>
#include<delay.h>
#include<intrins.h>
#define ACK
#define NO_ACK

1
0

unsigned char i;
unsigned char EData[5];
unsigned char Data;
void WriteI2C(unsigned char);
void Start(void);
void Stop(void);
void ReadBYTE(unsigned int);
void WriteBYTE(unsigned int);
unsigned char ReadI2C(bit);
sbit SCL
sbit SDA

=
=

P2^0;
P2^1;

// connect to SCL pin (Clock)


// connect to SDA pin (Data)

//--------------------------------------// Main program


//--------------------------------------void main(void)
{
InitSerial();
// Initialize serial port
putchar(0x0C);
// clear hyper terminal
DelayMs(5);
WriteBYTE(0x0000);
WriteI2C('A');
WriteI2C('B');
WriteI2C('C');
WriteI2C('D');
WriteI2C('E');
44
www.pantechsolutions.net

8051 Advanced Development Board User Manual

WriteI2C('F');
Stop();
DelayMs(10);
ReadBYTE(0x0000);
EData[0] = ReadI2C(NO_ACK);
EData[1] = ReadI2C(NO_ACK);
EData[2] = ReadI2C(NO_ACK);
EData[3] = ReadI2C(NO_ACK);
EData[4] = ReadI2C(NO_ACK);
EData[5] = ReadI2C(NO_ACK);
for(i=0;i<6;i++)
{
printf("value = %c\n",EData[i]);
DelayMs(100);
}

// display data

while(1);
}

//--------------------------------------// Initialize serial port


//--------------------------------------void InitSerial(void)
{
SCON = 0x52;
// setup serial port control
TMOD = 0x20;
// hardware (9600 BAUD @11.0592MHZ)
TH1 = 0xFD;
// TH1
TR1
= 1;
// Timer 1 on
}

//------------------------------// start I2C


//------------------------------void Start(void)
{
SDA = 1;
SCL = 1;
_nop_();_nop_();
SDA = 0;
_nop_();_nop_();
SCL = 0;
_nop_();_nop_();
}

45
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//------------------------------// stop I2C


//------------------------------void Stop(void)
{
SDA = 0;
_nop_();_nop_();
SCL = 1;
_nop_();_nop_();
SDA = 1;
}
//------------------------------// Write I2C
//------------------------------void WriteI2C(unsigned char Data)
{
for (i=0;i<8;i++)
{
SDA = (Data & 0x80) ? 1:0;
SCL=1;SCL=0;
Data<<=1;
}
SCL = 1;
_nop_();_nop_();
SCL = 0;
}
//------------------------------// Read I2C
//------------------------------unsigned char ReadI2C(bit ACK_Bit)
{
Start();
WriteI2C(0xA1);
SDA = 1;
for (i=0;i<8;i++)
{
SCL
= 1;
Data<<= 1;
Data = (Data | SDA);
SCL
= 0;
_nop_();
}
if (ACK_Bit == 1)
SDA = 0; // Send ACK
else
SDA = 1; // Send NO ACK

46
www.pantechsolutions.net

8051 Advanced Development Board User Manual

_nop_();_nop_();
SCL = 1;
_nop_();_nop_();
SCL = 0;
Stop();
return Data;
}
// Read 1 byte form I2C
//------------------------------void ReadBYTE(unsigned int Addr)
{
Start();
WriteI2C(0xA0);
WriteI2C((unsigned char)(Addr>>8)&0xFF);
WriteI2C((unsigned char)Addr&0xFF);
}
// Write 1 byte to I2C
//------------------------------void WriteBYTE(unsigned int Addr)
{
Start();
WriteI2C(0xA0);
WriteI2C((unsigned char)(Addr>>8)&0xFF);
WriteI2C((unsigned char)Addr&0xFF);
}
// Delay mS function
void DelayMs(unsigned int count)
{
unsigned int i;
while(count)
{
i = 115;
while(i>0) i--;
count--;
} }
OUTPUT

// send address high


// send address low

// mSec Delay 11.0592 Mhz


// Keil v7.5a

47
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.8 - Seven Segment Display

In Embedded module 4 nos. of common anode seven segment displays are used. The
segment lines of seven segments LED is being terminated at connector CN9. The digit
select lines are connected to the port pins of 8051 by using BC547. All the common
anode displays consume very small amount of current. User can use segment lines
at any port P0, P1 and P2, by default digit select lines connected to Port P3 of Pin3.4

P3.7

P3.6

P3.5

P3.4

to P3.7.

CN9

R15 1K
2

Q1

Q2

R16 1K
2

R17
Q3

1K
2

VCC
R14 1K
2

B
D
F
DP

2
4
6
8
10

1
3
5
7
9

A
C
E
G

Q4

D
E
F
G
DP

R24 SEG5

330E

R25 SEG6

330E

R26 SEG7

SEG[0..7]

SEG[0..7]

3
A
B
C
D
E
F
G
DP

7 SEG DISP

7 SEG DISP

7 SEG DISP

A
B
C
D
E
F
G
DP

CA

R23 SEG4

330E

A
B
C
D
E
F
G
DP

U8
SEG0 7
SEG1 6
SEG2 4
SEG3 2
SEG4 1
SEG5 9
SEG610
SEG7 5

CA

330E

A
B
C
D
E
F
G
DP

CA

R22 SEG3

U7
SEG0 7
SEG1 6
SEG2 4
SEG3 2
SEG4 1
SEG5 9
SEG610
SEG7 5

CA

R21 SEG2

330E

CA

330E

U6
SEG0 7
SEG1 6
SEG2 4
SEG3 2
SEG4 1
SEG5 9
SEG610
SEG7 5

U5
SEG0 7
SEG1 6
SEG2 4
SEG3 2
SEG4 1
SEG5 9
SEG610
SEG7 5

R20 SEG1

CA

330E

CA

R18 SEG0

CA

SEG[0..7]
330E

7 SEG LED

7 SEG DISP

SEG[0..7]

User can connect 7-seg Data lines following possible ways (Not CN5).
7 SEG CON

MCU CON

CN9

CN2

CN9

CN3

CN9

CN4

48
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program to Display counts from 0-1000 in 7Segment Display
*/
/*--------------------------------------------------------------------------*/
/* Filename :7Seg.c
Date:29/05/06
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Data Line
: P2
*/
/* Digit1
: P3.4
*/
/* Digit2
: P3.5
*/
/* Digit3
: P3.6
*/
/* Digit4
: P3.7
*/
/*--------------------------------------------------------------------------*/
/* Note :The 7Segment display are interfaced to the Port2.The counting of */
/*
numbers from (0-1000) are displayed in 7Segment display.
*/
/*--------------------------------------------------------------------------*/
#include<stdio.h>
#include<reg51.h>
unsigned char SetDisplay(unsigned char);
void delay(void);
sbit
sbit
sbit
sbit

eseg1000
eseg100
eseg10
eseg1

=
=
=
=

P3^7;
P3^6;
P3^5;
P3^4;

unsigned char d0,d1,d2,d3;


unsigned char SetDisplay(unsigned char value)
{
unsigned char segment[]={0xc0 ,0xf9,0xa4,0xb0,0x99,0x92,0x83,0xf8,0x80,0x98};
if(value<=10)
return segment[value];
else
return 0;
}
//Delay Function
//-------------void delay()
{
int i;
for(i=0; i<500; i++)
i = i + 0;
}

49
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//-------------//Main Program
//-------------void main(void)
{
unsigned char count = 0;
unsigned long timer = 0;
int turn = 1;
P2 = 0xff;
while(1)
{
if(turn==1)
//7-Seg Display 0
{
eseg1000=0;
eseg100=0;
eseg10=0;
eseg1=1;
P2=SetDisplay(d0);
turn = 2;
delay();
}
else if(turn==2)
//7-Seg Display 1
{
eseg1=0;
eseg1000=0;
eseg100=0;
eseg10=1;
P2=SetDisplay(d1);
turn = 3;
delay();
}
else if(turn==3)
//7-Seg Display 2
{
eseg10=0;
eseg1=0;
eseg1000=0;
eseg100=1;
P2=SetDisplay(d2);
turn = 0;
delay();
}

50
www.pantechsolutions.net

8051 Advanced Development Board User Manual

else
{

//7-Seg Display 3

eseg100=0;
eseg10=0;
eseg1=0;
eseg1000=1;
P1=SetDisplay(d3);
turn = 1;
delay();
}
buzzer = 0;
if(timer == 100){
d0++;
buzzer=1;
timer=0;
if(d0>=10){
d0=0;
d1++;
if(d1>=10){
d1=0;
d2++;
if(d2>=10){
d2=0;
d3++;
if(d3>=10){
d3=0;
}
}
}
}
}
timer++;
}
}

51
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.9 - Interrupts

Microcontrollers two external interrupts lines are terminated at switches SW1 (INT0)
and SW2 (INT1).

SW1

INT0
INT0

SW2

INT1
INT1

INTERRUPTS

Note: While using interrupt P3.2 make high (on) to SW4 for Interrupt 0, P3.3
make(on) to SW4 for interrupt 1.

SW4
P1.2
P1.3
P3.0
P3.1
P3.2
P3.3

INT0
INT1

M_RXD1
M_TXD1
M_RXD0
M_TXD0

SW DIP-10

52
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.10 - DS1820 Digital Thermometer

The DS1820 digital thermometer is well suited to environmental temperature


measurement, having a temperature range of 55C to 125C and an accuracy of +/0.5C.

It must be placed correctly in the 3-pin socket in the 8051; otherwise the DS1820
could be permanently damaged.

P2.[0..7]

DQ

GND
1

VCC

Vdd

U12 DS1820

SW31

P2.2

1
2
3
4
5
6
7
8

16
15
14
13
12
11
10
9

R34 4K7
1_WIRE

SW DIP-8

Features

Unique 1-Wire interface requires only one port pin for communication

Multi-drop capability simplifies distributed temperature sensing applications

Can be powered from data line. Power supply range is 3.0V to 5.5V

Measures temperatures from -55C to +125C (-67F to +257F)

0.5C accuracy from -10C to +85C

9-bit thermometer resolution, Converts temperature in 750ms (max.)

53
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : DS1820 Digital Temp Sensor output displayed Serial Window
*/
/*--------------------------------------------------------------------------*/
/* Filename :DS18S20.c
Date:29/05/06
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/*
Data :
P2.2
*/
/*--------------------------------------------------------------------------*/
#include<reg52.h>
#include<stdio.h>
sbit DQ = P2^2; // connect with DS1820 Data pin
unsigned char MyTemp[9];
void DelayUs(int);
// Reset DS1820
//---------------------------------------bit ResetDS1820(void)
{
bit presence;
DQ = 0;
//pull DQ line low
DelayUs(29);
// leave it low for about 490us
DQ = 1;
// allow line to return high
DelayUs(3);
// wait for presence 55 uS
presence = DQ;
// get presence signal
DelayUs(25);
// wait for end of timeslot 316 uS
return(presence);
// presence signal returned
}
// 0=presence, 1 = no part
//----------------------------------------// Read one bit from DS1820
//----------------------------------------bit ReadBit(void)
{
unsigned char i=0;
DQ = 0;
// pull DQ low to start timeslot
DQ=1;
for (i=0; i<3; i++);
// delay 17 us from start of timeslot
return(DQ);
// return value of DQ line
}
//----------------------------------------// Write one bit to DS1820
//----------------------------------------void WriteBit(bit Dbit)
{
unsigned char i=0;
DQ=0;
DQ = Dbit ? 1:0;
DelayUs(5);
// delay about 39 uS
DQ = 1;
}

54
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//----------------------------------------// Read 1 byte from DS1820


//----------------------------------------unsigned char ReadByte(void)
{
unsigned char i;
unsigned char Din = 0;
for (i=0;i<8;i++)
{
Din|=ReadBit()? 0x01<<i:Din;
DelayUs(6);
}
return(Din);
}
//----------------------------------------// Write 1 byte
//----------------------------------------void WriteByte(unsigned char Dout)
{
unsigned char i;
for (i=0; i<8; i++)
// writes byte, one bit at a time
{
WriteBit((bit)(Dout & 0x1)); // write bit in temp into
Dout = Dout >> 1;
}
DelayUs(5);
}
//----------------------------------------// Read temperature
//----------------------------------------void ReadTemp(unsigned char * buff)
{
unsigned char n;
EA=0;
// disable all interrupt
ResetDS1820();
WriteByte(0xcc);
// skip ROM
WriteByte(0x44);
// perform temperature conversion
while (ReadByte()==0xff); // wait for conversion complete
ResetDS1820();
WriteByte(0xcc);
// skip ROM
WriteByte(0xbe);
// read the result
for (n=0; n<9; n++)
// read 9 bytes but, use only one byte
{
buff[n]=ReadByte(); // read DS1820
}
EA=1;
}

55
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//--------------------------------------//Serial Port Initialization


//--------------------------------------void InitSerial(void)
{
SCON = 0x52;
// setup serial port control
TMOD = 0x20;
// hardware (9600 BAUD @11.05592MHZ)
TH1 = 0xFD;
// TH1
TR1
= 1;
// Timer 1 on
}
//--------------------------------------// Delay mS function
//--------------------------------------void DelayMs(unsigned int count)
{
// mSec Delay 11.0592 Mhz
unsigned int i;
// Keil v7.5a
while(count) {
i = 115;
while(i>0) i--;
count--;
}
}
//------------------------------------------------------// DELAY at 11.0592MHz crystal.
// Calling the routine takes about 22us, and then
// each count takes another 17us. test with KEIL C51 V7.5
// ----------------------------------------------------void DelayUs(int us)
{
int i;
for (i=0; i<us; i++);
}

//--------------------------------------// Main program


//--------------------------------------void main(void)
{
unsigned char tp,tpd,i;
InitSerial();
// Initialize serial port
while(1)
{
ReadTemp(&MyTemp[0]);
tp = MyTemp[0] >> 1;
tpd = ((MyTemp[0] >> 1)&1) ? 5:0;
putchar(0x0C);
// clear Hyper terminal
printf("%bu Temperature : %2bu.%bu\r\n",i++,tp,tpd);
DelayMs(200);
}
}

56
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.11 - 4x4 Matrix keypad


Keypads arranged by matrix format, each row and column section pulled by high, all
row and column lines terminated at CN7.

J2

1
2
3

CON3

SW6

SW7

SW8

VCC

SW9

GND
10K

2
3
4
5
6
7
8
9

R1
SW10

SW11

SW12

SW13

SW14

SW15

SW16

SW17

R2

R12
R3
SW26

SW27

SW28

SW29

R4
CN7
C1

C2

C3

C4

R1
R3
C1
C3

1
3
5
7
9

2
4
6
8
10

R2
R4
C2
C4

KEY PAD

57
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program for 4X4 Matrix Keyboard with LCD
*/
/*--------------------------------------------------------------------------*/
/* Filename :Keypad_LCD.c
Date:29/05/06
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/*
LCD Data Lines
: Port P1(CN2)
*/
/*
Keypads
: Port P2(CN4)
*/
/*
Note :Getting a key value from a 4X4 Matrix Keypad (based on the Row */
/*
and Column value of corresponding Key) and displaying it in the*/
/*
LCD.
*/
/*---------------------------------------------------------------------------#include <stdio.h>
//Define I/O Functions
#include <reg51.h>
//Define 8051 Registers
#define DATA P1

//Define DATA to Port1 LCD

void
void
void
void
void

//LCD Initialization
//LCD Command Function
//LCD Display Function
//KeyScan Function
//DelayMs Function

lcd_init(void);
lcd_cmd(unsigned char);
lcd_display(unsigned char);
Key_Scan(void);
DelayMs(int);

sbit RS
= P3^5;
sbit RW
= P3^6;
sbit lcd_e = P3^7;

//Register Select
//LCD Read/Write
//LCD Enable

unsigned char R,C,ch,d=0x81;


unsigned int i=0;
unsigned char Key[4][4] = {'C','D','E','F',
'8','9','A','B',
'4','5','6','7',
'0','1','2','3',};
code unsigned char msg[]
code unsigned char msg1[]

//Matrix Keypad Character


//Initialization

= ("KEYPAD TEST PGM ");


= ("PRES ANY KEY... ");

//Display the Message


//in LCD

//------------------------------//
Main Program
//------------------------------void main()
{
lcd_init();
DelayMs(20);
lcd_cmd(0x01);
lcd_e=0;
lcd_cmd(0x80);

58
www.pantechsolutions.net

8051 Advanced Development Board User Manual

while(1)
{
Key_Scan();
lcd_e=1;
DelayMs(5);
ch = Key[R][C];
DelayMs(5);
lcd_display(ch);
lcd_cmd(d++);
DelayMs(10);
P2=0xFF;

//Assign Key value to ch;


//and Row Value of Keypad

}
}
//------------------------------//
Key Scan Function
//------------------------------void Key_Scan(void)
{
unsigned int i = 0;
//Scanning for Row Value
P2 = 0x0F;
while(P2 == 0x0F);

//Initialize Port2 to 0Fh

if(P2 == 0x0E)
R = 0;
else if(P2 == 0x0D)
R = 1;
else if(P2 == 0x0B)
R = 2;
else if(P2 == 0x07)
R = 3;

//Checking for Row0


//Checking for Row1
//Checking for Row2
//Checking for Row3

//Scanning for Column Value


P2 = 0xF0;
while(P2 == 0xF0);

//Initialize Port2 to F0h

if(P2 == 0xE0)
C = 0;
else if(P2 == 0xD0)
C = 1;
else if(P2 == 0xB0)
C = 2;
else if(P2 == 0x70)
C = 3;

//Checking for Column0


//Checking for Column1
//Checking for Column2
//Checking for Column3

DelayMs(20);
}

59
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//------------------------------//
LCD command Function
//------------------------------void lcd_cmd(unsigned char cmnd)
{
DATA = cmnd;
RS = 0;
RW = 0;
lcd_e = 1;
DelayMs(15);
lcd_e = 0;
}
//------------------------------//
LCD Data Function
//------------------------------void lcd_display(unsigned char dat)
{
DATA = dat;
RS = 1;
RW = 0;
lcd_e = 1;
DelayMs(15);
lcd_e = 0;
}
//------------------------------//
LCD Initialization
//------------------------------void lcd_init(void)
{
unsigned char i;
lcd_cmd(0x38);
DelayMs(15);
lcd_cmd(0x0c);
DelayMs(15);
lcd_cmd(0x06);
DelayMs(15);
lcd_cmd(0x01);
DelayMs(15);
//
First Line Message Display
//-----------------------------------lcd_cmd(0x80);
DelayMs(15);
i=0;
while(msg[i]!='\0')
{
lcd_display(msg[i]);
i++;
}
DelayMs(20);

//RS:Register Select
//RW:Read/Write
//LCD Enable

//RS:Register Select
//RW:Read/Write

//2x16 Character 5x7 dot


//matrix LCD,8-bit format
//Display On, cursor off
//Shift Cursor to right
//Clear display screen

//First Line Initialization

60
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//
Second Line Message Display
//-----------------------------------lcd_cmd(0xc0);
DelayMs(15);
i=0;
while(msg1[i]!='\0')
{
lcd_display(msg1[i]);
i++;
}
DelayMs(30);

//Second Line Initialization

}
//-------------------------//
DelayMs Function
//-------------------------void DelayMs(int k)
{
unsigned int a,b;
for(a=0;a<=k;a++)
for(b=0;b<1275;b++);
}

61
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.12 - Motor / Driver Section


The ULN2803A is a high-voltage, high-current Darlington transistor array. The device
consists of eight npn Darlington pairs that feature high-voltage outputs with
common-cathode clamp diodes for switching inductive loads. The collector-current
rating of each Darlington pair is 500 mA. The Darlington pairs may be connected in
parallel for higher current capability.

ULN2803 is used as a driver for port I/O lines, drivers output terminated to connector
CN11, there can interface relay/stepper motor or any driving source could need more
than 50mA. Motor can connect JP8 or J6 connector.

Note : User select Internal Vcc or External through JP10 header.

U9
1
2
3
4
5
6
7
8
9

DR1
DR2
DR3
DR4
DR5
DR6
DR7
DR8

I1
I2
I3
I4
I5
I6
I7
I8
GND

O1
O2
O3
O4
O5
O6
O7
O8
COMM

18
17
16
15
14
13
12
11
10

STM_A
STM_B
STM_C
STM_D
RL1
RL2

J6
1
2
3
4
5
6

ULN_PWR
HEADER 6

ULN2803A

JP8

CN11
DR1
DR3
DR5
DR7

1
3
5
7
9

DR2
DR4
DR6
DR8

2
4
6
8
10

MOTOR/RELAY

1
2
3
MOTOR/RELAY

1
2
3
4
5
6

STM_A
STM_B
ULN_PWR
STM_C
STM_D

HEADER 6

J7

JP10
VCC
ULN_PWR
EXT_VCC

STM_A
STM_B
STM_C
STM_D
ULN_PWR

EXT_VCC 2
1

HEADER 2

62
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Stepper Motor Interface
*/
/*--------------------------------------------------------------------------*/
/* Filename :Stepper.c
Date:29/05/06 */
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Note
: To rotate the stepper motor in clockwise direction
*/
/*--------------------------------------------------------------------------*/
#include <reg51.h>
//Define 8051 registers
#include<stdio.h>
void DelayMs(unsigned int);

//Delay function

//---------------------------------//
Main Program
//---------------------------------void main (void)
{
P2 = 0;

//Initialize Port2

while(1)
{
P2
P2
P2
P2
}

//Loop Forever
=
=
=
=

0x01;DelayMs(20);
0x02;DelayMs(20);
0x04;DelayMs(20);
0x08;DelayMs(20);

//Delay 20msec

//--------------------------------//
Delay Function
//--------------------------------void DelayMs(unsigned int n)
{
unsigned int i,j;
for(j=0;j<n;j++)
{
for(i=0;i<1000;i++);
}
}

63
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.13 - Relay Section


In ADB Board two no. Of SPDT relays are used. Both the relays operate on 5V DC.
The outputs of both the terminals of the relay are taken out on the connecter to
connect the external circuitry. The relay can be connected to the Microcontroller
through any of the selected port (P0.4 & P0.5) or (P1.4 & P1.5) or (P2.4 & P2.5) by
using the FRC connecter.

R45

330E

D13

RELAY SPDT

RELAY SPDT

RL1
ULN_PWR 2
RL1
1

LED
R46

330E

R1_C

D14

ULN_PWR 2
RL2
1

LS1
4

R1_NC

R1_NO

R2_C

LS2
4

R2_NC

R2_NO

RELAY O/P2

R2_NO
R2_C
R2_NC
3
2
1

JP7

JP6

VCC

RELAY O/P1

LED

3
2
1

R1_NO
R1_C
R1_NC

RL2

64
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Relay Example Program
*/
/*--------------------------------------------------------------------------*/
/* Filename :Relay.c
Date:29/05/06
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Note
:Each Relay will on/off some intervals
*/
/*--------------------------------------------------------------------------*/
#include <reg51.h>
#include<stdio.h>

//Define 8051 registers

sbit relay1 = P2^4;


sbit relay2 = P2^5;
void DelayMs(unsigned int);

//Delay function

//---------------------------------//
Main Program
//---------------------------------void main (void)
{
P2 = 0;

//Initialize Port2

while(1)
{
relay1 = 1;
relay2 = 0;
DelayMs(200);
relay1 = 0;
relay2 = 1;
DelayMs(200);
}

//Loop Forever
//Relay1 - ON
//Relay2 - Off
//Delay 20msec
//Relay1 - Off
//Relay2 - ON
//Delay 20msec

//--------------------------------//
Delay Function
//--------------------------------void DelayMs(unsigned int n)
{
unsigned int i,j;
for(j=0;j<n;j++)
{
for(i=0;i<1000;i++);
}
}

65
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.14 - SPI DAC

The Microchip Technology Inc. MCP492X are 2.7 5.5V, low-power, low DNL, 12-Bit
Digital-to-Analog Converters (DACs) with optional 2x buffered output and SPI
interface.

The MCP492X are DACs that provide high accuracy and low noise performance for
industrial applications where calibration or compensation of signals (such as
temperature, pressure and humidity) are required. The MCP492X are available in the
extended temperature range and PDIP, SOIC, MSOP and TSSOP packages.

Features
12-Bit Resolution
0.2 LSB DNL (typ), 2 LSB INL (typ)
Single or Dual Channel
SPI Interface with 20 MHz Clock Support
Simultaneous Latching of the Dual DACs w/LDAC
Fast Settling Time of 4.5 s
Selectable Unity or 2x Gain Output
450 kHz Multiplier Mode
External VREF Input
Extended Temperature Range: -40C to +125C

C18
P2.[0..7]

0.1D

SW31

P2.5
P2.6
P2.7

1
2
3
4
5
6
7
8

VCC

16
15
14
13
12
11
10
9

1
DAC_CS 2
DAC_SCK 3
DAC_SDI 4
DAC_CS
DAC_SCK
DAC_SDI

VDD
/C/S
SCK
SDI

HEADER 2

VCC

U19
VOUTA
VREFA
AVSS
LDAC

MCP4291

8
6
7
5

1
2
C21
100nF

J11

SW DIP-8

66
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/*
Example
: SPI Based DAC
*/
/*--------------------------------------------------------------------------*/
/*
Filename
: DAC_SPI.c
Date:25/01/08
*/
/*--------------------------------------------------------------------------*/
/* Connections
[I2C/1-wire/DAC section]
*/
/* ----------*/
/*
SW31 :
P2.5 - DAC_CS
*/
/*
P2.6 - DAC_SCK
*/
/*
P2.7 - DAC_SDI
*/
/*
Output :
J11 - view results in oscilloscope or multi meter
*/
/*--------------------------------------------------------------------------*/
#include<reg51.h>
sbit CS =P2^5;
sbit SCK=P2^6;
sbit SDI=P2^7;

//chip select port pin P2.5


//SCK Port pin 2.6
//SDI port pin P2.7

void SPI_out(unsigned char);


unsigned char x=0x80,i;
//---------------------//
Main program Starts
//---------------------void main()
{
unsigned int Data=0x37FF;
unsigned char data1;
SCK = 0;
while(1)
{
CS=0;
data1=(Data>>8);
SPI_out(data1);
data1=Data;
SPI_out(data1);
CS=1;
}

//Assign Data Here e.g 0x33ff,


//0x37ff, 0x3fff
//sck pull to low
//loop forever
//make cs to low
//shift and send to spiout
//send high byte
//send low byte
//make cs to high

}
//
SPI Data out routine
//-----------------------void SPI_out(unsigned char Data_val)
{
for(i=0;i<8;i++)
{
SDI=(Data_val & x)?1:0;
SCK=1;
Data_val=Data_val<<1;
SCK=0;
}
}

//make sck high


//make sck low

67
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.15 - RS485

The Max485 is a differential line transceiver suitable for high speed bidirectional data
communication on multipoint bus transmission lines. It is designed for balanced data
transmission and complies with EIA Standards RS-485 and RS-422. The part contains
a differential line driver and a differential line receiver. Both the driver and the
receiver may be enabled independently.

Features

Meets EIA RS-485 Standard

5 Mbps Data Rate

Single 5 V Supply

7 V to +12 V Bus Common-Mode Range

High Speed, Low Power BiCMOS

Thermal Shutdown Protection

Short-Circuit Protection

Driver Propagation Delay: 10 ns

Receiver Propagation Delay: 15 ns

High Z Outputs with Power Off

SW30
1
2
3
4
5
6
7
8

P3.[0..7]
P3.0
P3.1
P3.2

16
15
14
13
12
11
10
9

RXD_485
TXD_485
RT_485

SW DIP-8
VCC
R64 4k7

TXD_485

RT_485

3
2

DI
DE
RE

J8
8

R32

VCC
GND

U13

A
B
RO

6
7
1

56E

R33 56E

2
1

RXD_485

HEADER 2
MAX485

R63 4k7

68
www.pantechsolutions.net

8051 Advanced Development Board User Manual

Application Schematic
VCC

C2

10uF

R2

11.0592MHz

20

XTAL2
XTAL1

C4
33PF

C3
X1
33PF

P2.7/A15
P2.6/A14
P2.5/A13
P2.4/A12
P2.3/A11
P2.2/A10
P2.1/A9
P2.0/A8

R64 4k7
U13

31
30
29
28
27
26
25
24
23
22
21

RXD_485

RT_485

2
3

TXD_485

GND

RST

18
19

8K2

EA/VPP
ALE/PROG
PSEN

VCC

VCC

P3.0/RXD
P3.1/TXD
P3.2/INTO
P3.3/INT1
P3.4/TO
P3.5/T1
P3.6/WR
P3.7/RD

RS485

39
38
37
36
35
34
33
32

RO
RE
DE

GND

RST

SW1

10
11
12
13
14
15
16
17

P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7

DI

A
B

R32

R33 56E

56E

MAX485

RXD_485
TXD_485
RT_485

VCC

P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7

C1

VCC

1
2
3
4
5
6
7
8

40

0.1uF
U1

R63 4k7

AT89S51

shielded pair

8051 Board1

VCC

1
C3
10uF

13
8

C+

R64 4k7
U13
TXD_232

RT_485

2
3

RXD_232

C2+

V-

C2-

RO
RE
DE
DI

A
B

56E

R32

R33 56E

MAX485
C5

R63 4k7
10uF

15

C1-

V+

16

R1IN
R2IN

14
7

MAX232
3

C4
10uF

R1OUT
R2OUT

T1OUT
T2OUT

VCC

12
9

T1IN
T2IN

RS485

VCC

RT_485
RXD_232

11
10

GND

TXD_232

VCC

U1

GND

5
9
4
8
3
7
2
6
1

SERIAL PORT

P1

10uF
C1

RS485-RS232 Adaptor

Exemple Code
\Examples Code\RS485\send\out\send.hex
\Examples Code\RS485\receive\out\receive.hex

69
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.16 - PS/2 Interface

User can connect PS/2 Devices like keyboard, mouse to the 8051 ADB board. PS/2s
DATA(P2.1) and CLK(P2.0) lines connected to MCUs Port Lines. for example
keyboard connected to the ADB board it act as a pc keyboard, pressed key code

P2.[0..7]

displayed in LCD or PCs Hyperterminal window.

J3
R27
P2.0
P2.1

270

JP11
1
3

2
4

1
2
3

VCC

5
6

270

HEADER 2X2
R28

1
2
3
5
6
8

70
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example :PC Keyboard Interface
*/
/*--------------------------------------------------------------------------*/
/* Filename :ps2.c
Date:10/01/08
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/* Note
:set HyperTerminal window @ 9600baud rate
*/
/*--------------------------------------------------------------------------*/
#include<reg51.h>
#include<stdio.h>
sbit PS2_CLK = P2^1;
sbit PS2_DATA =
P2^0;

//PS2 Clock
//PS2 Data

code unsigned char Key[]={"0F FFFFF FFFFt`


NBHGY6
MJU78 ,KIO09 ./L;P' [=\\"};
unsigned char KeyVal,KeyVal2,i=0;
void Serial_init();
unsigned char Scan_Data();
void putch(unsigned char);
void DelayMs(unsigned int);

as cQ1

ZSAW2

CXDE43

VFTR5

//serial initialization
//scan data

/***************************/
/*Main Program Starts Here
/***************************/
void main()
{
P2=0xff;
Serial_init();
//serial init
DelayMs(50);
while(1)
{
while(PS2_CLK==1);
KeyVal=Scan_Data();
if(KeyVal>85 || KeyVal<20 || KeyVal==0x0e)
//scan keypressed
{
if(KeyVal==0x0e)
printf("`");
if(KeyVal==0x5d || KeyVal==0x5b)
{
if(KeyVal==0x5b)printf("]");
if(KeyVal==0x5d)printf("\\");
}
}
else
putch(Key[KeyVal]);
//print scanned key to serial port
DelayMs(50);
P2=0xff;
}
}
71
www.pantechsolutions.net

8051 Advanced Development Board User Manual

//--------------------//
Scan keyboard
//--------------------unsigned char Scan_Data()
{
unsigned char Data=0,temp;
while(PS2_CLK==0);
for(i=0;i<10;i++)
{
while(PS2_CLK==1);
temp=PS2_DATA;
temp<<=i;
Data|=temp;
while(PS2_CLK==0);
}
DelayMs(50);
P2=0x00;
return(Data);
}
//----------------//
serial init
//----------------void Serial_init()
{
SCON = 0x52;
TMOD = 0x20;
TH1 = 0xFD;
TR1
= 1;
putch(0x0c);
putch('R');
}

// setup serial port control


// hardware (9600 BAUD @11.05592MHZ)
// TH1
// Timer 1 on

//
putchar
//----------------void putch(unsigned char dat)
{
while(TI==0);
SBUF=dat;
}
//
Delay Routine
//----------------void DelayMs(unsigned int del)
{
int j;
while(del>0)
{
del--;
for(j=0;j<306;j++);
}
}

72
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.17 - Ethernet
The ENC28J60 is a stand-alone Ethernet controller with an industry standard Serial
Peripheral Interface (SPI). It is designed to serve as an Ethernet network interface
for any controller equipped with SPI.

The ENC28J60 meets all of the IEEE 802.3 specifications. It incorporates a number of
packet filtering schemes to limit incoming packets. It also provides an internal DMA
module for fast data throughput and hardware assisted IP checksum calculations.
Communication with the host controller is implemented via two interrupt pins and the
SPI, with data rates of up to 10 Mb/s. Two dedicated pins are used for LED link and
network activity indication.

Ethernet Controller Features


IEEE 802.3 compatible Ethernet controller
Integrated MAC and 10BASE-T PHY
Receiver and collision squelch circuit
Supports one 10BASE-T port with automatic polarity detection and correction
Supports Full and Half-Duplex modes
Programmable automatic retransmit on collision
Programmable padding and CRC generation
Programmable automatic rejection of erroneous packets
SPI Interface with speeds up to 10 Mb/s

73
www.pantechsolutions.net

8051 Advanced Development Board User Manual

3.3V Unit
VCC

REG1117/SOT +3.3V

U21

D10

VIN

VOUT

2
330E

LED

C25
10UF

C24
0.1uF

GND

R47
3

ENC28J60 Section

R56 100E

MOSI
SCK

R58 100E

3
INT*_ETH
4
WOL*_ETH 5
MISO_ETH 6
7
8
CS
9
RST*
10
12
13

LEDA
CLKOUT
LEDB
/I/N/T
/WO/O/L
OSC2
SO
OSC1
SI
ENC28J60
SCK
VDD
/C/S
VDDOSC
RESET
VDDPLL
VDDRX
TPINVDDTX
TPIN+

+3.3V

+3.3V

+3.3V

R51
330E

R52
330E

24
23
28
25
20
19
15

C28 22pf
Y1
C29 22pf

+3.3V

+3.3V
TDTD+

+3.3V

A2

27
26

16
17

RDRD+

VCAP
RBIAS

D12
LED

A1

25MHz

1
14

R54 1K

VSS
VSSRX
VSSOSC
VSSPLL
VSSTX

R53 1K

U23

TPOUTTPOUT+

C27
10UF

2
11
22
21
18

D11
LED

C30
0.1uF

C31
0.1uF

C32
0.1uF

C33
0.1uF

C34
0.1uF

RST*
INT*
MISO

CN13
1
3
5
7
9

2
4
6
8
10

CS*
WOL*
MOSI
SCK

8051/AVR

74
www.pantechsolutions.net

8051 Advanced Development Board User Manual

RJ-45 connector with In-built transformer

VCC

1
3
5

2
3
4
5
6
7
8
9

2
4
6

HEADER 3X2

1
19

R57 10E CS

B0
B1
B2
B3
B4
B5
B6
B7

18
17
16
15
14
13
12
11

INT*_ETH
WOL*_ETH
MISO_ETH

DIR
G

10

CS*

A0
A1
A2
A3
A4
A5
A6
A7

GND

MISO

J12

INT*
WOL*
R55 100E

VCC

U22
C26
0.1uF

20

VCC

74LS245

A2

+3.3V

L1
F-BEAD

R60 56E

3
5
6

R61 56E

RD-

RD+
CT
RD-

GND

9
10

RD+

TD+
CT
TD- RJ45

A1
K1

1
4
2

K2
A2

U24
R59 56E

C35
0.1uF

A1

TD-

11
12

TD+

R62 56E

C36
0.1uF

75
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.18 - On-Board ADC (AT89C51CC03)

This sect ion describes the on-chip 10 bit analog- to-digital converter of the
AT89C51CC03. Eight ADC channels are available for sampling of the external sources
AN0 to AN7. An analog multiplexer allows the single ADC converter to select one from
the 8 ADC channels as ADC input voltage (ADCIN). ADCIN is converted by the 10-bit
cascaded potentiometric ADC

Features

Conversion time 16 micro-seconds (typ.)

Zero Error (offset) 2 LSB max

Positive External Reference Voltage Range (VREF) 2.4 to 3.0Volt (typ.)

ADCIN Range 0 to 3Volt

Integral non-linearity typical 1 LSB, max. 2 LSB

Differential non-linearity typical 0.5 LSB, max. 1 LSB

Conversion Complete Flag or Conversion Complete Interrupt

Selectable ADC Clock

R7
10K

1
2
3

ADC0

P1.1
P1.0

+3.3V

P1.1

10
9
8
7
6
5
4
3

JP3

R8
10K

JP4
2

1
2
3
ADC1

21
20

29
28
27
26
25
24
23
22

41

40

(RXD_CAN)P4.1
(TXD_CAN) P4.0

P1.0

(AD0)
(AD1)
(AD2)
(AD3)
(AD4)
(AD5)
(AD6)
(AD7)
P1.7/AN7/CEX4
P1.6/AN6/CEX3
P1.5/AN5/CEX2
P1.4/AN4/CEX1
P1.3/AN3/CEX0
P1.2/AN2
P1.1/AN1
P1.0/AN0

(A8)
(A9)
(A10)
(A11)
(A12)
(A13)
(A14)
(A15)

RESET

+3.3V

P0.0
P0.1
P0.2
P0.3
P0.4
P0.5
P0.6
P0.7

2
VAREF

VAGND

AT89C51CC0X

PSEN
(PROG) ALE
EA

XTAL2

44

(RXD)
(TXD)
(INT0)
(INT1)
(T0)
(T1)
(WR)
(RD)

P2.0
P2.1
P2.2
P2.3
P2.4
P2.5
P2.6
P2.7

38
39
11

P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7

XTAL1

12
13
14
15
16
17
18
19

GND

VCC

U2

30
31
32
33
34
35
36
37

10-bit cascaded potentiometric ADC

43

8 channels with multiplexed inputs

42

76
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*--------------------------------------------------------------------------*/
/* Example : Program to Read AD0 Value to display serial port
*/
/*--------------------------------------------------------------------------*/
/* Filename :adcmain.c
Date:10/01/08
*/
/*
*/
/* Company :PANTECH SOLUTIONS
*/
/*--------------------------------------------------------------------------*/
/*
ADC0 : P2.0, ADC1 : P2.1
*/
/*
*/
/* Output : Port0(P1) ...Hyperterminal, 1200baud rate
*/
/*--------------------------------------------------------------------------*/
#include <stdio.h>
sfr
sfr
sfr
sfr
sfr

ADCON
ADCF
ADCLK
ADDH
ADDL

sfr SCON
sfr TMOD
sfr TH1
sbit TR1
sbit TI

=
=
=
=
=

0xF3;
0xF6;
0xF2;
0xF5;
0xF4;

=
=
=
=
=

0x98;
0x89;
0x8D;
0x88^6;
0x98^1;

/*===========================================================================
This function initializes the serial port 1200 baudrate at 12Mhz clock.
============================================================================*/
void serial_init(void)
{
SCON = 0x50;
/* SCON: mode 1, 8-bit UART, enable rcvr
*/
TMOD |= 0x20;
/* TMOD: timer 1, mode 2, 8-bit reload
*/
TH1
= 0xfd;
/* TH1: reload value for 1200 baud @ 12MHz
*/
TR1
= 1;
/* TR1: timer 1 run
*/
TI
= 1;
/* TI:
set TI to send first char of UART
*/
}
/*===========================================================================
This function initializes the A/D Converter on the Atmel CC01 using 10-bits.
============================================================================*/
void init_ADC (void)
{
ADCF = 0xFF;
// Setup P1 as 8 ADC inputs
ADCLK = 0x1F;

// Set AD Clock divisor to 32 (the maximum)

ADCON |= 0x20; // Enable the A/D Converter


}

77
www.pantechsolutions.net

8051 Advanced Development Board User Manual

/*===========================================================================
This function sets the A/D channel to convert and starts a conversion.
The 10-bit value is returned.
============================================================================*/
unsigned read_ADC (unsigned char channel)
{
ADCON &= ~0x07;
// Clear channel bits
ADCON |= 0x07 & channel;
// Set channel to convert
ADCON |= 0x08;
// Start a Conversion
while( ADCON & 0x8 );
//Wait for conversion to end
return (((unsigned) ADDH << 2) | (ADDL & 3));
}
/*===========================================================================*
//Main Program Starts Here
/*===========================================================================*
void main(void)
{
unsigned char i;
serial_init();
//Initialize serial port
init_ADC ();
//Initialize the A/D Converter
/*--------------------------------------------------Loop thru each channel and output the converted value.
----------------------------------------------------*/
printf ("\n------------------------------------------------\n");
printf ("
AD89C51CC03 On-Chip ADC Demo AN0 and AN1
\n");
printf (" AN0 - Adjust R7 POT
|
AN1 - Adjust R8 POT \n");
printf ("------------------------------------------------\n");
while (1)
{
printf ("\r ADC0.0 : %u", read_ADC (0));
printf ("
ADC0.1 : %u", read_ADC (1));
}
}
Output

//read channel 0
//read channel 1

78
www.pantechsolutions.net

8051 Advanced Development Board User Manual

6.19 - CAN Microcontroller (AT89C51CC03)

The CAN Controller provides all the features required to implement the serial
communication protocol CAN as defined by BOSCH GmbH. The CAN specification as
referred to by ISO/11898 (2.0A and 2.0B) for high speed and ISO/11519-2 for low
speed. The CAN Controller is able to handle all types of frames (Data, Remote, Error
and Overload) and achieves a bit-rate of 1-Mbit/sec at 8 MHz1 Crystal frequency in
X2 mode.

CAN Transceiver

The MCP2551 is a high speed CAN fault tolerant device that serves as the interface
between a CAN protocol controller and the physical bus. The MCP2551 provides
differential transmit and receive capability for the CAN protocol controller and is fully
compatible with the ISO 11898 standard, including 24 V requirements. It will operate
at speeds of up to 1 Mb/s.

Features
Supports 1 Mb/s operation
Implements ISO 11898 standard physical layer requirements
Suitable for 12 V and 24 V systems
Externally controlled slope for reduced RFI emissions
Detection of ground fault (permanent dominant) on TXD input
Power-on reset and voltage brown-out protection
An un powered node or brown-out event will not disturb the CAN bus
Low current standby operation
Protection against damage due to short circuit conditions.
Protection against high voltage transients
Automatic thermal shutdown protection
Up to 112 nodes can be connected
High noise immunity due to differential bus implementation

79
www.pantechsolutions.net

8051 Advanced Development Board User Manual

10
9
8
7
6
5
4
3

VCC

P2.0
P2.1
P2.2
P2.3
P2.4
P2.5
P2.6
P2.7

(A8)
(A9)
(A10)
(A11)
(A12)
(A13)
(A14)
(A15)

(TXD_CAN) P4.0
(RXD_CAN)P4.1

20
21

R29
330E

CAN

R30
330E
VCC
D6
CRX

R31
50E
U14

1
4

TXD
RXD

COM2

D5
CTX

GND

30
31
32
33
34
35
36
37

P0.0
P0.1
P0.2
P0.3
P0.4
P0.5
P0.6
P0.7

VCC

P1.7/AN7/CEX4
P1.6/AN6/CEX3
P1.5/AN5/CEX2
P1.4/AN4/CEX1
P1.3/AN3/CEX0
P1.2/AN2
P1.1/AN1
P1.0/AN0

P2
5
9
4
8
3
7
2
6
1

RS

CANH
CANL
VREF

J9

8
7
6

2
1

5
HEADER 2

PCA82C250

29
28
27
26
25
24
23
22

XTAL1

RESET

40

(AD0)
(AD1)
(AD2)
(AD3)
(AD4)
(AD5)
(AD6)
(AD7)

AT89C51CC0X

PSEN
(PROG) ALE
EA

XTAL2

44

(RXD)
(TXD)
(INT0)
(INT1)
(T0)
(T1)
(WR)
(RD)

41

38
39
11

P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7

VAREF

GND

VCC
12
13
14
15
16
17
18
19

VAGND

43

42

U2

80
www.pantechsolutions.net

8051 Advanced Development Board User Manual

7. Board Layout

81
www.pantechsolutions.net

8051 Advanced Development Board User Manual

8. Easy Programming Steps - Philips/NXP Microcontrollers


Hardware Settings
SW4

P3.0
P3.1

M_RXD0
M_TXD0

SW32
OFF

ON

P1.7
P1.5
MC_RST
P1.6

SW DIP-4

SW DIP-10

Software Settings
1. open Flashmagic isp software

Step 0 : Go to Options Menu, then choose Advanced Options, Advanced


options windows appears.

Choose Hardware Config tab, Deselect Use DTR to Control RST


checkbox.

Step1 :

Select Com Port E.g COM1 or COM2

Set baud rate 9600

Select Device 89V51RD2


Interface None(ISP)

82
www.pantechsolutions.net

8051 Advanced Development Board User Manual

Step2 :
Check Erase all Flash

Step3 : Load or locate your Hex files


JNTU_Pantech\JNTU_Lab_Examples\EX1_LED\1_LED Blink\Out\LedBlink.hex

Step4 : select options you want like above figure, verify, erase, security bit.
Step 5: press Start button

Press Hardware RST Button SW5. Now it starts, Erasing, Program &
Verifying.

83
www.pantechsolutions.net

8051 Advanced Development Board User Manual

2 - Atmel Microcontrollers

Hardware Settings
SW32
P1.7
P1.5
MC_RST
P1.6
SW DIP-4

Software Settings

1. Options - Menu
Select Port
-LP1
Device Selection
AT89S51
Clock : 12MHz

2. File Menu Load Buffer

Load your hex file

\Examples Code\LED Blink\Out\LEDBlink.hex

84
www.pantechsolutions.net

8051 Advanced Development Board User Manual

3. Instructions Auto Program

In Lock Bit settings

Executions
Instructions Menu
Run Target Your program Now executes

Note : Options Menu


Initialize It comes to program mode

85
www.pantechsolutions.net

8051 Advanced Development Board User Manual

3 - Dallas Microcontrollers
Hardware Settings
SW4

M_RXD0
R2
M_TXD0
4K7

PSEN
MC_RST

VCC

VCC

EA

VCC
P3.0
P3.1

R3
4K7

R4
330E

LED
D4

SW DIP-10

Select Dallas mcu DS89C450

1. Options Menu
Select com port and set baud rate to 9600

86
www.pantechsolutions.net

8051 Advanced Development Board User Manual

2. Target Menu
1. Open Com1at 9600
2. Connect to Loader
We get window like this

3. File Load Flash


\Examples Code\LED Blink\Out\LEDBlink.hex

Execution Mode
Set DIPSWITCH SW4 EXE Mode

87
www.pantechsolutions.net

8051 Advanced Development Board User Manual

ATNEL CAN Microcontroller

Hardware Settings
VCC
P3.0
P3.1

M_RXD0
R2
M_TXD0
4K7

EA

SW4

R3
4K7

VCC

R4
330E

PSEN
LED
D4

VCC
SW DIP-10

Software Settings

Device Menu

Settings menu
Communication RS232
Serial Port COM & Baud rate 38400

88
www.pantechsolutions.net

8051 Advanced Development Board User Manual

Press Reset key from Hardware ADB Board

Press connect button

File menu
Load Hex files
\Examples Code\AT89C51CC03 Examples\UART\OUT\UART.hex

Press RUN Button

Execution mode

Uncheck BLJB check box

Check Reset check box

Press Start Application

89
www.pantechsolutions.net

8051 Advanced Development Board User Manual