Вы находитесь на странице: 1из 25

AMATEUR WORLD

AW51V2,

8051 Development Board

AMATEUR WORLD AW51V2, 8051 Development Board All Amateur World‟s development boards represents irreplaceable tools

All Amateur World‟s development boards represents irreplaceable tools for programming and developing micro-controller based devices. Carefully chosen components and best possible production & testing workmanship thereof are the best guarantee of high readability of our products. Due to simple possible design, a large number of add-on modules and extensive ready to use examples, our all users, regardless of there experience, have the possibility to develop their projects in fast and efficient way. More over, all of our products are designed as per our philosophy “Learn with Fun”.

are designed as per our philosophy “Learn with Fun” . AMATEUR WORLD Flat No.3, 1/6 Gandhi

AMATEUR WORLD

Flat No.3, 1/6 Gandhi Colony,

Regent Park, Tollygunge,

Kolkata - 700040 West Bengal, India

Phone: +91-033-24997074 Fax: +91-033-24997074 E-mail: sales@amateurworld.in Web: www.amateurworld.in

www.amateurworld.in TABLE OF CONTENTS Details : Page No : 1. Introduction of AW51V2, 8051 Development

www.amateurworld.in

TABLE OF CONTENTS

Details :

Page No:

1. Introduction of AW51V2, 8051 Development Board

2

2. Key Features

3

3. Complete Schematic of the Board

4

4. Power Supply

5

5. Connecting the system to your PC

6

6. Configuring Flash Magic

7-8

7. Programming Software

9

8. Experiments -

Fun With LEDs.

10

Make Some Noise with Buzzer.

11

Display Something On LCD.

12-13

Working with Matrix Switches.

14-16

Seven Segment Display for Simple Count Up.

17-18

Expand Your World with „I2C‟ I/O Expander.

19

Make a simple Watch with DS1307, „RTC‟ Chip.

20-21

Advanced ADC (PCF7495), Control it with Only Two Wire !!

22-24

Generate Analog Voltage with the Same PCF7495

25

Copy Book R-R Ladder, the simplest DAC

26

Control An DC Motor

27

PAGE1

DAC 26  Control An DC Motor 27 PAGE — 1 AMATEUR WORLD Flat No.3, 1/6

AMATEUR WORLD

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

www.amateurworld.in

sales@amateurworld.in

www.amateurworld.in INTRPDUCTION TO AW51V2, 8051 DEVELOPMENT BOARD “AW51V2”, 8051 Development Board is fully

www.amateurworld.in

INTRPDUCTION TO AW51V2, 8051 DEVELOPMENT BOARD “AW51V2”, 8051 Development Board is fully contained board, suitable
INTRPDUCTION TO AW51V2, 8051 DEVELOPMENT BOARD
“AW51V2”, 8051 Development Board is fully contained board, suitable for programming 8051 controllers from Philips as wel
as for designing and testing of 8051 projects. This development board includes an on-board programmer providing an inter-
face between the micro-controller and PC. You are simply expected to write your program in any one of 8051 compiler, gen-
erate a “*.hex” file and program your micro-controller using the on-board programmer. The “AW51V2” contains many de-
vices like 16X2 LCD, Seven Segment Display, LED, 4X4 Matrix Keyboard, I2C I/O Expander, RTC, ADC, DAC, Relay, Stepper
Motor etc. that conveniently interface with the micro-controller and allow you to easily simulate the operation of the target
device.
Package Contains:
 AW51V2, 8051 Development Board
 RS232 Serial Cable for Programming and Interfacing with PC
 Product CD with Programming Software and Examples and Experiments
 Product Manuals and Schematic Diagram of the Board.
System Specification:
 Power Supply: 8 to 18V DC or AC
 Power Consumption: Maximum 350mA
 Weight: Maximum 700gm Inclusive of All
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—2
www.amateurworld.in KEY FEATURS 1. Power Supply: DC/AC 12V 12. PCF8594, I2C based A to D

www.amateurworld.in

KEY FEATURS 1. Power Supply: DC/AC 12V 12. PCF8594, I2C based A to D and
KEY FEATURS
1. Power Supply: DC/AC 12V
12. PCF8594, I2C based A to D and D to A.
2. Easy RS232 Connector for Programming as wel as PC
Connectivity.
13. Four Presets for Onboard Experiment of A to D.
14. AT24C08, I2C based EEPROM.
3. Two Digit Seven Segment Display. Common Anode
4. Eight User LEDs.
15. DS10307, I2C based RTC with battery backup cir-
cuit.
5. 16X2 LCD
6. Stepper Motor Driver with ULN2003
16. PCF8574, I2C based I/O Expender with Four
Switches and Four LEDs for Experiments.
7. User Relay for High Load Driving.
17. 4X4 Matrix Keyboard.
8. Basic R to R Ladder based Digital to Analog Converter.
18. RESET Switch.
9. Buzzer or Speaker.
19. P89V51RD2, Main 8051 Controller.
10. One Digital to Analog Output.
20. External Interrupt Switches, INT0 & INT1
11. Four Channel Analog to Digital External Input.
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—3
www.amateurworld.in COMPLETE SCHEMATIC OF THE BOARD AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6 Gandhi Colony,

www.amateurworld.in

COMPLETE SCHEMATIC OF THE BOARD AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6 Gandhi Colony, Regent Park,
COMPLETE SCHEMATIC OF THE BOARD
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—4
www.amateurworld.in PAGE — 5 POWER SUPPLY AMATEUR WORLD Flat No.3, 1/6 Gandhi Colony, Regent Park,

www.amateurworld.in

PAGE5

www.amateurworld.in PAGE — 5 POWER SUPPLY AMATEUR WORLD Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,

POWER SUPPLY

www.amateurworld.in PAGE — 5 POWER SUPPLY AMATEUR WORLD Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,

AMATEUR WORLD

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

www.amateurworld.in

sales@amateurworld.in

www.amateurworld.in Connecting the system to your PC AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6 Gandhi Colony,

www.amateurworld.in

Connecting the system to your PC AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6 Gandhi Colony, Regent
Connecting the system to your PC
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—7
www.amateurworld.in Configuring Flash Magic, 1.Connect serial port to your PC. 2.12 volt DC or AC

www.amateurworld.in

Configuring Flash Magic,

1.Connect serial port to your PC.

2.12 volt DC or AC power supply connect.

3.Press power supply switch.

4.Install Flash Magic6_30.

Flash Magic6_30 installing Screenshot

1.Double click on Flash Magic6_30 setup.

Screenshot 1.Double click on Flash Magic6_30 setup . 2.Click Next. 7. Click install. PAGE — 6

2.Click Next.

1.Double click on Flash Magic6_30 setup . 2.Click Next. 7. Click install. PAGE — 6 3.ClickI

7. Click install.

on Flash Magic6_30 setup . 2.Click Next. 7. Click install. PAGE — 6 3.ClickI accept the

PAGE6

3.ClickI accept the agreement then click Next.

6.Click create a desktop icon then click Next.

click Next. 6.Click create a desktop icon then click Next. 4.Click Next. 5.Click Next. AMATEUR WORLD
click Next. 6.Click create a desktop icon then click Next. 4.Click Next. 5.Click Next. AMATEUR WORLD

4.Click Next.

5.Click Next.

AMATEUR WORLD

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

www.amateurworld.in

sales@amateurworld.in

www.amateurworld.in Configuring Flash Magic 1.Double click on Flash Magic icon. 2.First click to option button
www.amateurworld.in
Configuring Flash Magic
1.Double click on Flash Magic icon.
2.First click to option button then click to
advanced options and then click to Hardware
config and disable use DTR to Control RST.
7. after finish programme upload press RESET switch
again.
3. First select device.
6.Click to start button then press RESET switch
( page 3: 18 no point )
4.Select COM PORT, Baud Rate, Interface, and Erase
blocks used by Hex file.
5.Click to Browse button for Hex file selection.
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—8
www.amateurworld.in Programming Software Configuring Programming Software 1.Double click on BASCOM-8051 icon. 2.Click

www.amateurworld.in

Programming Software Configuring Programming Software 1.Double click on BASCOM-8051 icon. 2.Click File open .BAS
Programming Software
Configuring Programming Software
1.Double click on BASCOM-8051 icon.
2.Click File
open
.BAS File.
3.program
compile (F7)
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—9
www.amateurworld.in EXPERIMENT NO: 1 EXPERIMENT NAME:LEDS_ON-OFF STEP 1:OPEN BASCOM SOFTWARE. STEP 2:OPEN LEDS_ON-OFF.BAS

www.amateurworld.in

EXPERIMENT NO: 1 EXPERIMENT NAME:LEDS_ON-OFF

EXPERIMENT NO: 1 EXPERIMENT NAME:LEDS_ON-OFF STEP 1:OPEN BASCOM SOFTWARE. STEP 2:OPEN LEDS_ON-OFF.BAS

STEP 1:OPEN BASCOM SOFTWARE. STEP 2:OPEN LEDS_ON-OFF.BAS FILE. STEP 3:COMPILIE THIS PROGRAM. STEP 4:OPEN FLASH MAGIC SOFTWARE. STEP 5:SELECT DEVICE, BAUD RATE, INTERFACE.(SEE PAGE-7) STEP 6:BROWSE HEX FILE. STEP 7:CLICK START BUTTON. STEP 8: CLICK RESTART BUTTON. STEP 9:FINISHED PROGRAM UPLOAD. STEP 10:CLICK RESTART BUTTON.

9:FINISHED PROGRAM UPLOAD. STEP 10:CLICK RESTART BUTTON. PAGE — 10 AMATEUR WORLD Flat No.3, 1/6 Gandhi

PAGE10

AMATEUR WORLD

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

www.amateurworld.in

sales@amateurworld.in

www.amateurworld.in   EXPERIMENT NO: 2 EXPERIMENT NAME:BUZZER AND ONE LED   $regfile = 89c51rd.dat $crystal

www.amateurworld.in

 

EXPERIMENT NO: 2 EXPERIMENT NAME:BUZZER AND ONE LED

 

$regfile = 89c51rd.dat $crystal = 11059200 $baud = 9600

'Define Compiler’s Derivative for P89V51RD2 IC 'crystal value 'baud rate

‘************************************************************

Buzzer Alias P0.5 Led_driver Alias P1.4 Set Led_driver P0 = 0

'pin name denote 'pin name denote 'set led_driver to enable all LEDs & Buzzer 'Clear All Pins of Port0

‘************************************************************

Main:

'Main function 'wait 1 sec 'sound( pin no, duration, frequency) 'jump to main

Wait 1 Sound P0.5 , 2000 , 40000 Goto Main

‘************************************************************

End

'end program

End 'end program PAGE — 11   AMATEUR WORLD www.amateurworld.in
End 'end program PAGE — 11   AMATEUR WORLD www.amateurworld.in
End 'end program PAGE — 11   AMATEUR WORLD www.amateurworld.in

PAGE11

PAGE — 11
 

AMATEUR WORLD

www.amateurworld.in

sales@amateurworld.in

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

 
www.amateurworld.in     EXPERIMENT NO: 3 EXPERIMENT NAME:LCD DISPLAY.   $regfile = 89c51rd.dat

www.amateurworld.in

 
 
 

EXPERIMENT NO: 3 EXPERIMENT NAME:LCD DISPLAY.

 

$regfile = 89c51rd.dat $crystal = 11059200 $baud = 9600 P0 = 0

'Define Compiler’s Derivative for P89V51RD2 IC 'crystal value 'baud rate 'port0 reset

'**************************************************************************

 

Config Lcdpin = Pin , Db4 = P0.4 , Db5 = P0.5 , Db6 = P0.6 , Db7 = P0.7 , E = P3.6 , Rs = P3.7

Config Lcd = 16 * 2 Cursor Off

'configuration LCD screen

'*************************************************************************

Cls Lcd " AMATEUR WORLD" Wait 2 Cursor On Wait 2 Cursor blink Wait 2 Dim gp as byte For gp= 1 to 16 Shift lcd, left Waitms 500 Next gp

'clear the LCD display 'display this ‘wait for 2 seconds ‘display cursor ‘wait for 2 seconds ‘make cursor blink

‘dimension a variable named gp as byte ‘for loop ‘display will shift one digit left ‘wait for 500 mili-seconds ‘continue loop until ‘gp’ reached last value, i.e. ‘gp’=16

 

For gp = 1 to 16 Shift lcd, right Waitms 500 Next gp

‘again for loop ‘display will shift one digit right ‘wait for 500 mili-seconds ‘continue loop until ‘gp’ reached last value, i.e. ‘gp’=16

End

‘end program or loop here for forever

‘gp’=16 End ‘end program or loop here for forever PAGE — 12     AMATEUR WORLD
‘gp’=16 End ‘end program or loop here for forever PAGE — 12     AMATEUR WORLD

PAGE12

   

AMATEUR WORLD

www.amateurworld.in

 

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

sales@amateurworld.in

www.amateurworld.in AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,

www.amateurworld.in

AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata—700040, West Bengal,
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—13
www.amateurworld.in EXPERIMENT NO: 4 EXPERIMENT NAME: MATRIX SWITCH AND SWITCH NO. DISPLAY ON LCD. $regfile

www.amateurworld.in

EXPERIMENT NO: 4 EXPERIMENT NAME: MATRIX SWITCH AND SWITCH NO. DISPLAY ON LCD. $regfile =
EXPERIMENT NO: 4
EXPERIMENT NAME: MATRIX SWITCH AND SWITCH NO. DISPLAY ON LCD.
$regfile = 89c51rd.dat
$crystal = 11059200
$baud = 9600
$large
Buzzer Alias P0.5
Led_driver Alias P1.4
Fnd_1 Alias P1.3
Fnd_2 Alias P1.2
P0 = 0
Reset Led_driver
'Define Compiler’s Derivative for P89V51RD2 IC
'-----------------------------------------------------------------
Config Lcdpin = Pin , Db4 = P0.4 , Db5 = P0.5 , Db6 = P0.6 , Db7 = P0.7 , E = P3.6 , Rs = P3.7
Config Lcd = 16 * 2
Cursor Off
'*************************************************************************
Home
Lcd " AMATEUR WORLD"
'display AMATEUR WORLD
Reset Fnd_1
Reset Fnd_2
'************************************************************
Dim Key As Byte , Key_flg As Bit
Col0 Alias P2.4
Col1 Alias P2.5
Col2 Alias P2.6
Row0 Alias P2.0
Row1 Alias P2.1
Row2 Alias P2.2
Row3 Alias P2.3
'*****************************************************************
Gosub Intialize_key
'Branch to and execute subroutine.
Reset Key_flg
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—14
www.amateurworld.in PAGE — 15 Scan_key: Reset Row0 Reset Row1 Reset Row2 Reset Row3 If Col0

www.amateurworld.in

PAGE15

Scan_key:

Reset Row0 Reset Row1 Reset Row2 Reset Row3 If Col0 = 0 Then : Goto Col0_test : End If

Back1:

If Col1 = 0 Then : Goto Col1_test : End If

Back2:

If Col2 = 0 Then : Goto Col2_test : End If

Back3:

If Key = 255 Then : Gosub Scan_key : End If If Key_flg = 0 Then : Goto Scan_key : End If Locate 2 , 1 Lcd "MATRIX KEY:"

Locate 2 , 12 "

Lcd " Locate 2 , 12 Lcd Key Key_flg = 0 'Waitms 20 Goto Scan_key

'2nd row and 1st column 'display MATRIX KEY:

'2nd row and 12th column

'goto scan_key function

Col0_test:

Waitms 20 If Col0 = 0 Then Key_flg = 1 Set Row0 Set Row1 Set Row2 Set Row3 Reset Col0 If Row0 = 0 Then Key = 3 Elseif Row1 = 0 Then Key = 6 Elseif Row2 = 0 Then Key = 9 Elseif Row3 = 0 Then Key = 12 Else Key = 255 Key_flg = 0 End If End If Gosub Intialize_key Goto Back1 Key = 9

Elseif Row3 = 0 Then Key = 12 Else Key = 255 Key_flg = 0 End If End If Gosub Intialize_key Goto Back1

Col1_test:

'if Row0=0 and col0=0 then then key 3 show

'if Row1=0 and col0=0 then then key 6 show

'if Row2=0 and col0=0 then then key 9 show

'if Row3=0 and col0=0 then then key 12 show

'jump to subroutine

'if Row3=0 and col0=0 then then key 12 show

'jump to subroutine

AMATEUR WORLD

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

www.amateurworld.in

sales@amateurworld.in

www.amateurworld.in Else Key = 255 Key_flg = 0 End If End If Gosub Intialize_key Goto

www.amateurworld.in

Else Key = 255 Key_flg = 0 End If End If Gosub Intialize_key Goto Back2
Else
Key = 255
Key_flg = 0
End If
End If
Gosub Intialize_key
Goto Back2
Col2_test:
Waitms 20
If Col2 = 0 Then
Key_flg = 1
Set Row0
Set Row1
Set Row2
Set Row3
Reset Col2
If Row0 = 0 Then
Key = 1
Elseif Row1 = 0 Then
Key = 4
Elseif Row2 = 0 Then
Key = 7
Elseif Row3 = 0 Then
Key = 10
If Col2 = 0 Then
Key_flg = 1
Set Row0
Set Row1
Set Row2
Set Row3
Reset Col2
If Row0 = 0 Then
Key = 1
Elseif Row1 = 0 Then
Key = 4
Elseif Row2 = 0 Then
Key = 7
Elseif Row3 = 0 Then
Key = 10
'if Row0=0 and col2=0 then then key 1 show
'if Row1=0 and col2=0 then then key 4 show
'if Row2=0 and col2=0 then then key 7 show
'if Row3=0 and col2=0 then then key 10 show
'if Row0=0 and col2=0 then then key 1 show
'if Row1=0 and col2=0 then then key 4 show
'if Row2=0 and col2=0 then then key 7 show
'if Row3=0 and col2=0 then then key 10 show
Else
Key = 255
Key_flg = 0
End If
End If
Gosub Intialize_key
Goto Back3
Intialize_key:
Set Row0
Set Row1
Set Row2
Set Row3
Set Col0
Set Col1
Set Col2
Return
'Return
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—16
www.amateurworld.in EXPERIMENT NO: 5 EXPERIMENT NAME: FND COUNTUP. $regfile = 89c51rd.dat '8052.dat $crystal =

www.amateurworld.in

EXPERIMENT NO: 5 EXPERIMENT NAME: FND COUNTUP. $regfile = 89c51rd.dat '8052.dat $crystal = 11059200 $baud
EXPERIMENT NO: 5
EXPERIMENT NAME: FND COUNTUP.
$regfile = 89c51rd.dat
'8052.dat
$crystal = 11059200
$baud = 9600
$large
Buzzer Alias P0.5
Led_driver Alias P1.4
Fnd_1 Alias P1.2
Fnd_2 Alias P1.3
Set Led_driver
Reset Fnd_1
Reset Fnd_2
'****************************************
Config Timer0 = Timer , Mode = 2 , Gate = Internal
On Timer0 Timer0_isr
Load Timer0 , 200
Enable Timer0
Enable Interrupts
Start Timer0
'****************************************
Dim Disp1 As Byte , Disp2 As Byte
Disp1 = 0 : Disp2 = 0
'****************************************
P0 = &H00
Reset Led_driver
Main:
Waitms 500
Incr Disp1
If Disp1 > 9 Then
Disp1 = 0
Incr Disp2
If Disp2 > 9 Then
Disp2 = 0
End If
End If
Goto Main
'****************************************
Timer0_isr:
Dim Sel As Bit
Sel = Not Sel
If Sel = 1 Then
P0 = Lookup(disp1 , Data1)
Reset Fnd_1
Set Fnd_2
Else
P0 = Lookup(disp2 , Data1)
Reset Fnd_2
Set Fnd_1
End If
Return
'****************************************
Data1:
Data &B00111111 , &B00000110 , &B01011011 , &B01001111 , &B01100110 ,
Data &B01101101 , &B01111101 , &B00000111 , &B01111111 , &B01101111
End
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—17
www.amateurworld.in Q1 Q1 1k BC557 BC557 1k PAGE — 18 AMATEUR WORLD Flat No.3, 1/6

www.amateurworld.in

www.amateurworld.in Q1 Q1 1k BC557 BC557 1k PAGE — 18 AMATEUR WORLD Flat No.3, 1/6 Gandhi
www.amateurworld.in Q1 Q1 1k BC557 BC557 1k PAGE — 18 AMATEUR WORLD Flat No.3, 1/6 Gandhi
www.amateurworld.in Q1 Q1 1k BC557 BC557 1k PAGE — 18 AMATEUR WORLD Flat No.3, 1/6 Gandhi
Q1 Q1 1k BC557 BC557 1k
Q1
Q1
1k
BC557
BC557
1k

PAGE18

AMATEUR WORLD

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

www.amateurworld.in

sales@amateurworld.in

www.amateurworld.in EXPERIMENT NO: 6 EXPERIMENT NAME: I2C I/O Expander PROGRAMMING. $regfile = 89c51rd.dat $crystal =

www.amateurworld.in

EXPERIMENT NO: 6 EXPERIMENT NAME: I2C I/O Expander PROGRAMMING. $regfile = 89c51rd.dat $crystal = 11059200
EXPERIMENT NO: 6
EXPERIMENT NAME: I2C I/O Expander PROGRAMMING.
$regfile = 89c51rd.dat
$crystal = 11059200
$baud = 9600
$large
Buzzer Alias P0.5
Led_driver Alias P1.4
P0 = 0
'Define Compiler’s Derivative for P89V51RD2 IC
Reset Led_driver
'***************************************************************
Config Lcdpin = Pin , Db4 = P0.4 , Db5 = P0.5 , Db6 = P0.6 , Db7 = P0.7 , E = P3.6 , Rs = P3.7
Config Lcd = 16 * 2
Cursor Off
'***************************************************************
Cls
Home
Lcd " AMATEUR WORLD"
'***************************************************************
Config Sda = P1.0
Config Scl = P1.1
'RTC
Config I2cdelay = 1
'***************************************************************
Lcd "
Locate 2 , 1
Lcd "Input " ; B1
Waitms 100
Loop
Dim B1 As Byte
Do
I2csend &H70 , &B11111111
I2creceive &H70 , B1
Locate 2 , 1
"
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—19
www.amateurworld.in EXPERIMENT NO: 7 EXPERIMENT NAME: REAL TIME C LOCK (RTC) PROGRAMMING $regfile = 89c51rd.dat

www.amateurworld.in

EXPERIMENT NO: 7 EXPERIMENT NAME: REAL TIME C LOCK (RTC) PROGRAMMING $regfile = 89c51rd.dat $crystal
EXPERIMENT NO: 7
EXPERIMENT NAME: REAL TIME C LOCK (RTC) PROGRAMMING
$regfile = 89c51rd.dat
$crystal = 11059200
$baud = 9600
$large
Buzzer Alias P0.5
Led_driver Alias P1.4
Fnd_1 Alias P1.3
Fnd_2 Alias P1.2
P0 = 0
Reset Led_driver
Set Fnd_1
Set Fnd_2
'Define Compiler’s Derivative for P89V51RD2 IC
'-----------------------------------------------------------------
Config Lcdpin = Pin , Db4 = P0.4 , Db5 = P0.5 , Db6
P0.6 , Db7 = P0.7 , E = P3.6 , Rs = P3.7
Config Lcd = 16 * 2
Cursor Off
=
'*************************************************************************
Home
Lcd " AMATEUR WORLD"
'*************************************************************************
Config Sda = P1.0
Config Scl = P1.1
Config I2cdelay = 1
'RTC
'-------------------------------------------------------------------------
Declare Sub Settime(s As Byte , M As Byte , H As Byte , Day As Byte , Date As Byte , Month As Byte , Year As Byte) Nosave
Declare Sub Gettime
Dim S As Byte , M As Byte , H As Byte , Day As Byte , Date As Byte , Month As Byte
Dim Wm As Byte , Yd As Byte , Year As Byte
'*********************************************************
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—20
www.amateurworld.in   Call Settime(12 , 0 , 0 , 1 , 1 , 1 ,

www.amateurworld.in

 

Call Settime(12 , 0 , 0 , 1 , 1 , 1 , 12) Wait 2 Main:

 

Call Gettime

Cls

Lcd "

" ; Bcd(date) ; "/" ; Bcd(month) ; "/" ; Bcd(year)

 

Lowerline

Lcd "

" ; Bcd(h) ; ":" ; Bcd(m) ; ":" ; Bcd(s)

 

Waitms 250 Goto Main '************************************************************************ Sub Settime(s As Byte , M As Byte , H As Byte , Day As Byte , Date As Byte , Month As Byte , Year As Byte) S = Makebcd(s) : M = Makebcd(m) : H = Makebcd(h) : Day = Makebcd(day) Date = Makebcd(date) : Month = Makebcd(month) : Year = Makebcd(year)

I2cstart

'generate start 'write mode 'select seconds Register 'write seconds 'write minuts 'write hours 'write days 'write date 'write months 'write year

I2cwbyte &HD0

I2cwbyte 0

I2cwbyte S

I2cwbyte M

I2cwbyte H

I2cwbyte Day

I2cwbyte Date

I2cwbyte Month

I2cwbyte Year

I2cstop

Waitms 10

End Sub

'*********************************************************************** Sub Gettime Dim Dum As Byte

 

I2cstart

'generate start 'write addres of PCF8583 'select second register 'generate repeated start 'write address for reading info 'read seconds 'read minuts 'read hours 'read days 'read year and dates

I2cwbyte &HD0

I2cwbyte 0

I2cstart

I2cwbyte &HD1 I2crbyte S , Ack I2crbyte M , Ack I2crbyte H , Ack I2crbyte Day , Ack I2crbyte Date , Ack

I2crbyte Month , Ack I2crbyte Year , Nack

'read weekday and month 'generate stop

I2cstop

End Sub

End

End
End
End

PAGE21

 

AMATEUR WORLD

www.amateurworld.in

 

Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge, Kolkata700040, West Bengal, India

sales@amateurworld.in

 
www.amateurworld.in EXPERIMENT NO: 8 EXPERIMENT NAME: ADC & DAC $regfile = 89c51rd.dat $crystal = 11059200

www.amateurworld.in

EXPERIMENT NO: 8 EXPERIMENT NAME: ADC & DAC $regfile = 89c51rd.dat $crystal = 11059200 $baud
EXPERIMENT NO: 8
EXPERIMENT NAME: ADC & DAC
$regfile = 89c51rd.dat
$crystal = 11059200
$baud = 9600
$large
Buzzer Alias P0.5
Led_driver Alias P1.4
Fnd_1 Alias P1.3
Fnd_2 Alias P1.2
P0 = 0
Reset Led_driver
Set Fnd_1
Set Fnd_2
'Define Compiler’s Derivative for P89V51RD2 IC
'*************************************************************************
Config Lcdpin = Pin , Db4 = P0.4 , Db5 = P0.5 , Db6 = P0.6 , Db7 = P0.7 , E = P3.6 , Rs = P3.7
Config Lcd = 16 * 2
Cursor Off
'*************************************************************************
Home
Lcd " AMATEUR WORLD"
'*************************************************************************
Config Sda = P1.0
Config Scl = P1.1
Config I2cdelay = 1
'*************************************************************************
Dim B1 As Byte , B2 As Byte , B3 As Byte , B4 As Byte , D1 As Byte
Wait 2
Cls
D1 = 128
I2cstart
I2cwbyte &H90
I2cwbyte &B01000000
I2cwbyte D1
I2cstop
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—22
www.amateurworld.in EXPERIMENT NO: 8 EXPERIMENT NAME: ADC & DAC I2cwbyte &B01000000 I2cwbyte D1 I2cstop

www.amateurworld.in

EXPERIMENT NO: 8 EXPERIMENT NAME: ADC & DAC I2cwbyte &B01000000 I2cwbyte D1 I2cstop 'I2csend &H90
EXPERIMENT NO: 8
EXPERIMENT NAME: ADC & DAC
I2cwbyte &B01000000
I2cwbyte D1
I2cstop
'I2csend &H90 , &B01000000
'I2csend &H90 , D1
Lcd "An Output: " ; D1
Wait 2
Cls
Do
I2csend &H90 , &B01000000
I2creceive &H91 , B1
Locate 1 , 1
Lcd "Ch1: "
Locate 1 , 6
"
'analog output
'chanel1 analog input
Lcd "
Locate 1 , 6
Lcd B1
I2csend &H90 , &B01000001
I2creceive &H91 , B2
Locate 1 , 9
Lcd "Ch2: "
Locate 1 , 14
"
'chanel2 analog input
Lcd "
Locate 1 , 14
Lcd "
Locate 2 , 6
Lcd B3
Lcd B2
I2csend &H90 , &B01000010
I2creceive &H91 , B3
Locate 2 , 1
Lcd "Ch3: "
Locate 2 , 6
"
'chanel3 analog input
Lcd "
Locate 2 , 14
Lcd B4
Waitms 100
Loop
I2csend &H90 , &B01000011
I2creceive &H91 , B4
I2csend &H90 , &B01000011
I2creceive &H91 , B4
Locate 2 , 9
Lcd "Ch4: "
Locate 2 , 14
"
'chanel4 analog input
'chanel4 analog input
Lcd "
Locate 2 , 14
Lcd B4
Waitms 100
Loop
Locate 2 , 9
Lcd "Ch4: "
Locate 2 , 14
"
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—23
www.amateurworld.in EXPERIMENT NO: 8 EXPERIMENT NAME: ADC & DAC AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6

www.amateurworld.in

EXPERIMENT NO: 8 EXPERIMENT NAME: ADC & DAC AMATEUR WORLD www.amateurworld.in Flat No.3, 1/6 Gandhi
EXPERIMENT NO: 8
EXPERIMENT NAME: ADC & DAC
AMATEUR WORLD
www.amateurworld.in
Flat No.3, 1/6 Gandhi Colony, Regent Park, Tollygunge,
Kolkata—700040, West Bengal, India
sales@amateurworld.in
PAGE—24