100% found this document useful (1 vote)
159 views31 pages

Northern India Engineering College

ASDF ASDF SADF SADF SADF SADF SAFD SAF ASDF ASWER WQER WQER WQER QWRQWE RWE WQER WER WQER QWER WER QWER

Uploaded by

Raman Kapoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
159 views31 pages

Northern India Engineering College

ASDF ASDF SADF SADF SADF SADF SAFD SAF ASDF ASWER WQER WQER WQER QWRQWE RWE WQER WER WQER QWER WER QWER

Uploaded by

Raman Kapoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 31

NORTHERN INDIA ENGINEERING COLLEGE

1. INTRODUCTION
The present life system of human beings is becoming fast and accurate. Society, now a
days is moving at blazing speeds. To cope up with the twenty-first century i.e. with the
speeds and accuracy, people seem to take the path of the electronic automation. From
adding two numbers to solving complex calculations, from opening a door to launching a
rocket, everywhere you find the dominance of electronic controllers. With the increase in
the positivism the balance has to maintain. Natural as well as human abnormalities
leading to a disaster can be stopped or at least taken care of before there is much damage.
This project is aimed to fulfill, not fully though, the requirements of a user.
This project is a fine combination of analog and digital electronics. The project consists
of a person counter unit and an automated opening/closing of power supply through a
relay.
As a part of our fourth year circular activity we are making the project whose title is
Automatic room light controller with Person Counter. We have used Microcontroller as
a main component of the project. Now a Microcontroller has become a main component
of many of the electronic circuits. Also Liquid Crystal Display (LCD) is used on major
basis for the display purpose.
As a part of an educational activity, we are going to make system as a third year project
which will consist of two basis modules.
This module can be implemented in the conference halls also for home, colleges.
A display unit will show the actual number of persons inside the room or conference
halls. This will help for the outside to know how many people s the room for this purpose
we are going to use sensors which are to be placed on the door frame.

NORTHERN INDIA ENGINEERING COLLEGE

1.1 Literature Survey


In this competitive world and busy schedule human cannot spare time to perform his daily
activities manually. The most common thing that he forgets to do is switching OFF the lights
wherever they are not required. This project is a standalone automatic room light controller
with auto door opening and closing. The main aim of the project is to control the lighting in a
room depending upon lighting that is present in the room. Use of embedded technology
makes this closed loop feedback control system efficient and reliable. Micro controller
(AT89s51) allows dynamic and faster control. Liquid crystal display (LCD) makes the system
user-friendly. AT89s51 micro controller is the heart of the circuit as it controls all the
functions.
The system comprises of two IR Transmitter-Receiver pairs, one of which is located in front
of the door outside the room. The other pair is located inside the room.
IR is placed inside the room near to the light and is used to identify whether it is day or night
time.
Initially the light is switched off in the room. Whenever a person push the button into the
room at positioning on the light, that light get turns on.
This project uses regulated 5V, 500mA power supply. 7805 three terminal voltage regulator is
used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac output of
secondary of 230/12V step down transformer.

NORTHERN INDIA ENGINEERING COLLEGE

2. BLOCK DIAGRAM:

light 1

light 2

light 3

Microcontroller

IR Signal
Driver

light 4

LCD Display

NORTHERN INDIA ENGINEERING COLLEGE

Circuit_Diagram:

NORTHERN INDIA ENGINEERING COLLEGE

NORTHERN INDIA ENGINEERING COLLEGE

NORTHERN INDIA ENGINEERING COLLEGE

4. WORKING:
WORKING
The remote we use sends a train of bits (0s and 1s) of some fixed length modulated with
a 38 KHz infrared signal. The sequence of bits which the remote sends is decided by a
Particular protocol known as RC-5 protocol

RC-5 PROTOCOL:A common used standard protocol for infrared data communication is the RC5 code,
originally developed by Philips. This code has an instruction set of 2048 different
instructions and is divided into 32 address for different devices the remote belongs to like
TV,VCR etc. with each address having 64 instructions each for different buttons on the
remote. Every kind of equipment uses his own address, and every button has its own
unique code. So this makes it possible to change the volume of the TV without change
the volume of the stereo. The transmitted code is a data word which consists of 14 bits
and is defined as:
2 start bits for the automatic gain control in the infrared receiver.
1 toggle bit (change every time when a new button is pressed on the ir transmitter
5 address bits for the system address
6 instruction bits for the pressed key

NORTHERN INDIA ENGINEERING COLLEGE

We used a single remote to control all the devices so everything except the toggle bit and
the and the command bits are same. We studied the codes for a particular TV remote
to be used with our devices. The next challenge was to get something which would detect
these codes so that 89s2051 microcontroller would read these codes. The solution is

NORTHERN INDIA ENGINEERING COLLEGE

TSOP 1738:-

The TSOP 17XX series are miniaturized receivers for infrared remote control systems.
PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed
as IR filter. The demodulated output signal can directly be decoded by a microprocessor.
TSOP 17XX is the standard IR remote control receiver series, supporting all major
transmission codes. Here XX refers to the frequency of the infrared carrier signal on
which the code is modulated, which is 38 KHz in our case. It has three pins .GND and
Vcc are connected to the power supply with VCC as 5V and Vout which becomes 0V, or
GND when the demodulated bit received is high i.e. 5V and vice versa.

NORTHERN INDIA ENGINEERING COLLEGE

CODING:After we have the code transmitted from the remote on the press of a button to the
microcontroller through the infrared receiver, we wrote a code using CVAVR, a
C compiler that would make a corresponding port of a microcontroller high when
the incoming code matches the corresponding button code. We read the incoming
code bit by bit by reading the Vout pin of the sensor to a port of the microcontroller.
To ensure each bit is read properly, we used a delay of 889 ms, which is the time
period of the demodulated signal which we receive from the remote and stored it
a character array .As we cannot store a bit directly in an array due to data type mismatch,
we stored 1 in the array whenever the bit was high and vice versa. Then we
compared the part of the code stored which changes from button to button i.e. the
command bit to distinguish between different button presses and when a particular
code matches, we make corresponding port high, i.e. give an output of 5V from that
port which depends on the supply voltage we provide to the microcontroller i.e. if the
supply would have been 6V; the high would correspond to the port giving 6V.
The ON OFF condition of a device. I.e. the device turns on when we press a button one
time and turns off when we press again is fulfilled by taking care of the toggle bit.
We now needed a device which would turn a equipment on when it receives a particular
voltage from the microcontroller. The device is relay.

10

NORTHERN INDIA ENGINEERING COLLEGE

RELAY:-

It basically is a switching device. On providing a definite specified DC voltage across the


induction coil, it gets magnetized and causes the switch (the middle one) to flip its
position from where it was previously to the other pin, causing the device attached across
it to turn on. But we had a problem, we were provided with only 12 volt relay (it operated
on 12 V) and the microcontroller gave 5V.So we used a BJT transistor in Common
emitter mode to amplify 5V to 12 V. We finally attached our device across the relay to
get it working when the relay received 12 V, otherwise not.

11

NORTHERN INDIA ENGINEERING COLLEGE

Display section:
The display section consists of 16*2 LCD, which used to display Summary project.
LCDs can add a lot to your application in terms of providing an useful interface for the
user, debugging an application or just giving it a "professional" look. The most common
type of LCD controller is the Hitatchi 44780 which provides a relatively simple interface
between a processor and an LCD.
Pin Description:
Pins

Description

Ground

Vcc

Contrast Voltage

"R/S" _Instruction/Register Select

"R/W" _Read/Write LCD Registers

"E" Clock

7 - 14

Data I/O Pins

15-16

LED+

LED-

The LCD interface is a parallel bus, allowing simple and fast reading/writing of data to
and from the LCD.
This waveform will write an ASCII Byte out to the LCD's screen. The ASCII code to be
displayed is eight bits long and is sent to the LCD either four or eight bits at a time. If
four bit mode is used, two "nybbles" of data (Sent high four bits and then low four bits
with an "E" Clock pulse with each nybble) are sent to make up a full eight bit transfer.
The "E" Clock is used to initiate the data transfer within the LCD.

12

NORTHERN INDIA ENGINEERING COLLEGE

Sending parallel data as either four or eight bits are the two primary modes of operation.
While there are secondary considerations and modes, deciding how to send the data to the
LCD is most critical decision to be made for an LCD interface application.
Eight bit mode is best used when speed is required in an application and at least ten I/O
pins are available. Four bit mode requires a minimum of six bits. To wire a
microcontroller to an LCD in four bit mode, just the top four bits (DB4-7) are written to.
The "R/S" bit is used to select whether data or an instruction is being transferred between
the microcontroller and the LCD. If the Bit is set, then the byte at the current LCD
"Cursor" Position can be read or written. When the Bit is reset, either an instruction is
being sent to the LCD or the execution status of the last instruction is read back (whether
or not it has completed).

13

NORTHERN INDIA ENGINEERING COLLEGE

6. PCB LAYOUT
A printed circuit board, or PCB, is used to mechanically support and electrically
connect electronic components using conductive pathways, tracks or traces etched from
copper sheets laminated onto a non-conductive substrate. It is also referred to as printed
wiring board (PWB) or etched wiring board. A PCB populated with electronic
components is a printed circuit assembly (PCA), also known as a printed circuit board
assembly (PCBA).
Printed Circuit Boards play a vital role
here in determining the overall performance of
the electronic equipment. A good PCB design
ensures that the noise introduced as a result of
component placement and track layout is held
within limits while still providing components
years of assembly maintenance and performance
reliability.
Where and Why are PCBs used?
Printed circuits boards are used to route electric signals through copper track which are
firmly bonded to an insulating base.
Advantages of PCB over common wiring are:
1. PCBs are necessary for connecting a large number of electronic components in a very
small area with minimum parasitic effects.
2. PCBs are simulated with mass production with less chance of writing error.
3. Small components are easily mounted.
4. Servicing in simplified.
Base Materials used for PCB
The base materials used for PCBs are glass epoxy, epoxy paper, polyester etc. Copper
foil used for copper clad is manufactured by the process of electronic deposition.
Preparation of Single Sided PCB
In single sided PCB conductor tracks are present on one side of copper clad
board. So crossing of conductors is not allowed. It is mechanically & chemically
cleansed. The photo resist is an organic solution which when exposed to light of proper
wavelength, changes their solubility in developer but after exposure to light is not
soluble.
14

NORTHERN INDIA ENGINEERING COLLEGE

Laminate coating of photo resist is done by: (i) Spray coating (ii) Dip coating (iii) Roller
coating.
The coated copper clad and laminated film negative is kept in intimate contact with each
other. The assembly is exposed to UV light and is rinsed in the developer tank. Proper
developer has to be used for a particular photo resist and then the PCB is dyed in a tray.
The dye reveals the flux to be used for a particular photo resist. Then the PCB is dyed in
a tray.
FABRICATION
The required circuit is designed and the layout of the circuit is done on the component
side as well as the copper clad side. Spaces are provided for holes to insert the respective
components. Etch resistant ink coatings are given on the interconnecting marks.
ETCHING
The copper clad PCB is etched with ferrous chloride solution containing a small amount
of Hydro Chloric Acid for increasing activeness of Ferric Chloride in etching. Wherever
the varnish coating is there the copper remains. Then it is washed with water and Oxalic
Acid.
The vast majority of printed circuit boards are made by bonding a layer of copper
over the entire substrate, sometimes on both sides, (creating a "blank PCB") then
removing unwanted copper after applying a temporary mask (e.g. by etching), leaving
only the desired copper traces. A few PCBs are made by adding traces to the bare
substrate (or a substrate with a very thin layer of copper) usually by a complex process of
multiple electroplating steps.
There are three common "subtractive" methods (methods that remove copper) used for
the production of printed circuit boards:
1.
Silk screen printing uses etch-resistant inks to protect the copper foil. Subsequent
etching removes the unwanted copper. Alternatively, the ink may be conductive, printed
on a blank (non-conductive) board. The latter technique is also used in the manufacture of
hybrid circuits.
2.
Photoengraving uses a photomask and chemical etching to remove the copper foil
from the substrate. The photomask is usually prepared with a photoplotter from data
produced by a technician using CAM, or computer-aided manufacturing software. Laserprinted transparencies are typically employed for phototools; however, direct laser
imaging techniques are being employed to replace phototools for high-resolution
requirements.
3.
PCB milling uses a two or three-axis mechanical milling system to mill away the
copper foil from the substrate. A PCB milling machine (referred to as a 'PCB Prototyper')
operates in a similar way to a plotter, receiving commands from the host software that
control the position of the milling head in the x, y, and (if relevant) z axis. Data to drive
15

NORTHERN INDIA ENGINEERING COLLEGE

the Prototyper is extracted from files generated in PCB design software and stored in
HPGL or Gerber file format.
DRILLING
Holes through a PCB are typically drilled with tiny drill bits made of solid
tungsten carbide. The drilling is performed by automated drilling machines with
placement controlled by a drill tape or drill file. These computer-generated files are also
called numerically controlled drill (NCD) files or "Excellon files".
The drill file describes the location and size of each drilled hole. These holes are
often filled with annular rings (hollow rivets) to create vias. Vias allow the electrical and
thermal connection of conductors on opposite sides of the PCB.

Plating and Coating


PCBs are plated with Solder, Tin, or Gold over Nickel as a resist for etching (removal)
away the (unneeded after plating) underlying copper. Matte solder is usually fused to
provide a better bonding surface or stripped to bare copper.
Treatments, such as benzimidazolethiol, prevent surface oxidation of bare copper. The
places to which components will be mounted are typically plated, because untreated bare
copper oxidizes quickly, and therefore is not readily solderable. Traditionally, any
exposed copper was coated with solder by hot air solder levelling (HASL). This solder
was a tin-lead alloy, however new solder compounds are now used to achieve compliance
with the RoHS directive in the EU and US, which restricts the use of lead. One of these
lead-free compounds is SN100CL, made up of 99.3% tin, 0.7% copper, 0.05% nickel,
and a nominal of 60ppm germanium.

SOLDERING
Soldering is the process of joining of two metals using an alloy solder consisting of Tin
and Lead (Sn-Pb). Tin determines the melting whereas the Lead is used to reduce the
cost. After the PCB fabrication is done, the various components are arranged at proper
locations on the PCB and then the soldering is done. All liquids consist of particles which
attract each other. The surface is always trying to shrink and this is because of surface
tension. The principle behind soldering is that when liquid particles are brought in contact
with the walls of the solid surface, it may happen that the solid attracts the liquid surface.
This property is called adhesive property. Care must be taken that the melting point of
solder is below that of the metal so that its surface is melted without melting without the
metal.

16

NORTHERN INDIA ENGINEERING COLLEGE

NEED FOR FLUX


During the soldering process the flux acts as a medium for improving the degree of
melting. The basic functions of flux are mentioned below:
1. Removes oxide from the surface.
2. It transfers heat from source to the joining & provide liquid cover including air
gap.
3. Removal of residue after the completion of the soldering operation.
PCB LAYOUT
The layout can be done either by hand or by using PCB designing software mentioned
below:

EAGLE by Cadsoft

DipTrace by Novarm

FreePCB by Allan Wright (open-source Win2K/XP)

FreeRouting by Alfons Wirtz (Java, Autorouter with free angle support)

Cadstar by Zuken

gEDA, open-source PCB software project

OrCAD by Cadence

Allegro by Cadence

TARGET 3001!

Kicad, open-source suite

PADS by Mentor Graphics

PCB123 Design by Sunstone Circuits

Proteus

17

NORTHERN INDIA ENGINEERING COLLEGE

7. Software Programming Procedure


Step-1) Install Keil MicroVision in your PC, Then after Click on that Keil UVision
icon. After opening the window go to toolbar and select Project Tab then close previous
project.
Step-2) Next select New Project from Project Tab.
Step-3) Then it will open Create New Project window. Select the path where you want
to save project and edit project name.
Step-4) Next it opens Select Device for Target window, it shows list of companies and
here you can select the device manufacturer company.
Step-5) For an example, for your project purpose you can select the chip as 89s51/52
from Atmel Group. Next Click OK Button, it appears empty window here you can
observe left side a small window i.e., Project Window. Next create a new file.
Step-6) From the Main tool bar Menu select File Tab and go to New, then it will open a
window, there you can edit the program.
Step-7) Here you can edit the program as which language will you prefer either Assembly
or C.
Step-8) After editing the program save the file with extension as .c or .asm, if you
write a program in Assembly Language save as .asm or if you write a program in C
Language save as .c in the selected path. Take an example and save the file as test.c.
Step-9) Then after saving the file, compile the program. For compilation go to project
window select source group and right click on that and go to Add files to Group.
Step-9) Here it will ask which file has to Add. For an example here you can add test.c
as you saved before.
Step-9) After adding the file, again go to Project Window and right click on your c file
then select Build target for compilation. If there is any Errors or Warnings in your
program you can check in Output Window that is shown bottom of the Keil window.
Step-10) Here in this step you can observe the output window for errors and warnings.

18

NORTHERN INDIA ENGINEERING COLLEGE

Step-11) If you make any mistake in your program you can check in this slide for which
error and where the error is by clicking on that error.
Step-12) After compilation then next go to Debug Session. In Tool Bar menu go to
Debug tab and select Start/Stop Debug Session.
Step-13) Here a simple program for Leds Blinking. LEDS are connected to PORT-1.
You can observe the output in that port.
Step-14) To see the Ports and other Peripheral Features go to main toolbar menu and
select peripherals.
Step-15) In this slide see the selected port i.e., PORT-1.
Step-16) Start to trace the program in sequence manner i.e., step by step execution and
observe the output in port window.
Step-17) After completion of Debug Session Create an Hex file for Burning the
Processor. Here to create an Hex file go to project window and right click on Target next
select Option for Target.
Step-18) It appears one window; here in target tab modify the crystal frequency as you
connected to your microcontroller.
Step-19) Go to Output tab. Click on Create HEX File and then click OK. Finally
Once again compile your program. The Created Hex File will appear in your path folder

19

NORTHERN INDIA ENGINEERING COLLEGE

7. Programming

$0000 $28C4
$0004 $
_delay_22us:
;delays.pbas,13 ::
;delays.pbas,14 ::
$0004 $3015
$0005 $1303
$0006 $1283
$0007 $00FA
$0008 $0BFA
$0009 $2808
$000A $0000
$000B $0000
$000C $0000
$000D $
delays_L_2:
$000D $0008
$000E $
_div_16x16_u:
$000E $1303
$000F $1283
;math.ppas,107 ::
;math.ppas,110 ::
$0010 $01F8
;math.ppas,111 ::
$0011 $01F9
;math.ppas,112 ::
$0012 $3010
;math.ppas,113 ::
$0013 $00FC
;math.ppas,114 ::
$0014 $0D71
;math.ppas,115 ::
$0015 $0DF8
;math.ppas,116 ::
$0016 $0DF9
;math.ppas,117 ::
$0017 $0874
;math.ppas,118 ::
$0018 $02F8
;math.ppas,119 ::
$0019 $0875
;math.ppas,120 ::
$001A $1C03
;math.ppas,121 ::

GOTO _main
sub procedure Delay_22us
Delay_us(22)
MOVLW
21
BCF STATUS, RP1
BCF STATUS, RP0
MOVWF
STACK_10
DECFSZ
STACK_10, F
GOTO $-1
NOP
NOP
NOP
RETURN
BCF
BCF

STATUS, RP1
STATUS, RP0

CLRF STACK_8
CLRF STACK_9
MOVLW

16

MOVWF

STACK_12

RLF

STACK_1, W

RLF

STACK_8, F

RLF

STACK_9, F

MOVF STACK_4, W
SUBWF

STACK_8, F

MOVF STACK_5, W
BTFSS STATUS, C

20

NORTHERN INDIA ENGINEERING COLLEGE

$001B $0F75
;math.ppas,122 ::
$001C $02F9
;math.ppas,123 ::
$001D $1803
;math.ppas,124 ::
$001E $2826
;math.ppas,125 ::
$001F $0874
;math.ppas,126 ::
$0020 $07F8
;math.ppas,127 ::
$0021 $0875
;math.ppas,128 ::
$0022 $1803
;math.ppas,129 ::
$0023 $0F75
;math.ppas,130 ::
$0024 $07F9
;math.ppas,131 ::
$0025 $1003
;math.ppas,132 ::
$0026 $0DF0
;math.ppas,133 ::
$0027 $0DF1
;math.ppas,134 ::
$0028 $0BFC
;math.ppas,135 ::
$0029 $2814
;math.ppas,136 ::
$002A $
math_L_3:
;math.ppas,137 ::
$002A $0008
$002B $
_adc_read:
;adclib_a_c.ppas,11 ::
;adclib_a_c.ppas,13 ::
$002B $1303
$002C $1283
$002D $019F
;adclib_a_c.ppas,14 ::
$002E $30C0
$002F $049F
;adclib_a_c.ppas,15 ::
$0030 $3040
$0031 $1683

INCFSZ

STACK_5, W

SUBWF

STACK_9, F

BTFSC STATUS, C
GOTO $+8
MOVF STACK_4, W
ADDWF

STACK_8, F

MOVF STACK_5, W
BTFSC STATUS, C
INCFSZ

STACK_5, W

ADDWF

STACK_9, F

BCF

STATUS, C

RLF

STACK_0, F

RLF

STACK_1, F

DECFSZ

STACK_12, F

GOTO $-21

RETURN

BCF STATUS, RP1


BCF STATUS, RP0
CLRF ADCON0, 1
MOVLW
192
IORWF ADCON0, 1
MOVLW
64
BSF STATUS, RP0

21

NORTHERN INDIA ENGINEERING COLLEGE

$0032 $041F
IORWF ADCON1, 0
$0033 $00F0
MOVWF
STACK_0
$0034 $0870
MOVF STACK_0, 0
$0035 $009F
MOVWF
ADCON1
;adclib_a_c.ppas,17 ::
$0036 $3080
MOVLW
128
$0037 $0470
IORWF STACK_0, 0
$0038 $009F
MOVWF
ADCON1
;adclib_a_c.ppas,18 ::
$0039 $1283
BCF STATUS, RP0
$003A $0832
MOVF FARG_ADC_read, 0
$003B $00F0
MOVWF
STACK_0
$003C $0DF0
RLF STACK_0, 1
$003D $1070
BCF STACK_0, 0
$003E $0DF0
RLF STACK_0, 1
$003F $1070
BCF STACK_0, 0
$0040 $0DF0
RLF STACK_0, 1
$0041 $1070
BCF STACK_0, 0
$0042 $0870
MOVF STACK_0, 0
$0043 $049F
IORWF ADCON0, 1
;adclib_a_c.ppas,19 ::
$0044 $141F
BSF ADCON0, 0
;adclib_a_c.ppas,20 ::
$0045 $2004
CALL _delay_22us
;adclib_a_c.ppas,21 ::
$0046 $151F
BSF ADCON0, 2
;adclib_a_c.ppas,22 ::
$0047 $
adclib_a_c_L_2:
$0047 $3000
MOVLW
0
$0048 $191F
BTFSC ADCON0, 2
$0049 $3001
MOVLW
1
$004A $00F2
MOVWF
STACK_2
$004B $0872
MOVF STACK_2, 0
$004C $3A01
XORLW
1
$004D $1D03
BTFSS STATUS, Z
$004E $2851
GOTO adclib_a_c_L_3
;adclib_a_c.ppas,23 ::
$004F $0000
NOP
$0050 $2847
GOTO adclib_a_c_L_2
$0051 $
adclib_a_c_L_3:
;adclib_a_c.ppas,24 ::
$0051 $081E
MOVF ADRESH, 0
$0052 $00F2
MOVWF
STACK_2
$0053 $01F3
CLRF STACK_2+1
$0054 $0872
MOVF STACK_2, 0

22

NORTHERN INDIA ENGINEERING COLLEGE

$0055 $00F3
MOVWF
STACK_2+1
$0056 $01F2
CLRF STACK_2
$0057 $0872
MOVF STACK_2, 0
$0058 $00B3
MOVWF
_adc_read_local_result
$0059 $0873
MOVF STACK_2+1, 0
$005A $00B4
MOVWF
_adc_read_local_result+1
;adclib_a_c.ppas,25 ::
$005B $1683
BSF STATUS, RP0
$005C $081E
MOVF ADRESL, 0
$005D $0472
IORWF STACK_2, 0
$005E $1283
BCF STATUS, RP0
$005F $00B3
MOVWF
_adc_read_local_result
$0060 $0873
MOVF STACK_2+1, 0
$0061 $00B4
MOVWF
_adc_read_local_result+1
$0062 $3000
MOVLW
0
$0063 $04B4
IORWF _adc_read_local_result+1, 1
;adclib_a_c.ppas,26 ::
$0064 $101F
BCF ADCON0, 0
$0065 $
adclib_a_c_L_0:
$0065 $0833
MOVF _adc_read_local_result, 0
$0066 $00F0
MOVWF
STACK_0
$0067 $0834
MOVF _adc_read_local_result+1, 0
$0068 $00F1
MOVWF
STACK_0+1
;adclib_a_c.ppas,27 ::
$0069 $0008
RETURN
$006A $
_wordtostr:
;conv.ppas,30 ::
;conv.ppas,32 ::
$006A $3001
MOVLW
1
$006B $1303
BCF STATUS, RP1
$006C $1283
BCF STATUS, RP0
$006D $00B5
MOVWF
_wordtostr_local_len
;conv.ppas,33 ::
$006E $0833
MOVF FARG_WordToStr+1, 0
$006F $3C00
SUBLW
0
$0070 $1D03
BTFSS STATUS, Z
$0071 $2874
GOTO L_WordToStr_0
$0072 $0832
MOVF FARG_WordToStr, 0
$0073 $3C09
SUBLW
9
$0074 $
L_WordToStr_0:
$0074 $1803
BTFSC STATUS, C
$0075 $2877
GOTO conv_L_15
$0076 $
conv_L_14:
;conv.ppas,34 ::
$0076 $0AB5
INCF _wordtostr_local_len, 1

23

NORTHERN INDIA ENGINEERING COLLEGE

$0077 $
conv_L_15:
$0077 $
conv_L_16:
;conv.ppas,35 ::
$0077 $0833
MOVF FARG_WordToStr+1, 0
$0078 $3C00
SUBLW
0
$0079 $1D03
BTFSS STATUS, Z
$007A $287D
GOTO L_WordToStr_1
$007B $0832
MOVF FARG_WordToStr, 0
$007C $3C63
SUBLW
99
$007D $
L_WordToStr_1:
$007D $1803
BTFSC STATUS, C
$007E $2880
GOTO conv_L_18
$007F $
conv_L_17:
;conv.ppas,36 ::
$007F $0AB5
INCF _wordtostr_local_len, 1
$0080 $
conv_L_18:
$0080 $
conv_L_19:
;conv.ppas,37 ::
$0080 $0833
MOVF FARG_WordToStr+1, 0
$0081 $3C03
SUBLW
3
$0082 $1D03
BTFSS STATUS, Z
$0083 $2886
GOTO L_WordToStr_2
$0084 $0832
MOVF FARG_WordToStr, 0
$0085 $3CE7
SUBLW
231
$0086 $
L_WordToStr_2:
$0086 $1803
BTFSC STATUS, C
$0087 $2889
GOTO conv_L_21
$0088 $
conv_L_20:
;conv.ppas,38 ::
$0088 $0AB5
INCF _wordtostr_local_len, 1
$0089 $
conv_L_21:
$0089 $
conv_L_22:
;conv.ppas,39 ::
$0089 $0833
MOVF FARG_WordToStr+1, 0
$008A $3C27
SUBLW
39
$008B $1D03
BTFSS STATUS, Z
$008C $288F
GOTO L_WordToStr_3
$008D $0832
MOVF FARG_WordToStr, 0
$008E $3C0F
SUBLW
15
$008F $
L_WordToStr_3:
$008F $1803
BTFSC STATUS, C
$0090 $2892
GOTO conv_L_24
$0091 $
conv_L_23:
;conv.ppas,40 ::
$0091 $0AB5
INCF _wordtostr_local_len, 1

24

NORTHERN INDIA ENGINEERING COLLEGE

$0092 $
conv_L_24:
$0092 $
conv_L_25:
;conv.ppas,41 ::
$0092 $0834
$0093 $0084
$0094 $3020
$0095 $0080
$0096 $0A84
$0097 $0080
$0098 $0A84
$0099 $0080
$009A $0A84
$009B $0080
$009C $0A84
$009D $0080
$009E $0A84
$009F $0180
;conv.ppas,42 ::
$00A0 $0384
;conv.ppas,43 ::
$00A1 $
conv_L_28:
$00A1 $0835
$00A2 $3C00
$00A3 $1803
$00A4 $28C3
;conv.ppas,45 ::
$00A5 $300A
$00A6 $00F4
$00A7 $01F5
$00A8 $0832
$00A9 $00F0
$00AA $0833
$00AB $00F1
$00AC $200E
$00AD $0878
$00AE $00F0
$00AF $0879
$00B0 $00F1
$00B1 $3030
$00B2 $0770
$00B3 $0080
;conv.ppas,46 ::
;conv.ppas,47 ::
$00B4 $0384
;conv.ppas,48 ::

MOVF FARG_WordToStr+2, 0
MOVWF
FSR
MOVLW
32
MOVWF
INDF
INCF FSR, 1
MOVWF
INDF
INCF FSR, 1
MOVWF
INDF
INCF FSR, 1
MOVWF
INDF
INCF FSR, 1
MOVWF
INDF
INCF FSR, 1
CLRF INDF
DECF FSR, 1
MOVF _wordtostr_local_len, 0
SUBLW
0
BTFSC STATUS, C
GOTO conv_L_29
MOVLW
10
MOVWF
STACK_4
CLRF STACK_4+1
MOVF FARG_WordToStr, 0
MOVWF
STACK_0
MOVF FARG_WordToStr+1, 0
MOVWF
STACK_0+1
CALL _div_16x16_u
MOVF STACK_8, 0
MOVWF
STACK_0
MOVF STACK_9, 0
MOVWF
STACK_1
MOVLW
48
ADDWF
STACK_0, 0
MOVWF
INDF
DECF FSR, 1

25

NORTHERN INDIA ENGINEERING COLLEGE

$00B5 $300A
MOVLW
10
$00B6 $00F4
MOVWF
STACK_4
$00B7 $01F5
CLRF STACK_4+1
$00B8 $0832
MOVF FARG_WordToStr, 0
$00B9 $00F0
MOVWF
STACK_0
$00BA $0833
MOVF FARG_WordToStr+1, 0
$00BB $00F1
MOVWF
STACK_0+1
$00BC $200E
CALL _div_16x16_u
$00BD $0870
MOVF STACK_0, 0
$00BE $00B2
MOVWF
FARG_WordToStr
$00BF $0871
MOVF STACK_0+1, 0
$00C0 $00B3
MOVWF
FARG_WordToStr+1
;conv.ppas,49 ::
$00C1 $03B5
DECF _wordtostr_local_len, 1
;conv.ppas,50 ::
$00C2 $28A1
GOTO conv_L_28
$00C3 $
conv_L_29:
$00C3 $
conv_L_13:
;conv.ppas,51 ::
$00C3 $0008
RETURN
$00C4 $
_main:
;vc.pbas,6 ::
main:
$00C4 $
_main_main:
;vc.pbas,7 ::
ADCON1 = 0x80
$00C4 $3080
MOVLW
128
$00C5 $1303
BCF STATUS, RP1
$00C6 $1683
BSF STATUS, RP0
$00C7 $009F
MOVWF
ADCON1
;vc.pbas,8 ::
TRISA = 0xFF
$00C8 $30FF
MOVLW
255
$00C9 $0085
MOVWF
TRISA
;vc.pbas,9 ::
trisc=%00000000
$00CA $0187
CLRF TRISC, 1
;vc.pbas,24 ::
INITIAL:
$00CB $
_main_initial:
;vc.pbas,25 ::
t= ADC_read(1)
$00CB $3001
MOVLW
1
$00CC $1283
BCF STATUS, RP0
$00CD $00B2
MOVWF
FARG_ADC_read
$00CE $202B
CALL _adc_read
$00CF $0870
MOVF STACK_0, 0
$00D0 $00A0
MOVWF
_t
$00D1 $0871
MOVF STACK_0+1, 0
$00D2 $00A1
MOVWF
_t+1
;vc.pbas,26 ::
wordtostr(t,tt)

26

NORTHERN INDIA ENGINEERING COLLEGE

$00D3 $0870
$00D4 $00B2
$00D5 $0871
$00D6 $00B3
$00D7 $3022
$00D8 $00B4
$00D9 $206A
;vc.pbas,28 ::
$00DA $0821
$00DB $3C00
$00DC $1D03
$00DD $28E0
$00DE $0820
$00DF $3C32
$00E0 $
$00E0 $1803
$00E1 $291F
$00E2 $
;vc.pbas,29 ::
$00E2 $
$00E2 $1507
$00E3 $
;vc.pbas,30 ::
$00E3 $3014
$00E4 $00FB
$00E5 $30FF
$00E6 $00FA
$00E7 $0BFB
$00E8 $28EA
$00E9 $28ED
$00EA $0BFA
$00EB $28EA
$00EC $28E7
$00ED $306C
$00EE $00FA
$00EF $0BFA
$00F0 $28EF
$00F1 $0000
$00F2 $0000
$00F3 $0000
;vc.pbas,31 ::
$00F4 $1107
$00F5 $
;vc.pbas,32 ::
$00F5 $3004

MOVF STACK_0, 0
MOVWF
FARG_WordToStr
MOVF STACK_0+1, 0
MOVWF
FARG_WordToStr+1
MOVLW
_tt
MOVWF
FARG_WordToStr+2
CALL _wordtostr
if t>50 then
MOVF _t+1, 0
SUBLW
0
BTFSS STATUS, Z
GOTO L_main_0
MOVF _t, 0
SUBLW
50
L_main_0:
BTFSC STATUS, C
GOTO vc_L_2
vc_L_1:
portc.2=1
vc_L_4:
BSF PORTC, 2
vc_L_5:
delay_ms(5)
MOVLW
20
MOVWF
STACK_11
MOVLW
255
MOVWF
STACK_10
DECFSZ
STACK_11, F
GOTO $+2
GOTO $+4
DECFSZ
STACK_10, F
GOTO $-1
GOTO $-5
MOVLW
108
MOVWF
STACK_10
DECFSZ
STACK_10, F
GOTO $-1
NOP
NOP
NOP
portc.2=0
BCF PORTC, 2
vc_L_7:
delay_ms(1)
MOVLW
4

27

NORTHERN INDIA ENGINEERING COLLEGE

$00F6 $00FB
$00F7 $30FF
$00F8 $00FA
$00F9 $0BFB
$00FA $28FC
$00FB $28FF
$00FC $0BFA
$00FD $28FC
$00FE $28F9
$00FF $30E1
$0100 $00FA
$0101 $0BFA
$0102 $2901
$0103 $0000
$0104 $0000
$0105 $0000
;vc.pbas,34 ::
$0106 $
;vc.pbas,35 ::
$0106 $1107
$0107 $
;vc.pbas,36 ::
$0107 $3001
$0108 $00B2
$0109 $202B
$010A $0870
$010B $00A0
$010C $0871
$010D $00A1
;vc.pbas,37 ::
$010E $0871
$010F $3C00
$0110 $1D03
$0111 $2914
$0112 $0870
$0113 $3C32
$0114 $
$0114 $1803
$0115 $2917
$0116 $
;vc.pbas,38 ::
$0116 $2906
;vc.pbas,39 ::
$0117 $
;vc.pbas,40 ::
$0117 $3063

MOVWF
MOVLW
MOVWF
DECFSZ
GOTO $+2
GOTO $+4
DECFSZ
GOTO $-1
GOTO $-5
MOVLW
MOVWF
DECFSZ
GOTO $-1
NOP
NOP
NOP

STACK_11
255
STACK_10
STACK_11, F
STACK_10, F
225
STACK_10
STACK_10, F

wait:
_main_wait:
portc.2=0
BCF PORTC, 2
vc_L_9:
t= ADC_read(1)
MOVLW
1
MOVWF
FARG_ADC_read
CALL _adc_read
MOVF STACK_0, 0
MOVWF
_t
MOVF STACK_0+1, 0
MOVWF
_t+1
if t>50 then
MOVF STACK_0+1, 0
SUBLW
0
BTFSS STATUS, Z
GOTO L_main_1
MOVF STACK_0, 0
SUBLW
50
L_main_1:
BTFSC STATUS, C
GOTO vc_L_11
vc_L_10:
goto wait
GOTO _main_wait
else
vc_L_11:
delay_us(100)
MOVLW
99

28

NORTHERN INDIA ENGINEERING COLLEGE

$0118 $00FA
MOVWF
STACK_10
$0119 $0BFA
DECFSZ
STACK_10, F
$011A $2919
GOTO $-1
$011B $0000
NOP
$011C $0000
NOP
$011D $0000
NOP
;vc.pbas,41 ::
goto initial
$011E $28CB
GOTO _main_initial
;vc.pbas,42 ::
end if
$011F $
vc_L_2:
;vc.pbas,43 ::
end if
$011F $
vc_L_3:
;vc.pbas,148 ::
goto initial
$011F $28CB
GOTO _main_initial
$0120 $2920
GOTO $

29

NORTHERN INDIA ENGINEERING COLLEGE

8. REFERENCES

Websites:
www.datasheetlocator.com
www.atmel.com
www.electronicsforu.com

Books:
Micro controller by Ayala
Embedded System by Mazidi
Microprocessor and micro controller: U. A. Bakshi

30

NORTHERN INDIA ENGINEERING COLLEGE

9. DATASHEETS
1) Microcontroller AT89s51
2) Voltage Regulator IC - 7805
3) Voltage Regulator IC - 7812
4) IC555
5) Liquid Crystal Display
6) IR Receiver - TSOP1738

31

You might also like