OFFICE AUTOMATION OFFICE AUTOMATION
The embedded system is a combination of hardware, software and additional mechanical parts designed to perform a specific function. A good example is the ROAD TRAFFI !"!T#$. %ere the traffic signal changes periodically according to a predetermined program that is fed into the I . !o an embedded system is designed to do a specific tas& with in a gi'en time repeatedly, endlessly and with or without human inter'ention. The pro(ect 'OFFICE AUTOMATION' is based on embedded technology that uses MICROCHIP'S PIC MICROCONTROLLER, PIC16F877 This has 'ery much influence in industrial application. The chip is programmed according to the re)uirement of the user. *rogram coding is done using assembly language. Microchip+s Inte r!te" #e$e%op&ent En$iron&ent MPLA' is used to simulate and assemble the written code. ,ew millennium gi'es importance to 'arious ad'anced automation technologies in 'arious phases of human life. The OFFICE AUTOMATION S(STEM is a uni)ue 'enture, which gi'es a complete automation and security for an office building. It not only automates 'arious utilities but also sa'es a good amount of con'entional electrical energy by switching off the electrical appliances, which is not effecti'ely utili-ed. The e)uipment allows automation for doors, fan and lighting de'ices. !o the main concern of this pro(ect is conser'ation of the con'entional electrical energy and its efficient usage and pro'ides security of the office. It monitors an authori-ed entry to the office with real time sur'eillance system. Acti'e IR sensors sense the entering or lea'ing of persons to the office or from the office. An intelligent display gi'es the current count of the persons inside the office. .nwanted use of electrical e)uipments are monitored and controlled by sensors. Once the system is installed there is no need of any human interface except for the password entry. This reduces the chance of unauthori-ed entry and theft. /y using the micro controller the hardware expense is reduced. It is 'ery simple to install and easy to maintain. This system is highly reliable, cost effecti'e and compact in si-e. All these ha'e been enhanced by the use of micro controller.
CONTENTS
I)
A'STRACT
8. 9.
I,TROD. TIO, /;O < DIA=RA$
0. 1. 2. 3. 4. 5.
FLO* CHART A'OUT PIC+THE 'RAIN OF THE S(STEM *H( PIC IS USE# A'OUT PIC 16F87, S(STEM FEATURES PRO-RAM
67. CIRCUIT #IA-RAM
II) #ATASHEET
68. CONCLUSION 69. 'I'LIO-RAPH(
A'STRACT
,ew millennium gi'es importance to 'arious ad'anced automation technologies in 'arious phases of human life. The automatic office management system is a uni)ue 'enture, which gi'es a complete automation and security for any office building. It not only automates 'arious utilities but also sa'es a good amount of power by switching off electrical appliances, which is not effecti'ely utili-ed. The e)uipment allows automation for doors, fan and lighting de'ices. It monitors unauthori-ed entry to the office with real time sur'eillance entry to the office with real:time arbitration process, allows precision and error free
sensing of instructions. An intelligent display gi'es the current count of the people inside the office. .nwanted use of electrical e)uipments are monitored and controlled by built in light.
INTRO#UCTION
The new millennium gi'es top priority for energy management and effecti'e utili-ation of generated electrical power. It is studied that more than 07> of the total electrical power generated is wasted due to improper monitoring or consumption. As we see in most of the offices most of the electrical appliances li&e fan, lights will be left O, from day brea& to e'ening e'en if the personnel+s are not in the infra red seta. It becomes difficult for them to switch it O, or OFF all the appliances before they lea'e or enter the office. As a result a huge amount of energy is wasted. $oreo'er the need ensuring security is recei'ing a 'ital importance in our day:to:day life. It is essential to ensure security in factories, ban&s, and confidential areas of research centers, power plants etc /ut now in these areas the tas& of maintaining security has become an enormous technological challenge. This pro(ect pro'ides efficient security and a'oids the chance of unauthori-ed entry. The office management system is a ,o'ell networ&, which considers the abo'e concepts and monitors inefficient use of electrical energy using embedded systems. #mbedded system is one of the fast emerging trends in our day:to:day life, which has been gi'en more importance and popularity since the past decade or two. It has ta&en into 'arious fields of life. It ranges from small toys to sophisticated control and functioning of machines. #mbedded system is basically a combination of hardware and software systems. Depending on the input recei'ed we can control or operate different output de'ices with the help of software written on to the system depending on our needs. These programs can then be upgraded for more functioning which will be needed later. . ?ith the help of an embedded system here a design for an office management is being de'eloped. The main concern of the pro(ect is conser'ation of the con'entional electrical energy and its efficient usage and pro'ides security of the office. The core of the system is a flash memory programmed micro controller. The system
employs a 'ariety of sensors, which are used to measure the different parameters inside the office, and they pro'ide the information to the micro controller. The system pro'ides a 'ariety of sensors, which are used to measure the different parameters inside the office and they the information to the micro controller through their corresponding hardware. $ain steps of the sensors used are for sensing the luminance, temperature, presence of occupants etc, depending on the status obtained from the sensors the micro controller decides to switch OFF . the electrical e)uipments li&e fans, lights, when they are not needed as they are pre
rogrammed on the micro controller. It also guards one office complex against unattached entries and causalities li&e fire. All the sensors are suitably calibrated and gi'e signals to the micro controller, which uses intelligence to control different de'ices. The entry is password protected. The programmed password is stored in ##*RO$ @non:'olatile memoryA, which preser'es the data when the system is un
owered. Once the system is installed there is no need of any human interface except for the password entry. This reduces the chance of unauthori-ed entry. This reduces the chance of unauthori-ed entry and theft.
7 SEGMENT DISPLAY
KEYBOARD
LDR PIC16F877
— DRIVER
FAN
IR SENSOR 1
— DRIVER
IR SENSOR 2 THERMISTOR
LIGHT
'LOC. #IA-RAM
FEATURES
B The system conser'es con'entional electrical energy.
B *ro'ides security for the office.
B This system reduces the chance of unauthori-ed entry to the office and theft.
B Acti'e IR sensors allow precision and error free sensing.
B An intelligent display gi'es the current count of the persons inside the office.
B .nwanted use of electrical e)uipments are monitored and controlled by sensors. B !ystem offers password protection.
B A 0x0 &eyboard is used for entering password.
B It is simple to install and easy to maintain.
B This system is highly reliable and cost effecti'e.
STU#( OF PIC MICROCONTROLLER
*I micro de'ices are grouped by the si-e of their instruction word. The three current *I micro families areC /ase:;ine C 68:bit instruction word length $id: Range C 60:bit instruction word length %igh:#nd C 62:bit instruction word length
D#DI # !TR. T.R# #ach part of a de'ice can placed into one of three groupsC 6. ore 8. *eripherals 9. !pecial Features T%# OR# The core pertains to the basic features that are re)uired to ma&e the de'ice operate. These includes 6. De'ice Oscillator 8. Reset ;ogic 9. *.@ entral *rocessing .nitA 0. A;.@Arithmetic ;ogic .nitA 1. De'ice memory map organi-ation 2. Interrupt Operation 3. Instruction set re'ision
:5:
*#RI*%#RA;! *eripherals are the features that add a differentiation from a microprocessor. These ease in interfacing to the external world @such as general purpose IEO, ; D dri'ers, AED inputs, and *?$ outputsA,and internal tas&s such as &eeping different time bases@such as timersA.The peripherals areC 6. 8. 9. 0. 1. 2. 3. TI$#RO TI$#R 6 TI$#R8 AD IEO *ORT! .!ART *
!*# IA; F#AT.R#! !pecial features are the uni)ue features that help to decrease system cost or increase system reliability or increase system flexibility. The *I microcontrollers offer se'eral features that help to achie'e these goals. The special features discussed areC 6. 8. 9. 0. 1. De'ice configuration bits On:chip *ower:On Reset@*ORA /rown:Out Reset@/ORA ;O=I ?atchdog timer ;ow power mode @sleep modeA
VDD
MCLR INTERNAL PGR PWR PWRT TIME-OUT OST TIME-OUT INTERNA L RESET "
OSCILLATOR The internal oscillator circuit is used to generate the de'ice cloc&. The de'ice cloc& is re)uired for the de'ice to execute instructions and for the peripherals to function. Four de'ice cloc& periods generate one internal cloc& cycle. There are up to eight different modes which the oscillator may ha'e. There are two modes which allows the selection of the internal R oscillator cloc& out @ ;< O.TA to be dri'en on an IEO pin, or allow that IEO pin to be used for a general purpose function. The oscillator mode is selected by the de'ice configuration bits. The de'ice configuration bits are non'olatile memory locations and the operating mode is determined by the 'alue written during de'ice programming. The oscillator modes areC 6 ;* ;ow fre)uency @*owerA rystal 8 FT rystal E Resonator 9 %! %igh !peed rystal E Resonator 0 R #xternal Resistor E apacitor @same as #FTR with ;<O.TA 1 #FTR #xternal Resistor E apacitor 2 #FTR #xternal Resistor E apacitor with ;<O.T 3 I,TR Internal 0$%- Resistor E apacitor 4 I,TR Internal 0$%- Resistor E apacitor with ;<O.T STATUS RE-ISTER /it 3 addressingA The status register contains two bits @TO and *DA, which when used in con(unction with the * O, register bits pro'ide the user with enough information to determine the cause of the reset. IR*R*6R*O67*DGD RE?:7 RE?:x /it 3RE?:7 2RE?:7 1R:6 0R:6 9R3?:8x RE? 6:x
/it
:66:
IR*C Register /an& !elect /it @used for indirect /it 2C 1 addressingA
lH/an& 8, 9 @lOOh:lFFhA 7H/an& 7, 6 @lOOh:FFhA For de'ices with only /an& 7 and /an& 6 the IR* bit is reser'ed, always maintains this clear R*6C R*OC Register /an& !elect /its @used for direct 6 6 H /an& 9 @647h:lFFhA 6 7 H /an&8@677h:63FhA 7 6 H /an& 6 @47h:FFhA 7 7 H /an& 7 @77h: 3FhA #ach ban& is 684 bytes. For de'ices with only /an& 7 and /an& 6 the IR* bits is reser'ed, always maintain this bit clear.
/it 0 instruction
TOC Time:Out bit 6 H after power up, ;R?DT instruction or sleep 7 H A ?DT time out occurred.
/it 9
*DC *oer
own bit 6 H after power up or by the ;R?DT instruction.
/it 8
:5: 7 H by execution of the !;##* instruction. GC Gero bit 6 H the result of an arithmetic or logic operation is -ero. 7 - the result of an arithmetic or logic operation is not
-ero. /it 6 D C Digit carry E /orrow bit @ADD?F, ADD;?, !./?F, !./;? instructionsA @for borrow the polarity is reser'edA 6 H A carry out from the 0th low order bit of the occurred. 7 H ,o carry out from the 0th low order bit of the result. C arry E /orrow bit @ADD?F, ADD;?, !./?F, !./;? instructionsA 6 H A carry out from the most significant bit of the result occurred. 7 H ,o carry out from the most significant bit of the result occurred @means the result is negati'eA
/itO
ARCHITECTURE The high performance of the *I micro de'ices can be attributed to a number of architectural features commonly found in RI! microprocessors. 6 %ardware architecture 8 ;ong word instructions 9 !ingle word instructions 0 !ingle cycle instruction 1 Instruction pipelining 2 Reduced instruction set 3 Register file architecture 4 Orthogonal @symmetricA instructions
13
%iiulwtiie Architecture
OPTION RE- RE-ISTER The O*TIO,IR#= register is a readable and writable register which contains 'arious control bits to configure the T$RO E ?DT prescalar ,the external I,T interrupt ,T$R7 ,and the wea& pull:ups on *ORT /. RE?:l RE?:l RE?: RE?: RE?: RE?:l RE?: RE?:
R/*.I,T#D=TO !TO!#*!A*!8*!6*!O/it 3210986
/itO /it 7
R/*.C *ORT / *ull:.p #nable bit 6 H *ORT / pull ups are disabled 7 H *ORT / pull ups are enabled by indi'idual port latch
'alues /it 2 I,T#D=C Interrupt #dge !elect bit 6 H Interrupt on rising edge of I,T pin 7 H Interrupt on falling edge of I,T pin /it 1 TO !C T$RO cloc& !ource !elect bit 6 H Transition on TO <6 pin 7 H Internal instruction cycle cloc& @ ;<O.TA
/it 0
TO!#C T$RO !ource #dge !elect bit 6 H Increment on high:to0ow transition on TO <6 pin 7 H Increment on low:to:high transition on TO <6 pin *!AC *rescalar Assignment bit 6 H *rescalar is assigned to the ?DT 7 H *rescalar is assigned to the Timer 7 module
/it 9
/it 8:7
*!8:*!7C *rescalar rate select bits
*! 6. T$RO Rate *!O 7 7 7 6C8 7 7 6 6C0 7 6 7 6C4 7 6 6 6C62 6 7 7 6C98 6 7 6 6C20 6 6 7 6C684 6 6 6 6C812 *RI=RA$ $#$OR" OR=A,IGATIO,
*!8
?DT Rate 6C6 6C8 6C0 6C4 6C62 6C98 6C20 6C684
$id:range $ . de'ices ha'e 69:bit program counter capable of addressing an 4< J 60 program memory space. The width of the program memory bus @instruction wordA is 60:bits.!ince all the instructions are a single word, a de'ice with an 4< J 60 program memory has space for 4< of instructions. This ma&es it much easier to determine if a de'ice has sufficient memory for desired application. This program memory space is di'ided into four pages of 8< words each @7h:3FFh,477h:FFFh,6777h:63FFh,and 6477h:lFFhA.Figure shows the program memory map as well as the 4 le'el deep hardware stac&. To (ump between the program pages, the high bits of the *rogram ounter @* A must be modified. This is done by writing the desired 'alue into a special function register called * ;AT% @*rogram ounter ;atch %ighA.If se)uential instructions are executed, the * will cross the page boundaries without any user inter'ention.
#ATA MEMOR( OR-ANI/ATION Data memory is made up of the !pecial Function Registers @!FRA area, and the =eneral *urpose Registers @=*RA area. The !FRs controls the operation of the de'ice, =*Rs are the general area for data storage and scratch pad operations. The data memory is ban&ed for both !FRs and =*R areas. =*R area is ban&ed to allow greater than 52 bytes of general purpose RA$ to be addressed. FR! is for the registers that control the peripheral and core functions. /an&ing re)uires the use of control bits for ban& selection. These control bits are
15
located in the !TAT.! register @!TAT.! K3C1BA.The entire data memory can be accessed either directly or indirectly. Direct addressing may re)uire the use of the R*6CR*7 bits. Indirect addressing uses the Indirect Register *ointer @IR*A bit of the !TAT.! register for accesses in the /an& OE/an& 6 or the /an& 8E/an& 9 areas of data memory. 'AN.INThe data memory is partitioned into four ban&s. #ach ban& contains =*Rs and !FRs. !witching between these ban&s re)uires the R*O and R*6 bits in the !TAT.! register to be configured for each ban& extends up to 3Fh @684 bytesA.The lower locations of each ban& are reser'ed for the !FRs. Abo'e the !pecial Function Registers are the =eneral *urpose Registers. All data memory is implemented as static RA$. !ome high use !FRs from /an& 7 are mirrored in the other ban&s for core reduction and )uic&er access.
PORTS =eneral purpose IEO pins can be considered the simplest of peripherals. They allow the *I to monitor and control other de'ices. To add flexibility and functionality to a de'ice, some pins are multiplexed with an alternate [email protected] general when a peripheral is functioning, that pin may not be used as a general purpose IEO pin. For most ports ,the IEO pin+s direction @input or outputA is controlled by the data direction register ,called TRI! register .TRI! KxB controls the direction of *ORTKxB .A +6+ in the TRI! bit corresponds to that pin being an input .while a +7+ corresponds to that pin being an output. The *ORT registers are the latch for the data to be output. ?hen the *ORT is read, the de'ice reads the le'els present on the IEO pins.
PORT A !n" TRISA RE-ISTER The RA0 pin is a !chmitt Trigger input and an open drain output. All other RA port pins ha'e TT; input le'els and full $O! output dri'ers. All pins ha'e data direction bits @TRI! registerA which can configures these pins as output or input. !etting a TRI!A register bit puts the corresponding output dri'er in a high impedance mode. learing bit in the TRI!A register puts the contents of the output latch on the selected pin@sA.
PORT ' !n" the TRIS' RE-ISTER *ORT/ is an 4:bit wide bidirectional port. The corresponding data direction register is TRI!/. !etting a bit in the TRI!/ register puts the corresponding output dri'er in a high impedance input mode. learing a bit in the TRI!/ register puts the contents of the output latch on the selected pin@sA. PORTC !n" the TRISC RE-ISTER
*ORT is an 4:bit bidirectional port. #ach pin is indi'idually configurable as an input or output through the TRI! register. *ORT pins ha'e !chmitt Trigger input buffers. ?hen enabling peripheral functions, care should be ta&en in defining TRI! bits for each *ORT pins. !ome peripherals o'erride the TRI! bit to ma&e a pin an input.
PORT# !n" the TRIS# RE-ISTER *ORTD is an 4:bit bidirectional port. #ach pin is indi'idually configurable as an input or output through the TRI!D register.
PORTE !n" the TRISE RE-ISTER *ORTD is an 4:bit bidirectional port. #ach pin is indi'idually configurable as an input or output through the TRI!# register.
PRO-RAMMA'LE INTERFACE CONTROLLER 0PIC1
*H( PIC IS USE#1 SPEE#2 ?hen operated at its maximum cloc& rate, a *I executes most of its instructions in .8 micro seconds or 1 instructions per microseconds. HI-H PERFORMANCE RISC CPU INSTRUCTION SET SIMPLICIT( The instruction set consists of (ust 91 instructions. INTE-RATION OF OPERATIONAL FEATURES *ower on reset and brown out protection ensure that the chip operates only when the supply 'oltage is within specificationL a watchdog timer resets the *I if the chip e'er malfunctions and de'iates from its normal operation. Any one of four cloc& options can be supported, including a low cost R oscillator and a high accuracy crystal oscillator.
17
PRO-RAMMA'LE TIMER OPTIONS2 Three 'ersatile timers can be characteri-ed inputs, control outputs and pro'ide internal timing for program executions. INTERRUPT CONTROL2 .ptol8 independent interrupt sources, which can pro'ide useful interrupting as when needed.
EPROM 3OTP 3ROM OPTIONS2 .ltra'iolet erasable, programmable parts support de'elopment. /oth small and lower cost one time programmable parts supports large production runs.
IN'ULT MO#ULES2 The *I microcontroller has a number of inbuilt modules such as AD , .!ART that increases 'ersatility of micro controller. LO* POER CONSUMPTION2 *I#E OPERATIN- 4OLTA-E RAN-E2 8.1 TO 2.7 4 PRO-RAMMA'LE CO#E PROTECTION MO#E2 PO*ER SA4IN- SLEEP MO#E2
PIC16F87, +++++++++++++++++ 6. %igh *erformance *. 8. Only 91 Instructions 9. All single cycle instructions expect program branches operating speed C D 87 $%- ,cloc& inputC D 877ns instruction cycle 0. .p to 4< J 60 words of flash program memory .p to 924 J 4 bytes of data memory @RA$A .p to 812 J 4 bytes of ##*RO$ data memory 1. *in out compatible to the *I 62 39/E30/E32E33 2. Interrupt compatibility @up to 60 sourcesA 3. *ower
n reset @*ORA 4. *ower:up timer @*?RTA and oscillator startup timer @O!TA 5. ?atch dog timer @?DTA with its own on:chip oscillator for reliable operation.
67.*rogrammable code protection power sa'ing sleep mode 66.;ow
ower ,%igh speed $O! Flash:##*RO$ technology 68.In circuit serial programming @I !*A DIA two pins 69.!ingle 1D in circuit serial programming capability 60.6n:circuits debugging DIA two pins 61.*rocessor readEwrite access to program memory 62. ?ide operating 'oltage range 63.%igh sin& or source current 64.;ow power consumption
PIN OUT OF PIC16F877A
PDIP
<NOT>MCLR/Vpp/THV RAO/AN 0 RA1/AN1 RA2/AN2/VrefRA3/AtJ3Mef+ RA4/T0CKI RA /AN4/<N0T>!! R"0/<NOT>RD/AN R"1/<N0T>#R/AN$ R"2/<NOT>C!/AN% V&& V'' 0!C1/CLKIN 0!C2/CLK0(T RCM10!0/T1CKI ) RC1/T10!I-/CCP2 RC2/CCP1 RC3/!CK*/!CL RDO/P!PO RD1/P!P1
PIC16F87 7
S(STEM FEATURES 6 8 9 0 1 2 *A!!?ORD *ROT# TIO, !#,!OR! R#;A"! <#"/OARD DI!*;A" DI!.A; I,DI ATIO,
*A!!?ORD *ROT# TIO, The system is fully password protected. A four digit password is used for the system. The password of the authori-ed persons is pre'iously stored in the ##*RO$. Only by the entry of the 'alid password the access into the room is accepted otherwise it will set out an alarm. On the entry of the password we get a single beep which indicates that the password entered is correct and the relay connected to the door latch is made to open immediately, which ma&es the door open. There is a pro'ision of three trials for entering the password beyond which an alarm is setout which indicate that an attempt for entry by an unauthori-ed person.
SENSORS As explained earlier, the system+s main consideration is effecti'e power management. For this it has to monitor and measure different parameters within the office so as to gi'e the corresponding intelligence to the microcontroller which ma&es different decisions which in turn controls the different electrical appliances inside the office .For this we use different sensors for measuring different parameters. The different types of sensors used are infrared diodes, temperature and light dependant resistors. All the abo'e sensors used here are highly sensiti'e and ha'e correctness in the infrared outputs, which is 'ery reliable. #ach of them is calibrated according to our needs. INFRARE# #IO#ES Infrared diodes are similar to the normal diodes. Infra red diodes emit infrared rays instead of light in the case of ;#Ds. In this system they are used for finding count of the persons entering or lea'ing the room. %ere two infrared diodes are used named infrared A and infrared /. They are placed immediately after the door. The sensor near to the door is ta&en as sensor A and that placed far from the door is ta&en as sensor /. the sensor A and / are placed at a distance of about lm. The infrared diodes acts as a transmitter circuit and the photo detectors are placed at the other end of the infrared diodes, which acts as the recei'er circuit. The rays from the infrared diodes are focused on to the photo diodes. ?hene'er the ray cuts between infrared diode and photo diode, a signal is gi'en to the microcontroller. An entry is detected when the sensor A cuts first and then sensor /. Otherwise an exit is detected if sensor / cuts first and then sensor A.
LI-HT #EPEN#IN- RESISTOR
Another sensor used in this system is ;DR, which detects the illumination in a particular area. In presence of light the resistance of the sensor goes into a range of mega ohms. In the absence of light the resistance of the sensor falls to a few ohms thereby changing the conducti'ity of current. The ;DR is suitably calibrated such a way that if the luminance inside the room is below a specified 'alue it gi'es out a signal to the microcontroller, which ta&es the decision +put O, the light+.
RELA(S Relays are used here as dri'er for the different electrical appliances so as to ma&e the de'ice O, or OFF. The help of relays can pro'ide sufficient amount of isolation for the system from the line 'oltage. !ince the microcontroller cannot directly pro'ide sufficient dri'e to the relays 68' supplies are used for dri'ing he relays. .E('OAR#
This is the only human machine interface of the system. The &eyboard is normally a 9J0 matrix type. ,ormally a telephone &eypad is used. The &eypad has an electronic circuitry to determine which &ey is pressed. Then a standard 4:bit code is generated and sends to the *I . Detecting which &ey is pressed and generating the corresponding code is &nown as encoding. %ere it is used for the password entry and it+s editing.
#ISPLA( This system uses three segment dynamic displays for displaying the number of persons inside the room in the run mode. ?hene'er the infrared rays are cut which detect an entry or exit it gi'es the signal the signal to the microcontroller, which in turn decrements a register. This count is con'erted to decimal format by the subroutine and is displayed on to the displays.
IN#ICATIONS DI!.A; I,DI ATIO,! There are fi'e different ;#Ds. 6. 8. 9. 0. 1. <eyboard chec& Right password ?rong password ;ight Fan
.E( 'OAR# <ey board is the only human interface to the system. %ere we are using a numeric &ey pad .An employee enters his password through this &ey board .<ey board is interfaced to the system through *ORT/.R/7:R/9 are configured as output. Remaining pins are configured as input.
figC &eyboard connection
*ressing a &ey causes a change in the amount of current flowing in the circuit associated with that &ey. /y detecting the increase and decrease in current the microcontroller that is constantly scanning the &eyboard can detect when a &ey is pressed and when it has been released. %ere we initially place -ero to one of the row and one to all columns. Then we read the columns. ?hen any one of the &ey is pressed the corresponding column 'alue goes low and the &ey press is detected. The 'alue gi'en to the row is rotated and the abo'e process continues until a &ey press is detected. 3 !#=$#,T DI!*;A" A'ery common re)uirement in modern electronics is that of displaying alphanumeric characters. Digital watches, calculators, digital multimeters are examples of de'ices that ma&e use of such displays. The best &nown type of alphanumeric display is the se'en segment display that consists of se'en independently accessible photoelectric segments such as ;#Ds or ; Ds arranged in the form shown in the figure.
-23-
figC se'en segment display
The segments are named from a to g in the manner shown in figure and it is possible to display any number from 7 to 5 or alphabetic character from A to F by acti'ating the signals to 'arious combinations to produce a one, segments b and c are energi-edL to produce a 8 ,segments a, b, g, e, and d are use dL and so on One common type of se'en segment display consists of ;#Ds .#ach segment is an ;#D that emits light when current flows through it. There are two types of displays a'ailable : common anode arrangement and common anode arrangement. ommon anode arrangement re)uires a dri'ing circuit to pro'ide a ;O? le'el 'oltage in order to acti'ate a gi'en segment. ?hen a ;O? is applied to a segment input, the ;#D is forward biased and current flows through it. The common cathode arrangement re)uires a dri'ing circuit to pro'ide a high le'el 'oltage in order to acti'ate a gi'en segment. ?hen a %I=% is applied to a segment input , the ;#D is forward biased and current flows through it.
figC common cathode internal wiring
Lect5re 7) #i it!% #i6p%!7
Binary num !r" ar! n!#!""ary$ u% &!ry 'ar( %) r!a( )r in%!r*r!%+ W'a% i" a&ai,a ,! %) (i"*,ay inary %) (!#ima, in-)rma%i)n. A seven se!"en# L$E$D$ %&s'()*$ A "!&!n-"!/m!n% (i"*,ay may 'a&! 3, 4, )r 5 ,!a(" )n %'! #'i*+ U"ua,,y ,!a(" 4 an( 5 ar! (!#ima, *)in%"+ T'! -i/ur! !,)0 i" a %y*i#a, #)m*)n!n% an( *in ,ay)u% -)r a "!&!n "!/m!n% (i"*,ay+
r-c$s DA.
+1 frf
-a.::r
PIN ASSIGNMENT
+,-(& .1/N(0(1237' 4
) % 5 +i 1 " ! r 2 3
3 SEGMENT 4ISPLA5
T'! ,i/'% !mi%%in/ (i)(!" in a "!&!n-"!/m!n% (i"*,ay ar! arran/!( in %'! -i/ur! !,)0+
6
A
4IO4E PLACEMENT IN A SE7EN SEGMENT 4ISPLA5$ NO 4ECIMAL T'!r! ar! %0) %y*!" )- (i"*,ay" a&ai,a ,!$ #)mm)n an)(! an( #)mm)n #a%')(!+ T'! 0irin/ -)r a #)mm)n an)(! i" "')0n !,)0+
1
COMMON ANO4E INTERNAL WIRING
T'! %ru%' %a ,! "')0n !,)0 i" u"!( %) #)n-irm %'a% %'! (i/i%a, "i/na, "!n% %) %'! (i"*,ay ,i/'%" u* %'! #)rr!#% "!/m!n%+
TRUT8 TABI9 In*u%" LE : : ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; 1 BI LT 4 : ; : C : 1 1 ; 1 1 ; 1 1 ; 1 1 ; 1 1 ; 1 1 1 Ou%*u%"
c
: : ; ; ; ; 1 1 1
B : = ; ; 1 1 ; ; 1 1 ; ; 1 1 ; ; 1 1 :
A : : ; 1
a
1 ; 1 ; 1 1 ; 1
# 1
( 1 ; 1 ; 1 1 ; 1 1 ; 1 ; ; ; ; ; ; ; 5
a 1 ; 1 ; ; ; ; ; 1 ; 1
I@
1 # 1 ; ; ; 1 1 1 ; 1 1 ; ; ; ; ; G
9
1 ; ; ;
4i"*,ay < B,an> ; 1 2 3 1 5 ? 7 < y B,an> B,an> B,an> B,an> B,an> B,an>
8
c
1 1 1 1 1 1
6
1 1
6
1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 :
6
; 1 ; 1 % 1 ; ; ; ; ; ;
6
; ;
6 6 6
1 1 ;
6
1
; ; ;
i
A
6
1
!
6
; 4 ; ; 1 1 1 1 :
1
1 1 ; ; ; ; ; ;
1 1 1 1 1 1 1 1
6
1 ; ; ;
1 ; ? ; ; ; ;
; ; ; ; ; ;
1
1 1 1 1 1
% I
1 1 1 1
1 1 1 1 1 :
-%
; ;
: - 4)iAB% Car!
B4!*!n#" u*)n %'! BC4 #)(! *r!&i)u",y a**,i!( 0'!n IE C 0
TR.T% TA/;# FOR T%# !#D#,:!#=$#,T DI!*;A" The internal circuitry and logic gates for the display is shown below.
INTERNAL CIRCUITR5 AN4 LOGIC GATES 9OR 7 !#= DI!*;A"
T'! 0irin/ -)r %'! #)mm)n #a%')(! i" "')0n !,)0+
X
COMMON CAT8O4E INTERNAL WIRING T) #)n&!r% %'! inary num !r" %) "i/na," %'a% #an (ri&! %'! L+E+4+" in %'! (i"*,ay y)u n!!( a (i"*,ay (ri&!r+ In %'! ,a 0! u"! an MC11516 #'i*+ T'! *in)u%" ar! "')0n !,)0+
1
4-
,-f.
MB......:
9
-a 6 68 11 1< an
69 1+: 1; -a
U17 B C LT B, LE 4 A GN4 MC60166 7##
/ a
# ( !
PINOUTS 9OR T8E MC11511 SE7EN-SEGMENT 4ISPLA5 4RI7ER A$ B$ C$ an($ 4 ar! %'! inary in*u%"+ a$ $ #$ ($ !$ -$ an( / ar! %'! (ri&!r "i/na," %) %'! (i"*,ay !,!m!n%"+ LT i" %'! Li/'% T!"% #)n%r),$ %urn" a,, "!/m!n%" )n$ a#%i&! ,)0+ BL ,an>" a,, %'! "!/m!n%" 0'!n a#%i&a%!($ a#%i&! ,)0+ LE i" %'! ,a%#' !na ,! #)n%r),+
T'! "*!#i-i# "!&!n-"!/m!n% (i"*,ay u"!( in ,a i" an LN513RD+ T'! "#'!ma%i# !,)0 i" "imi,ar %) %'! )n! y)u 0i,, u"! in ,a + vcc
6 2 6 9 6 8 6 6 6 7
1 1
)LT
B,
6 6
60
GN4
$ I 02660s c(
t
g
L4P SE7SEG
E AM
la I o
AT8
l.N 66
R4I-B
SE7EN SEGMENT 4ISPLA5 WIT8 4ISPLA5 4RI7ER T) 'a&! %'! (ri&!r #)n&!r% %'! inary in*u% %) "i/na," r!a(y -)r %'! (i"*,ay$ %i! *in 3$ LT$ an( *in 1$ B,$ %) 7CC+ C)nn!#% *in 5$ LE$ %) /r)un(+ In %'i" #)n-i/ura%i)n 0'a% !&!r %'! inary in*u%" a% A-4 ar! 0i,, ! #)n&!r%!( an( %'! (i"*,ay 0i,, "')0 %'! (!#ima, !Fui&a,!n%+ COUNTING ;-3 < + = circ5it
2Y
2A
2B 2C
in
LE GND
16
I G@
16
20
1/ 12 11 81+ 4 10
1 i
12 1+ 6
+ + +GGi+r
CL C$L$ K LD TE PL P6 P/ P. P1 71 72 7/ 76 CO
1Y
1A 1B 1C ID
#
%
) 9
e1
CAT6 CAT/ CAT2 CAT1 RDP
LDP
;-3 COUNTING CIRCUIT T'! "%ar% )- %'i" #ir#ui% i" %'! MC111?1 inary #)un%!r+ T'! -un#%i)n /!n!ra%)r i" #)nn!#%!( %) %'! #,)#> in*u% %) "%ar% %'! #)un%in/ #y#,!+ T'! MC11;12 NAN4 /a%! m)ni%)r" %'! )u%*u% )- %'! inary #)un%!r+ W'!n %'! #)un% !Fua," 3 %'! )u%*u% )- %'! NAN4 /a%! "!n(" a "i/na, %) %'! ,)a( #)n%r),$ L4$ )n %'! #)un%!r %) ,)a( %'! &a,u!" )n P1-P1$ in %'i" #a"! %'! num !r H!r)+ A" %'! #)un%!r i" in#r!m!n%in/ -r)m ;-3 %'! (ri&!r "i/na, i" #)n"%an%,y u*(a%in/ %'! (i"*,ay an( %urnin/ )n an( )-- %'! a**r)*ria%! "!/m!n%"+ I- n!!( ! y)u #)u,( u"! a 555 %im!r #ir#ui% in *,a#! )- %'! -un#%i)n /!n!ra%)r+
SET R 1C; R2C; R3C; R1C; R5C; +LE4 ON
I
INCREMENT COUNT
4ECREMENT COUNT
1
6 CON7ERT COUNT 9ROM 8E: TO 4ECIMAL+
r
4ISPLA5 COUNT
9AN ON
% LIG8T O99
I GGGGGGGGG @+
"
rN
PRO-RA M
i
1
I L.*rogram for office automation
66
;I!T *H*I 62F433 OI, ;.D#P*62F433.I, P /;O < 7F87 F I F8 F9 F0 "l "8 "9 "0 Rl Ldeclaring registers
II
I
II II
R8 R0 R1 I R2 R#= ! I !8 T l
;OO<
I
!67 ! l l #,D OR= 7 L starting of the program ,O* ,O* ,O* =OTO /#=I, ADD?F * ;,6 R#T;? /+76666667+ R#T;? /+76677777+ R#T;? /+67667667+ R#T;? /+67766667+ R#T;? /+l 6776677+ R#T;? /+l 6766767+ Lloo&up table for se'en:segment display R#T;? /+l 6666767+
I
Q li
I II ,, iJ
I II I I
R#T;?/+77776667+ R#T;? /+l 6666667+ R#T;? /+l 6766667+ /#=I, ;RF *ORT/ ;RF *ORTA ;RF *ORT ;RF *ORTD ;RF *ORT# ;RF ! I ;RF R0 ;RF R1 ;RF R2 ;RF T l ,, II ;RF R0 ;RF R1 ;RF R2 $OD;? D+75+ $OD?F F I $OD;? D+71+ $OD?F F8 $OD;? D+OF $OD?F F9 $OD;? D+79+ $OD?F F0 / F !TAT.!,2 /!F !TAT.!,1 $OD;? /+l 6667777+ $OD?F TRI!/ / F O*TIO, R#=,3 / F TRI!A,1 $OD;? 7F73 $OD?F AD O,6 / F !TAT.!,2 K / F !TAT.!,1 $OD;? /+77776666+ $OD?F *ORT/ ;RF *ORTA ;RF *ORT/ ;RF *ORT
Lstoring user password
clearing *ORT! onfiguring *ORT / as half input and half oEp
CLP$F PORT# CLRF PORTE
/!F *ORTA,1 $OD;? /+l 6667666J $OD?F *ORT/ /TF!! *ORT/,0 =OTO O,# /TF!! *ORT/,1 =OTO T?O /TF!! *ORT/,2 =OTO T%R## $OD;? /+l 666 6766+ $OD?F *ORT/ /TF!! *ORT/,0 =OTO FO.R /TF!! *ORT/,1 =OTO FID# /TF!! *ORT/,2 =OTO !IF $OD;? /+l 6666676+ $OD?F *ORT/ /TF!! *ORT/,0 =OTO !#D#, /TF!! *ORT/,1 =OTO #I=%T /TF!! *ORT/,2 =OTO
,I,# $OD;? /+l 6666667+ $OD?F *ORT/ /TF!! *ORT/,1 =OTO G#RO /TF!! *ORT/,3 =OTO #,T#R =OTO !TART /TF!! *ORT/,0 =OTO O,# $OD;? D+76+ $OD?F Rl
I
pressing fi'e Lchec&ing for L chec&in g for Lchec&ing for pressing se'en Lchec&ing for pressing eight Lchec&ing for pressing nine pressing six
pressing one Lchec&in g for
Lchec&ing for pressing -ero Lchec&ing for pressing enter
pressing two Lchec&in g for
pressing three
Lstoring the number,blin&ing ;#D,exchang A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,1 =OTO T?O $OD;? D+78+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,2 =OTO T%R## $OD;? D+79+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART
L chec&in g for /TF!! *ORT/,1 =OTO FID# $OD;? D+71+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,2 =OTO !IF $OD;? D+72+ $OD?F R l A;; /;I,< /TF!! *ORT/,0 =OTO FO.R $OD;? D+70+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART
pressin g four Lchec&i ng for
I
Lstoring the number,blin&ing ;#D,exchanging Lstoring number,blin&ing ;#D,exchanging the
Lstoring the number,blin&ing ;#D,exchanging
Lstoring number,blin&ing ;#D,exchanging
the
Lstoring the number,blin&lng ;#D,exchanging A;; #F %A,=# =OTO !TART /TF!! *ORT/,0 =OTO !#D#, $OD;? D+73+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,1 =OTO #I=%T $OD;? D+74+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,2 =OTO ,I,# $OD;? D+75+ $OD?F R l
Lstoring the number,blin&ing ;#D,exchanging
Lstoring the number,blin&ing ;#D,exchanging
Lstoring the number,blin&ing ;#D,exchanging
I
A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,1 =OTO G#RO $OD;? D+OO+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,3 =OTO #,T#R A;; /;I,< $ODFF6,7 !./?F "6,7
Lstoring the number,blin&ing ;#D,exchanging
/TF!! !TAT.!,8 =OTO !TART $ODF F8,7 !./?F "8,7 /TF!! !TAT.!,8 =OTO !TART $ODF F9,7 !./?F "9,7 /TF!! !TAT.!,8 =OTO !TART $ODF F0,7 !./?F "0,7 /TF!! !TAT.!,8 =OTO !TART =OTO O*#,
Lchec&ing the entered password
Lwrong password,reentering Lopening the door
password
/;I,< / F !TAT.!,2 /!F !TAT.!,1 / F TRI!A,1 / F !TAT.!,2 / F !TAT.!,1 /!F *ORTA,1 / F !TAT.!,2 /!F !TAT.!,1 Lblin&ing ;#D for a &eypress $OD;? /+77777666+ $OD?F O*TIO,R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+76+ Ldelay for ;#D
I
P $OD?F T$RO FF $ODF T$R7,7 /TF!! !TAT.!,8 =OTO FF / F *ORTA,1 R#T.R, #F %A,=# $ODF "8,7 $OD?F " l $ODF "9,7 $OD?F "8 $ODF "0,7 $OD?F "9 $ODF R 6,7 $OD?F "0 R#T.R, exchanging the entered password
/ F !TAT.!,2 /!F !TAT.!,1 / F TR.I !A, 6 Lopening the door / F !TAT.!,2 / F !TAT.!,1 /!F *ORTA, 6 L !#,!I,= !# TIO, / F !TAT.!,2 /!F !TAT.!,1 / F TRI! ,8 /!F TRI!D,7 /!F TRI! .0 / F !TAT.!,2 / F !TAT.!,1 /!F *ORT ,8 / F !TAT.!,2 /!F !TAT.!,1 $OD;? / + O O O O O l l l + $OD?F O*TIO, R#= / F TRI!#,8 / F !TAT.!,2 / F !TAT.!,1 $OD;? D+61+ $OD?F R#= $OD;? DT+ $OD?F T$RO $ODF T$R7,7 /TF!! !TAT.!,8 =OTO /D D# F!G R#=,6 =OTO ;A! /!F *ORT#,8 A;; DI!*;A" / F !TAT.!,2 /!F !TAT.!,1 /!F TRI!D,7 /!F TRI! ,0 / F !TAT.!,2 / F !TAT.!,1 A;; DI!*;A" /TF! *ORTD,7 =OTO GG A;; D#;A" 6 /TF!! *ORTD,7 =OTO AA =OTO GG A;; DI!*;A" /TF! *ORT ,0 =OTO AA A;; D#;A" 6 /TF! *ORT ,0 =OTO AA I, F ! l , l A;; D#;A"1 A;; DI!*;A" =OTO GG A;; DI!*;A" /TF! *ORT ,0 =OTO "" A;; D#;A" 6 /TF!! *ORT ,0 =OTO // =OTO "" A;; DI!*;A" /TF! *ORTD,7 =OTO // A;; D#;A" 6 /TF! *ORTD,7 =OTO // $ODF !6,7
I
L chec&ing for entry incrementing sensing register
displaying count L chec&ing for entry
Lchec&ing
for
exit
Lchec&ing for exit Lchec&ing for entry Lchec&ing for exit
Lchec&ing for entry
Lchec&ing for exit
/TF! !TAT.!,8 =OTO ;O!# $OD?F ! I D# F !6,6 Ldecrementing sensing registor A;; D#;A"1 A;; DI!*;A" =OTO "" D#;A" 6 / F !TAT.!,2 /!F !TAT.!,1 $OD;? /T 7777666+ $OD?F O*TIO, R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+810+ L87 micro second delay $OD?F T$RO $ODF T$R7,7 /TF!! !TAT.!,8 =OTO R#T.R, DI!*;A" ;RFR0 ;RF R1 ;RF R2 / F !TAT.!,2 /!F !TAT.!,1 $OD;? /+77777776+ $OD?F TRI!D $OD;? /+77766766+ Lhex to decimal con'ersion $OD?F TRI! / F !TAT.!,2 / F !TAT.!,1
I
$OD;? DT 77+ $OD?F !8 ;RF R0 $ODF !6,7 $OD?F ! l l DD $ODF !8,7 !./?F ! I 6,6 I, F R0,l /TF! !TAT.!,7 =OTO DD D# F R0,l $OD;? 7F20 ADD?F ! I 6,6 $OD;? 7F7A $OD?F !8 ;RF R1 !./?F ! I 6,6 I, F R1,l /TF! !TAT.!,7 =OTO ## D# F R1,l ADD?F ! I 6,7 $OD?F R2 $OD;? D+1+ $OD?F !67 / F !TAT.!,2 /!F !TAT.!,1 / F TR6! ,1 / F TRI! ,2 / F TRI! ,3 / F !TAT.!,2 / F !TAT.!,1 /!F *ORT ,1 / F *ORT ,2 / F *ORT ,3 $ODF R0,7 A;; ;OO< $OD?F *ORTD A;; D#;A"8 / F *ORT ,1 / F *ORT ,3 /!F *ORT ,2 $ODF R1,7 A;; ;OO< $OD?F *ORTD A;; D#;A"8 / F *ORT ,2 / F *ORT ,1
II II
II
##
Ldisplaying 1 times
!!
displaying count on 3 segment
I
II II II
/ F *ORT#,7 / F *ORT#, 6 $ODF !6,7 /TF! !TAT.!,8
/!F *ORT ,3 $ODF R2,7 A;; ;OO< $OD?F *ORTD A;; D#;A"8 / F *ORT R / F *ORT ,2 / F *ORT ,1 D# F!G !I7,6 =OTO !! ,O*
,J I
II
R#T.R,
/ F !TAT.!,2 /!F !TAT.!,1 / F TRI!#,7 / F TRI!#, 6 /!F TRI!A,7 $OD;? 7F73 $OD?F AD O, 6 /!F TRI!A,0 /!F TR6!A,7 / F !TAT.!,2 / F !TAT.!,1 $OD;? /+l7777776+ $OD?F AD O,7
LAD for temperature sensing
I
/ F !TAT.!,2 /!F !TAT.!,1 $OD;? /+77777666+ $OD?F AD O,6 $OD;? /+l7777666+ $OD?F O*TIO, R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+811+ L97 micro second delay $OD?F T$R7 $ODF T$R7,7 /TF!! !TAT.!,8 =OTO FF /!F AD O,7,8 /TF! AD O,7,8 =OTO S:6 $ODF ADR#!%,7 $OD?F T l $OD;? D+97+
I
!./?FT6,7 /TF! !TAT.!,7 =OTO O, =OTO OFF /!F *ORT#,7 =OTO ;I=%T / F *ORT#,7 =OTO ;I=%T /TF!! *ORTA,0 =OTO O,; =OTO OFF; /!F *ORT#, 6 =OTO R#D / F *ORT#, 6 =OTO R#D ,O* R#T.R,
Ltemperature chec&ing
Lpowering on fan
Lpowering off fan
Lchec&ing light
Lpowering on the light
Lpowering off the light
/ F !TAT.!,2 /!F !TAT.!,1 $OD;? /J 67777666+ $OD?F O*TIO, R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+817+ $OD?F T$RO RR $ODF T$R7,7 /TF!! !TAT.!,8 =OTORR ,O* R#T.R, / F !TAT.!,2 /!F !TAT.!,1 / F TRI!A,6 / F TRI!#,7 / F TRI!#,67 / F !TAT.!,2 / F !TAT.!,1 / F *ORTA, 6
L 6 millisecond delay
;O!#
Lclosing door,fan and light
I
/ F *ORT#,7 / F *ORT#, 6 =OTO "" D#;A"1C / F !TAT.!,1 $OD;? D+2+ $OD?F I A=AI,8C $OD;? DT $OD?F T$RO /!F !TAT.!,1 $OD;? /+77777666+ $OD?F O*TIO,R#= / F !TAT.!,1 $ODF T$R7,7 /TF!! !TAT.!,8 =OTO S:8 D# F!G . =OTO A=AI,8 R#T.R, ,O* #,D
L177$ !# D#;A"
CONCLUSION AN# FUTURE SCOPE
*hen %i$e in ! "7n!&ic >or%" o? ?!6t ch!n in technic!% ?rontier6, the con$ention!% 676te&6 !re @ein rep%!ce" @7 6ophi6tic!te" !n" !"$!nce" techno%o ie6) .eepin the %!te6t !n" tren"6 I &in", the "e6i ne" pro"5ct i6 !n inno$!ti$e one to ?!ci%it!te6 the !5to&!tion reA5ire&ent6 o? !n o??ice)
E
The "r!>@!cB6 o? the eCi6tin &!n5!% 676te& in o5r o??ice6, >hich in$o%$e6 >!6t! e o? e%ectricit7 "5e to in e??icient oper!tion o? ?!n6 !n" %i ht6, c!n @e 6o%$e")
The 6!%ient ?e!t5re6 o? the 676te& !re
T T
Entr7 !n" ECit checB S>itchin ON !n" OFF o? %i ht6 !n" ?!n6 !6 reA5ire" T It c!n @e e!6i%7 "e$e%ope" !n" pro r!&&e" to ?it the reA5ire&ent6 o? "i??erent o??ice6
I
The 6cope o? ?5t5re %ie6 in the ?!ct th!t >e h!$e not con6i"ere" th!t the centr!%iDe" %i ht !n" ?!n 676te& c!n @e &!"e "ecentr!%iDe" on the @!6i6 o? the n5&@er o? ch!ir6 occ5pie" in the o??ice) The 676te& i6 eCpecte" to @e >i"e%7 !ccepte" "5e to technic!% e??icienc7 !n" !"!pt!@%e n!t5re)
REFERENCES 6.PDesign with *I $icrocontrollersP Rohn /. *eatmann, 1th Indian reprint 8.PAssembly language programming with *I P /. R. %aris and ?olf, *enram Ul International *ublications UU 9. www.picboo&.com 0.www.atnel.com v 1. www.microchip.com UU 2.www.microcontroller.com , 3.www.electronicsforyou.com
% i I I
I I
I K i
I I
I I
lU
Office Automation
I i
doc_703986305.doc
The embedded system is a combination of hardware, software and additional mechanical parts designed to perform a specific function. A good example is the ROAD TRAFFI !"!T#$. %ere the traffic signal changes periodically according to a predetermined program that is fed into the I . !o an embedded system is designed to do a specific tas& with in a gi'en time repeatedly, endlessly and with or without human inter'ention. The pro(ect 'OFFICE AUTOMATION' is based on embedded technology that uses MICROCHIP'S PIC MICROCONTROLLER, PIC16F877 This has 'ery much influence in industrial application. The chip is programmed according to the re)uirement of the user. *rogram coding is done using assembly language. Microchip+s Inte r!te" #e$e%op&ent En$iron&ent MPLA' is used to simulate and assemble the written code. ,ew millennium gi'es importance to 'arious ad'anced automation technologies in 'arious phases of human life. The OFFICE AUTOMATION S(STEM is a uni)ue 'enture, which gi'es a complete automation and security for an office building. It not only automates 'arious utilities but also sa'es a good amount of con'entional electrical energy by switching off the electrical appliances, which is not effecti'ely utili-ed. The e)uipment allows automation for doors, fan and lighting de'ices. !o the main concern of this pro(ect is conser'ation of the con'entional electrical energy and its efficient usage and pro'ides security of the office. It monitors an authori-ed entry to the office with real time sur'eillance system. Acti'e IR sensors sense the entering or lea'ing of persons to the office or from the office. An intelligent display gi'es the current count of the persons inside the office. .nwanted use of electrical e)uipments are monitored and controlled by sensors. Once the system is installed there is no need of any human interface except for the password entry. This reduces the chance of unauthori-ed entry and theft. /y using the micro controller the hardware expense is reduced. It is 'ery simple to install and easy to maintain. This system is highly reliable, cost effecti'e and compact in si-e. All these ha'e been enhanced by the use of micro controller.
CONTENTS
I)
A'STRACT
8. 9.
I,TROD. TIO, /;O < DIA=RA$
0. 1. 2. 3. 4. 5.
FLO* CHART A'OUT PIC+THE 'RAIN OF THE S(STEM *H( PIC IS USE# A'OUT PIC 16F87, S(STEM FEATURES PRO-RAM
67. CIRCUIT #IA-RAM
II) #ATASHEET
68. CONCLUSION 69. 'I'LIO-RAPH(
A'STRACT
,ew millennium gi'es importance to 'arious ad'anced automation technologies in 'arious phases of human life. The automatic office management system is a uni)ue 'enture, which gi'es a complete automation and security for any office building. It not only automates 'arious utilities but also sa'es a good amount of power by switching off electrical appliances, which is not effecti'ely utili-ed. The e)uipment allows automation for doors, fan and lighting de'ices. It monitors unauthori-ed entry to the office with real time sur'eillance entry to the office with real:time arbitration process, allows precision and error free
sensing of instructions. An intelligent display gi'es the current count of the people inside the office. .nwanted use of electrical e)uipments are monitored and controlled by built in light.
INTRO#UCTION
The new millennium gi'es top priority for energy management and effecti'e utili-ation of generated electrical power. It is studied that more than 07> of the total electrical power generated is wasted due to improper monitoring or consumption. As we see in most of the offices most of the electrical appliances li&e fan, lights will be left O, from day brea& to e'ening e'en if the personnel+s are not in the infra red seta. It becomes difficult for them to switch it O, or OFF all the appliances before they lea'e or enter the office. As a result a huge amount of energy is wasted. $oreo'er the need ensuring security is recei'ing a 'ital importance in our day:to:day life. It is essential to ensure security in factories, ban&s, and confidential areas of research centers, power plants etc /ut now in these areas the tas& of maintaining security has become an enormous technological challenge. This pro(ect pro'ides efficient security and a'oids the chance of unauthori-ed entry. The office management system is a ,o'ell networ&, which considers the abo'e concepts and monitors inefficient use of electrical energy using embedded systems. #mbedded system is one of the fast emerging trends in our day:to:day life, which has been gi'en more importance and popularity since the past decade or two. It has ta&en into 'arious fields of life. It ranges from small toys to sophisticated control and functioning of machines. #mbedded system is basically a combination of hardware and software systems. Depending on the input recei'ed we can control or operate different output de'ices with the help of software written on to the system depending on our needs. These programs can then be upgraded for more functioning which will be needed later. . ?ith the help of an embedded system here a design for an office management is being de'eloped. The main concern of the pro(ect is conser'ation of the con'entional electrical energy and its efficient usage and pro'ides security of the office. The core of the system is a flash memory programmed micro controller. The system
employs a 'ariety of sensors, which are used to measure the different parameters inside the office, and they pro'ide the information to the micro controller. The system pro'ides a 'ariety of sensors, which are used to measure the different parameters inside the office and they the information to the micro controller through their corresponding hardware. $ain steps of the sensors used are for sensing the luminance, temperature, presence of occupants etc, depending on the status obtained from the sensors the micro controller decides to switch OFF . the electrical e)uipments li&e fans, lights, when they are not needed as they are pre


7 SEGMENT DISPLAY
KEYBOARD
LDR PIC16F877
— DRIVER
FAN
IR SENSOR 1
— DRIVER
IR SENSOR 2 THERMISTOR
LIGHT
'LOC. #IA-RAM
FEATURES
B The system conser'es con'entional electrical energy.
B *ro'ides security for the office.
B This system reduces the chance of unauthori-ed entry to the office and theft.
B Acti'e IR sensors allow precision and error free sensing.
B An intelligent display gi'es the current count of the persons inside the office.
B .nwanted use of electrical e)uipments are monitored and controlled by sensors. B !ystem offers password protection.
B A 0x0 &eyboard is used for entering password.
B It is simple to install and easy to maintain.
B This system is highly reliable and cost effecti'e.
STU#( OF PIC MICROCONTROLLER
*I micro de'ices are grouped by the si-e of their instruction word. The three current *I micro families areC /ase:;ine C 68:bit instruction word length $id: Range C 60:bit instruction word length %igh:#nd C 62:bit instruction word length
D#DI # !TR. T.R# #ach part of a de'ice can placed into one of three groupsC 6. ore 8. *eripherals 9. !pecial Features T%# OR# The core pertains to the basic features that are re)uired to ma&e the de'ice operate. These includes 6. De'ice Oscillator 8. Reset ;ogic 9. *.@ entral *rocessing .nitA 0. A;.@Arithmetic ;ogic .nitA 1. De'ice memory map organi-ation 2. Interrupt Operation 3. Instruction set re'ision
:5:
*#RI*%#RA;! *eripherals are the features that add a differentiation from a microprocessor. These ease in interfacing to the external world @such as general purpose IEO, ; D dri'ers, AED inputs, and *?$ outputsA,and internal tas&s such as &eeping different time bases@such as timersA.The peripherals areC 6. 8. 9. 0. 1. 2. 3. TI$#RO TI$#R 6 TI$#R8 AD IEO *ORT! .!ART *
!*# IA; F#AT.R#! !pecial features are the uni)ue features that help to decrease system cost or increase system reliability or increase system flexibility. The *I microcontrollers offer se'eral features that help to achie'e these goals. The special features discussed areC 6. 8. 9. 0. 1. De'ice configuration bits On:chip *ower:On Reset@*ORA /rown:Out Reset@/ORA ;O=I ?atchdog timer ;ow power mode @sleep modeA
VDD
MCLR INTERNAL PGR PWR PWRT TIME-OUT OST TIME-OUT INTERNA L RESET "
OSCILLATOR The internal oscillator circuit is used to generate the de'ice cloc&. The de'ice cloc& is re)uired for the de'ice to execute instructions and for the peripherals to function. Four de'ice cloc& periods generate one internal cloc& cycle. There are up to eight different modes which the oscillator may ha'e. There are two modes which allows the selection of the internal R oscillator cloc& out @ ;< O.TA to be dri'en on an IEO pin, or allow that IEO pin to be used for a general purpose function. The oscillator mode is selected by the de'ice configuration bits. The de'ice configuration bits are non'olatile memory locations and the operating mode is determined by the 'alue written during de'ice programming. The oscillator modes areC 6 ;* ;ow fre)uency @*owerA rystal 8 FT rystal E Resonator 9 %! %igh !peed rystal E Resonator 0 R #xternal Resistor E apacitor @same as #FTR with ;<O.TA 1 #FTR #xternal Resistor E apacitor 2 #FTR #xternal Resistor E apacitor with ;<O.T 3 I,TR Internal 0$%- Resistor E apacitor 4 I,TR Internal 0$%- Resistor E apacitor with ;<O.T STATUS RE-ISTER /it 3 addressingA The status register contains two bits @TO and *DA, which when used in con(unction with the * O, register bits pro'ide the user with enough information to determine the cause of the reset. IR*R*6R*O67*DGD RE?:7 RE?:x /it 3RE?:7 2RE?:7 1R:6 0R:6 9R3?:8x RE? 6:x
/it
:66:
IR*C Register /an& !elect /it @used for indirect /it 2C 1 addressingA
lH/an& 8, 9 @lOOh:lFFhA 7H/an& 7, 6 @lOOh:FFhA For de'ices with only /an& 7 and /an& 6 the IR* bit is reser'ed, always maintains this clear R*6C R*OC Register /an& !elect /its @used for direct 6 6 H /an& 9 @647h:lFFhA 6 7 H /an&8@677h:63FhA 7 6 H /an& 6 @47h:FFhA 7 7 H /an& 7 @77h: 3FhA #ach ban& is 684 bytes. For de'ices with only /an& 7 and /an& 6 the IR* bits is reser'ed, always maintain this bit clear.
/it 0 instruction
TOC Time:Out bit 6 H after power up, ;R?DT instruction or sleep 7 H A ?DT time out occurred.
/it 9
*DC *oer

/it 8
:5: 7 H by execution of the !;##* instruction. GC Gero bit 6 H the result of an arithmetic or logic operation is -ero. 7 - the result of an arithmetic or logic operation is not
-ero. /it 6 D C Digit carry E /orrow bit @ADD?F, ADD;?, !./?F, !./;? instructionsA @for borrow the polarity is reser'edA 6 H A carry out from the 0th low order bit of the occurred. 7 H ,o carry out from the 0th low order bit of the result. C arry E /orrow bit @ADD?F, ADD;?, !./?F, !./;? instructionsA 6 H A carry out from the most significant bit of the result occurred. 7 H ,o carry out from the most significant bit of the result occurred @means the result is negati'eA
/itO
ARCHITECTURE The high performance of the *I micro de'ices can be attributed to a number of architectural features commonly found in RI! microprocessors. 6 %ardware architecture 8 ;ong word instructions 9 !ingle word instructions 0 !ingle cycle instruction 1 Instruction pipelining 2 Reduced instruction set 3 Register file architecture 4 Orthogonal @symmetricA instructions
13
%iiulwtiie Architecture
OPTION RE- RE-ISTER The O*TIO,IR#= register is a readable and writable register which contains 'arious control bits to configure the T$RO E ?DT prescalar ,the external I,T interrupt ,T$R7 ,and the wea& pull:ups on *ORT /. RE?:l RE?:l RE?: RE?: RE?: RE?:l RE?: RE?:
R/*.I,T#D=TO !TO!#*!A*!8*!6*!O/it 3210986
/itO /it 7
R/*.C *ORT / *ull:.p #nable bit 6 H *ORT / pull ups are disabled 7 H *ORT / pull ups are enabled by indi'idual port latch
'alues /it 2 I,T#D=C Interrupt #dge !elect bit 6 H Interrupt on rising edge of I,T pin 7 H Interrupt on falling edge of I,T pin /it 1 TO !C T$RO cloc& !ource !elect bit 6 H Transition on TO <6 pin 7 H Internal instruction cycle cloc& @ ;<O.TA
/it 0
TO!#C T$RO !ource #dge !elect bit 6 H Increment on high:to0ow transition on TO <6 pin 7 H Increment on low:to:high transition on TO <6 pin *!AC *rescalar Assignment bit 6 H *rescalar is assigned to the ?DT 7 H *rescalar is assigned to the Timer 7 module
/it 9
/it 8:7
*!8:*!7C *rescalar rate select bits
*! 6. T$RO Rate *!O 7 7 7 6C8 7 7 6 6C0 7 6 7 6C4 7 6 6 6C62 6 7 7 6C98 6 7 6 6C20 6 6 7 6C684 6 6 6 6C812 *RI=RA$ $#$OR" OR=A,IGATIO,
*!8
?DT Rate 6C6 6C8 6C0 6C4 6C62 6C98 6C20 6C684
$id:range $ . de'ices ha'e 69:bit program counter capable of addressing an 4< J 60 program memory space. The width of the program memory bus @instruction wordA is 60:bits.!ince all the instructions are a single word, a de'ice with an 4< J 60 program memory has space for 4< of instructions. This ma&es it much easier to determine if a de'ice has sufficient memory for desired application. This program memory space is di'ided into four pages of 8< words each @7h:3FFh,477h:FFFh,6777h:63FFh,and 6477h:lFFhA.Figure shows the program memory map as well as the 4 le'el deep hardware stac&. To (ump between the program pages, the high bits of the *rogram ounter @* A must be modified. This is done by writing the desired 'alue into a special function register called * ;AT% @*rogram ounter ;atch %ighA.If se)uential instructions are executed, the * will cross the page boundaries without any user inter'ention.
#ATA MEMOR( OR-ANI/ATION Data memory is made up of the !pecial Function Registers @!FRA area, and the =eneral *urpose Registers @=*RA area. The !FRs controls the operation of the de'ice, =*Rs are the general area for data storage and scratch pad operations. The data memory is ban&ed for both !FRs and =*R areas. =*R area is ban&ed to allow greater than 52 bytes of general purpose RA$ to be addressed. FR! is for the registers that control the peripheral and core functions. /an&ing re)uires the use of control bits for ban& selection. These control bits are
15
located in the !TAT.! register @!TAT.! K3C1BA.The entire data memory can be accessed either directly or indirectly. Direct addressing may re)uire the use of the R*6CR*7 bits. Indirect addressing uses the Indirect Register *ointer @IR*A bit of the !TAT.! register for accesses in the /an& OE/an& 6 or the /an& 8E/an& 9 areas of data memory. 'AN.INThe data memory is partitioned into four ban&s. #ach ban& contains =*Rs and !FRs. !witching between these ban&s re)uires the R*O and R*6 bits in the !TAT.! register to be configured for each ban& extends up to 3Fh @684 bytesA.The lower locations of each ban& are reser'ed for the !FRs. Abo'e the !pecial Function Registers are the =eneral *urpose Registers. All data memory is implemented as static RA$. !ome high use !FRs from /an& 7 are mirrored in the other ban&s for core reduction and )uic&er access.
PORTS =eneral purpose IEO pins can be considered the simplest of peripherals. They allow the *I to monitor and control other de'ices. To add flexibility and functionality to a de'ice, some pins are multiplexed with an alternate [email protected] general when a peripheral is functioning, that pin may not be used as a general purpose IEO pin. For most ports ,the IEO pin+s direction @input or outputA is controlled by the data direction register ,called TRI! register .TRI! KxB controls the direction of *ORTKxB .A +6+ in the TRI! bit corresponds to that pin being an input .while a +7+ corresponds to that pin being an output. The *ORT registers are the latch for the data to be output. ?hen the *ORT is read, the de'ice reads the le'els present on the IEO pins.
PORT A !n" TRISA RE-ISTER The RA0 pin is a !chmitt Trigger input and an open drain output. All other RA port pins ha'e TT; input le'els and full $O! output dri'ers. All pins ha'e data direction bits @TRI! registerA which can configures these pins as output or input. !etting a TRI!A register bit puts the corresponding output dri'er in a high impedance mode. learing bit in the TRI!A register puts the contents of the output latch on the selected pin@sA.
PORT ' !n" the TRIS' RE-ISTER *ORT/ is an 4:bit wide bidirectional port. The corresponding data direction register is TRI!/. !etting a bit in the TRI!/ register puts the corresponding output dri'er in a high impedance input mode. learing a bit in the TRI!/ register puts the contents of the output latch on the selected pin@sA. PORTC !n" the TRISC RE-ISTER
*ORT is an 4:bit bidirectional port. #ach pin is indi'idually configurable as an input or output through the TRI! register. *ORT pins ha'e !chmitt Trigger input buffers. ?hen enabling peripheral functions, care should be ta&en in defining TRI! bits for each *ORT pins. !ome peripherals o'erride the TRI! bit to ma&e a pin an input.
PORT# !n" the TRIS# RE-ISTER *ORTD is an 4:bit bidirectional port. #ach pin is indi'idually configurable as an input or output through the TRI!D register.
PORTE !n" the TRISE RE-ISTER *ORTD is an 4:bit bidirectional port. #ach pin is indi'idually configurable as an input or output through the TRI!# register.
PRO-RAMMA'LE INTERFACE CONTROLLER 0PIC1
*H( PIC IS USE#1 SPEE#2 ?hen operated at its maximum cloc& rate, a *I executes most of its instructions in .8 micro seconds or 1 instructions per microseconds. HI-H PERFORMANCE RISC CPU INSTRUCTION SET SIMPLICIT( The instruction set consists of (ust 91 instructions. INTE-RATION OF OPERATIONAL FEATURES *ower on reset and brown out protection ensure that the chip operates only when the supply 'oltage is within specificationL a watchdog timer resets the *I if the chip e'er malfunctions and de'iates from its normal operation. Any one of four cloc& options can be supported, including a low cost R oscillator and a high accuracy crystal oscillator.
17
PRO-RAMMA'LE TIMER OPTIONS2 Three 'ersatile timers can be characteri-ed inputs, control outputs and pro'ide internal timing for program executions. INTERRUPT CONTROL2 .ptol8 independent interrupt sources, which can pro'ide useful interrupting as when needed.
EPROM 3OTP 3ROM OPTIONS2 .ltra'iolet erasable, programmable parts support de'elopment. /oth small and lower cost one time programmable parts supports large production runs.
IN'ULT MO#ULES2 The *I microcontroller has a number of inbuilt modules such as AD , .!ART that increases 'ersatility of micro controller. LO* POER CONSUMPTION2 *I#E OPERATIN- 4OLTA-E RAN-E2 8.1 TO 2.7 4 PRO-RAMMA'LE CO#E PROTECTION MO#E2 PO*ER SA4IN- SLEEP MO#E2
PIC16F87, +++++++++++++++++ 6. %igh *erformance *. 8. Only 91 Instructions 9. All single cycle instructions expect program branches operating speed C D 87 $%- ,cloc& inputC D 877ns instruction cycle 0. .p to 4< J 60 words of flash program memory .p to 924 J 4 bytes of data memory @RA$A .p to 812 J 4 bytes of ##*RO$ data memory 1. *in out compatible to the *I 62 39/E30/E32E33 2. Interrupt compatibility @up to 60 sourcesA 3. *ower

67.*rogrammable code protection power sa'ing sleep mode 66.;ow

PIN OUT OF PIC16F877A
PDIP
<NOT>MCLR/Vpp/THV RAO/AN 0 RA1/AN1 RA2/AN2/VrefRA3/AtJ3Mef+ RA4/T0CKI RA /AN4/<N0T>!! R"0/<NOT>RD/AN R"1/<N0T>#R/AN$ R"2/<NOT>C!/AN% V&& V'' 0!C1/CLKIN 0!C2/CLK0(T RCM10!0/T1CKI ) RC1/T10!I-/CCP2 RC2/CCP1 RC3/!CK*/!CL RDO/P!PO RD1/P!P1
PIC16F87 7
S(STEM FEATURES 6 8 9 0 1 2 *A!!?ORD *ROT# TIO, !#,!OR! R#;A"! <#"/OARD DI!*;A" DI!.A; I,DI ATIO,
*A!!?ORD *ROT# TIO, The system is fully password protected. A four digit password is used for the system. The password of the authori-ed persons is pre'iously stored in the ##*RO$. Only by the entry of the 'alid password the access into the room is accepted otherwise it will set out an alarm. On the entry of the password we get a single beep which indicates that the password entered is correct and the relay connected to the door latch is made to open immediately, which ma&es the door open. There is a pro'ision of three trials for entering the password beyond which an alarm is setout which indicate that an attempt for entry by an unauthori-ed person.
SENSORS As explained earlier, the system+s main consideration is effecti'e power management. For this it has to monitor and measure different parameters within the office so as to gi'e the corresponding intelligence to the microcontroller which ma&es different decisions which in turn controls the different electrical appliances inside the office .For this we use different sensors for measuring different parameters. The different types of sensors used are infrared diodes, temperature and light dependant resistors. All the abo'e sensors used here are highly sensiti'e and ha'e correctness in the infrared outputs, which is 'ery reliable. #ach of them is calibrated according to our needs. INFRARE# #IO#ES Infrared diodes are similar to the normal diodes. Infra red diodes emit infrared rays instead of light in the case of ;#Ds. In this system they are used for finding count of the persons entering or lea'ing the room. %ere two infrared diodes are used named infrared A and infrared /. They are placed immediately after the door. The sensor near to the door is ta&en as sensor A and that placed far from the door is ta&en as sensor /. the sensor A and / are placed at a distance of about lm. The infrared diodes acts as a transmitter circuit and the photo detectors are placed at the other end of the infrared diodes, which acts as the recei'er circuit. The rays from the infrared diodes are focused on to the photo diodes. ?hene'er the ray cuts between infrared diode and photo diode, a signal is gi'en to the microcontroller. An entry is detected when the sensor A cuts first and then sensor /. Otherwise an exit is detected if sensor / cuts first and then sensor A.
LI-HT #EPEN#IN- RESISTOR
Another sensor used in this system is ;DR, which detects the illumination in a particular area. In presence of light the resistance of the sensor goes into a range of mega ohms. In the absence of light the resistance of the sensor falls to a few ohms thereby changing the conducti'ity of current. The ;DR is suitably calibrated such a way that if the luminance inside the room is below a specified 'alue it gi'es out a signal to the microcontroller, which ta&es the decision +put O, the light+.
RELA(S Relays are used here as dri'er for the different electrical appliances so as to ma&e the de'ice O, or OFF. The help of relays can pro'ide sufficient amount of isolation for the system from the line 'oltage. !ince the microcontroller cannot directly pro'ide sufficient dri'e to the relays 68' supplies are used for dri'ing he relays. .E('OAR#
This is the only human machine interface of the system. The &eyboard is normally a 9J0 matrix type. ,ormally a telephone &eypad is used. The &eypad has an electronic circuitry to determine which &ey is pressed. Then a standard 4:bit code is generated and sends to the *I . Detecting which &ey is pressed and generating the corresponding code is &nown as encoding. %ere it is used for the password entry and it+s editing.
#ISPLA( This system uses three segment dynamic displays for displaying the number of persons inside the room in the run mode. ?hene'er the infrared rays are cut which detect an entry or exit it gi'es the signal the signal to the microcontroller, which in turn decrements a register. This count is con'erted to decimal format by the subroutine and is displayed on to the displays.
IN#ICATIONS DI!.A; I,DI ATIO,! There are fi'e different ;#Ds. 6. 8. 9. 0. 1. <eyboard chec& Right password ?rong password ;ight Fan
.E( 'OAR# <ey board is the only human interface to the system. %ere we are using a numeric &ey pad .An employee enters his password through this &ey board .<ey board is interfaced to the system through *ORT/.R/7:R/9 are configured as output. Remaining pins are configured as input.
figC &eyboard connection
*ressing a &ey causes a change in the amount of current flowing in the circuit associated with that &ey. /y detecting the increase and decrease in current the microcontroller that is constantly scanning the &eyboard can detect when a &ey is pressed and when it has been released. %ere we initially place -ero to one of the row and one to all columns. Then we read the columns. ?hen any one of the &ey is pressed the corresponding column 'alue goes low and the &ey press is detected. The 'alue gi'en to the row is rotated and the abo'e process continues until a &ey press is detected. 3 !#=$#,T DI!*;A" A'ery common re)uirement in modern electronics is that of displaying alphanumeric characters. Digital watches, calculators, digital multimeters are examples of de'ices that ma&e use of such displays. The best &nown type of alphanumeric display is the se'en segment display that consists of se'en independently accessible photoelectric segments such as ;#Ds or ; Ds arranged in the form shown in the figure.
-23-
figC se'en segment display
The segments are named from a to g in the manner shown in figure and it is possible to display any number from 7 to 5 or alphabetic character from A to F by acti'ating the signals to 'arious combinations to produce a one, segments b and c are energi-edL to produce a 8 ,segments a, b, g, e, and d are use dL and so on One common type of se'en segment display consists of ;#Ds .#ach segment is an ;#D that emits light when current flows through it. There are two types of displays a'ailable : common anode arrangement and common anode arrangement. ommon anode arrangement re)uires a dri'ing circuit to pro'ide a ;O? le'el 'oltage in order to acti'ate a gi'en segment. ?hen a ;O? is applied to a segment input, the ;#D is forward biased and current flows through it. The common cathode arrangement re)uires a dri'ing circuit to pro'ide a high le'el 'oltage in order to acti'ate a gi'en segment. ?hen a %I=% is applied to a segment input , the ;#D is forward biased and current flows through it.
figC common cathode internal wiring
Lect5re 7) #i it!% #i6p%!7
Binary num !r" ar! n!#!""ary$ u% &!ry 'ar( %) r!a( )r in%!r*r!%+ W'a% i" a&ai,a ,! %) (i"*,ay inary %) (!#ima, in-)rma%i)n. A seven se!"en# L$E$D$ %&s'()*$ A "!&!n-"!/m!n% (i"*,ay may 'a&! 3, 4, )r 5 ,!a(" )n %'! #'i*+ U"ua,,y ,!a(" 4 an( 5 ar! (!#ima, *)in%"+ T'! -i/ur! !,)0 i" a %y*i#a, #)m*)n!n% an( *in ,ay)u% -)r a "!&!n "!/m!n% (i"*,ay+
r-c$s DA.
+1 frf
-a.::r
PIN ASSIGNMENT
+,-(& .1/N(0(1237' 4
) % 5 +i 1 " ! r 2 3
3 SEGMENT 4ISPLA5
T'! ,i/'% !mi%%in/ (i)(!" in a "!&!n-"!/m!n% (i"*,ay ar! arran/!( in %'! -i/ur! !,)0+
6
A
4IO4E PLACEMENT IN A SE7EN SEGMENT 4ISPLA5$ NO 4ECIMAL T'!r! ar! %0) %y*!" )- (i"*,ay" a&ai,a ,!$ #)mm)n an)(! an( #)mm)n #a%')(!+ T'! 0irin/ -)r a #)mm)n an)(! i" "')0n !,)0+
1
COMMON ANO4E INTERNAL WIRING
T'! %ru%' %a ,! "')0n !,)0 i" u"!( %) #)n-irm %'a% %'! (i/i%a, "i/na, "!n% %) %'! (i"*,ay ,i/'%" u* %'! #)rr!#% "!/m!n%+
TRUT8 TABI9 In*u%" LE : : ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; 1 BI LT 4 : ; : C : 1 1 ; 1 1 ; 1 1 ; 1 1 ; 1 1 ; 1 1 1 Ou%*u%"
c
: : ; ; ; ; 1 1 1
B : = ; ; 1 1 ; ; 1 1 ; ; 1 1 ; ; 1 1 :
A : : ; 1
a
1 ; 1 ; 1 1 ; 1
# 1
( 1 ; 1 ; 1 1 ; 1 1 ; 1 ; ; ; ; ; ; ; 5
a 1 ; 1 ; ; ; ; ; 1 ; 1
I@
1 # 1 ; ; ; 1 1 1 ; 1 1 ; ; ; ; ; G
9
1 ; ; ;
4i"*,ay < B,an> ; 1 2 3 1 5 ? 7 < y B,an> B,an> B,an> B,an> B,an> B,an>
8
c
1 1 1 1 1 1
6
1 1
6
1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 :
6
; 1 ; 1 % 1 ; ; ; ; ; ;
6
; ;
6 6 6
1 1 ;
6
1
; ; ;
i
A
6
1
!
6
; 4 ; ; 1 1 1 1 :
1
1 1 ; ; ; ; ; ;
1 1 1 1 1 1 1 1
6
1 ; ; ;
1 ; ? ; ; ; ;
; ; ; ; ; ;
1
1 1 1 1 1
% I
1 1 1 1
1 1 1 1 1 :
-%
; ;
: - 4)iAB% Car!
B4!*!n#" u*)n %'! BC4 #)(! *r!&i)u",y a**,i!( 0'!n IE C 0
TR.T% TA/;# FOR T%# !#D#,:!#=$#,T DI!*;A" The internal circuitry and logic gates for the display is shown below.
INTERNAL CIRCUITR5 AN4 LOGIC GATES 9OR 7 !#= DI!*;A"
T'! 0irin/ -)r %'! #)mm)n #a%')(! i" "')0n !,)0+
X
COMMON CAT8O4E INTERNAL WIRING T) #)n&!r% %'! inary num !r" %) "i/na," %'a% #an (ri&! %'! L+E+4+" in %'! (i"*,ay y)u n!!( a (i"*,ay (ri&!r+ In %'! ,a 0! u"! an MC11516 #'i*+ T'! *in)u%" ar! "')0n !,)0+
1
4-
,-f.
MB......:
9
-a 6 68 11 1< an
69 1+: 1; -a
U17 B C LT B, LE 4 A GN4 MC60166 7##
/ a
# ( !
PINOUTS 9OR T8E MC11511 SE7EN-SEGMENT 4ISPLA5 4RI7ER A$ B$ C$ an($ 4 ar! %'! inary in*u%"+ a$ $ #$ ($ !$ -$ an( / ar! %'! (ri&!r "i/na," %) %'! (i"*,ay !,!m!n%"+ LT i" %'! Li/'% T!"% #)n%r),$ %urn" a,, "!/m!n%" )n$ a#%i&! ,)0+ BL ,an>" a,, %'! "!/m!n%" 0'!n a#%i&a%!($ a#%i&! ,)0+ LE i" %'! ,a%#' !na ,! #)n%r),+
T'! "*!#i-i# "!&!n-"!/m!n% (i"*,ay u"!( in ,a i" an LN513RD+ T'! "#'!ma%i# !,)0 i" "imi,ar %) %'! )n! y)u 0i,, u"! in ,a + vcc
6 2 6 9 6 8 6 6 6 7
1 1
)LT
B,
6 6
60
GN4
$ I 02660s c(
t
g
L4P SE7SEG
E AM
la I o
AT8
l.N 66
R4I-B
SE7EN SEGMENT 4ISPLA5 WIT8 4ISPLA5 4RI7ER T) 'a&! %'! (ri&!r #)n&!r% %'! inary in*u% %) "i/na," r!a(y -)r %'! (i"*,ay$ %i! *in 3$ LT$ an( *in 1$ B,$ %) 7CC+ C)nn!#% *in 5$ LE$ %) /r)un(+ In %'i" #)n-i/ura%i)n 0'a% !&!r %'! inary in*u%" a% A-4 ar! 0i,, ! #)n&!r%!( an( %'! (i"*,ay 0i,, "')0 %'! (!#ima, !Fui&a,!n%+ COUNTING ;-3 < + = circ5it
2Y
2A
2B 2C
in
LE GND
16
I G@
16
20
1/ 12 11 81+ 4 10
1 i
12 1+ 6
+ + +GGi+r
CL C$L$ K LD TE PL P6 P/ P. P1 71 72 7/ 76 CO
1Y
1A 1B 1C ID
#
%
) 9
e1
CAT6 CAT/ CAT2 CAT1 RDP
LDP
;-3 COUNTING CIRCUIT T'! "%ar% )- %'i" #ir#ui% i" %'! MC111?1 inary #)un%!r+ T'! -un#%i)n /!n!ra%)r i" #)nn!#%!( %) %'! #,)#> in*u% %) "%ar% %'! #)un%in/ #y#,!+ T'! MC11;12 NAN4 /a%! m)ni%)r" %'! )u%*u% )- %'! inary #)un%!r+ W'!n %'! #)un% !Fua," 3 %'! )u%*u% )- %'! NAN4 /a%! "!n(" a "i/na, %) %'! ,)a( #)n%r),$ L4$ )n %'! #)un%!r %) ,)a( %'! &a,u!" )n P1-P1$ in %'i" #a"! %'! num !r H!r)+ A" %'! #)un%!r i" in#r!m!n%in/ -r)m ;-3 %'! (ri&!r "i/na, i" #)n"%an%,y u*(a%in/ %'! (i"*,ay an( %urnin/ )n an( )-- %'! a**r)*ria%! "!/m!n%"+ I- n!!( ! y)u #)u,( u"! a 555 %im!r #ir#ui% in *,a#! )- %'! -un#%i)n /!n!ra%)r+
SET R 1C; R2C; R3C; R1C; R5C; +LE4 ON
I
INCREMENT COUNT
4ECREMENT COUNT
1
6 CON7ERT COUNT 9ROM 8E: TO 4ECIMAL+
r
4ISPLA5 COUNT
9AN ON
% LIG8T O99
I GGGGGGGGG @+
"
rN
PRO-RA M
i
1
I L.*rogram for office automation
66
;I!T *H*I 62F433 OI, ;.D#P*62F433.I, P /;O < 7F87 F I F8 F9 F0 "l "8 "9 "0 Rl Ldeclaring registers
II
I
II II
R8 R0 R1 I R2 R#= ! I !8 T l
;OO<
I
!67 ! l l #,D OR= 7 L starting of the program ,O* ,O* ,O* =OTO /#=I, ADD?F * ;,6 R#T;? /+76666667+ R#T;? /+76677777+ R#T;? /+67667667+ R#T;? /+67766667+ R#T;? /+l 6776677+ R#T;? /+l 6766767+ Lloo&up table for se'en:segment display R#T;? /+l 6666767+
I
Q li
I II ,, iJ
I II I I
R#T;?/+77776667+ R#T;? /+l 6666667+ R#T;? /+l 6766667+ /#=I, ;RF *ORT/ ;RF *ORTA ;RF *ORT ;RF *ORTD ;RF *ORT# ;RF ! I ;RF R0 ;RF R1 ;RF R2 ;RF T l ,, II ;RF R0 ;RF R1 ;RF R2 $OD;? D+75+ $OD?F F I $OD;? D+71+ $OD?F F8 $OD;? D+OF $OD?F F9 $OD;? D+79+ $OD?F F0 / F !TAT.!,2 /!F !TAT.!,1 $OD;? /+l 6667777+ $OD?F TRI!/ / F O*TIO, R#=,3 / F TRI!A,1 $OD;? 7F73 $OD?F AD O,6 / F !TAT.!,2 K / F !TAT.!,1 $OD;? /+77776666+ $OD?F *ORT/ ;RF *ORTA ;RF *ORT/ ;RF *ORT
Lstoring user password
clearing *ORT! onfiguring *ORT / as half input and half oEp
CLP$F PORT# CLRF PORTE
/!F *ORTA,1 $OD;? /+l 6667666J $OD?F *ORT/ /TF!! *ORT/,0 =OTO O,# /TF!! *ORT/,1 =OTO T?O /TF!! *ORT/,2 =OTO T%R## $OD;? /+l 666 6766+ $OD?F *ORT/ /TF!! *ORT/,0 =OTO FO.R /TF!! *ORT/,1 =OTO FID# /TF!! *ORT/,2 =OTO !IF $OD;? /+l 6666676+ $OD?F *ORT/ /TF!! *ORT/,0 =OTO !#D#, /TF!! *ORT/,1 =OTO #I=%T /TF!! *ORT/,2 =OTO
,I,# $OD;? /+l 6666667+ $OD?F *ORT/ /TF!! *ORT/,1 =OTO G#RO /TF!! *ORT/,3 =OTO #,T#R =OTO !TART /TF!! *ORT/,0 =OTO O,# $OD;? D+76+ $OD?F Rl
I
pressing fi'e Lchec&ing for L chec&in g for Lchec&ing for pressing se'en Lchec&ing for pressing eight Lchec&ing for pressing nine pressing six
pressing one Lchec&in g for
Lchec&ing for pressing -ero Lchec&ing for pressing enter
pressing two Lchec&in g for
pressing three
Lstoring the number,blin&ing ;#D,exchang A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,1 =OTO T?O $OD;? D+78+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,2 =OTO T%R## $OD;? D+79+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART
L chec&in g for /TF!! *ORT/,1 =OTO FID# $OD;? D+71+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,2 =OTO !IF $OD;? D+72+ $OD?F R l A;; /;I,< /TF!! *ORT/,0 =OTO FO.R $OD;? D+70+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART
pressin g four Lchec&i ng for
I
Lstoring the number,blin&ing ;#D,exchanging Lstoring number,blin&ing ;#D,exchanging the
Lstoring the number,blin&ing ;#D,exchanging
Lstoring number,blin&ing ;#D,exchanging
the
Lstoring the number,blin&lng ;#D,exchanging A;; #F %A,=# =OTO !TART /TF!! *ORT/,0 =OTO !#D#, $OD;? D+73+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,1 =OTO #I=%T $OD;? D+74+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,2 =OTO ,I,# $OD;? D+75+ $OD?F R l
Lstoring the number,blin&ing ;#D,exchanging
Lstoring the number,blin&ing ;#D,exchanging
Lstoring the number,blin&ing ;#D,exchanging
I
A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,1 =OTO G#RO $OD;? D+OO+ $OD?F R l A;; /;I,< A;; #F %A,=# =OTO !TART /TF!! *ORT/,3 =OTO #,T#R A;; /;I,< $ODFF6,7 !./?F "6,7
Lstoring the number,blin&ing ;#D,exchanging
/TF!! !TAT.!,8 =OTO !TART $ODF F8,7 !./?F "8,7 /TF!! !TAT.!,8 =OTO !TART $ODF F9,7 !./?F "9,7 /TF!! !TAT.!,8 =OTO !TART $ODF F0,7 !./?F "0,7 /TF!! !TAT.!,8 =OTO !TART =OTO O*#,
Lchec&ing the entered password
Lwrong password,reentering Lopening the door
password
/;I,< / F !TAT.!,2 /!F !TAT.!,1 / F TRI!A,1 / F !TAT.!,2 / F !TAT.!,1 /!F *ORTA,1 / F !TAT.!,2 /!F !TAT.!,1 Lblin&ing ;#D for a &eypress $OD;? /+77777666+ $OD?F O*TIO,R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+76+ Ldelay for ;#D
I
P $OD?F T$RO FF $ODF T$R7,7 /TF!! !TAT.!,8 =OTO FF / F *ORTA,1 R#T.R, #F %A,=# $ODF "8,7 $OD?F " l $ODF "9,7 $OD?F "8 $ODF "0,7 $OD?F "9 $ODF R 6,7 $OD?F "0 R#T.R, exchanging the entered password
/ F !TAT.!,2 /!F !TAT.!,1 / F TR.I !A, 6 Lopening the door / F !TAT.!,2 / F !TAT.!,1 /!F *ORTA, 6 L !#,!I,= !# TIO, / F !TAT.!,2 /!F !TAT.!,1 / F TRI! ,8 /!F TRI!D,7 /!F TRI! .0 / F !TAT.!,2 / F !TAT.!,1 /!F *ORT ,8 / F !TAT.!,2 /!F !TAT.!,1 $OD;? / + O O O O O l l l + $OD?F O*TIO, R#= / F TRI!#,8 / F !TAT.!,2 / F !TAT.!,1 $OD;? D+61+ $OD?F R#= $OD;? DT+ $OD?F T$RO $ODF T$R7,7 /TF!! !TAT.!,8 =OTO /D D# F!G R#=,6 =OTO ;A! /!F *ORT#,8 A;; DI!*;A" / F !TAT.!,2 /!F !TAT.!,1 /!F TRI!D,7 /!F TRI! ,0 / F !TAT.!,2 / F !TAT.!,1 A;; DI!*;A" /TF! *ORTD,7 =OTO GG A;; D#;A" 6 /TF!! *ORTD,7 =OTO AA =OTO GG A;; DI!*;A" /TF! *ORT ,0 =OTO AA A;; D#;A" 6 /TF! *ORT ,0 =OTO AA I, F ! l , l A;; D#;A"1 A;; DI!*;A" =OTO GG A;; DI!*;A" /TF! *ORT ,0 =OTO "" A;; D#;A" 6 /TF!! *ORT ,0 =OTO // =OTO "" A;; DI!*;A" /TF! *ORTD,7 =OTO // A;; D#;A" 6 /TF! *ORTD,7 =OTO // $ODF !6,7
I
L chec&ing for entry incrementing sensing register
displaying count L chec&ing for entry
Lchec&ing
for
exit
Lchec&ing for exit Lchec&ing for entry Lchec&ing for exit
Lchec&ing for entry
Lchec&ing for exit
/TF! !TAT.!,8 =OTO ;O!# $OD?F ! I D# F !6,6 Ldecrementing sensing registor A;; D#;A"1 A;; DI!*;A" =OTO "" D#;A" 6 / F !TAT.!,2 /!F !TAT.!,1 $OD;? /T 7777666+ $OD?F O*TIO, R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+810+ L87 micro second delay $OD?F T$RO $ODF T$R7,7 /TF!! !TAT.!,8 =OTO R#T.R, DI!*;A" ;RFR0 ;RF R1 ;RF R2 / F !TAT.!,2 /!F !TAT.!,1 $OD;? /+77777776+ $OD?F TRI!D $OD;? /+77766766+ Lhex to decimal con'ersion $OD?F TRI! / F !TAT.!,2 / F !TAT.!,1
I
$OD;? DT 77+ $OD?F !8 ;RF R0 $ODF !6,7 $OD?F ! l l DD $ODF !8,7 !./?F ! I 6,6 I, F R0,l /TF! !TAT.!,7 =OTO DD D# F R0,l $OD;? 7F20 ADD?F ! I 6,6 $OD;? 7F7A $OD?F !8 ;RF R1 !./?F ! I 6,6 I, F R1,l /TF! !TAT.!,7 =OTO ## D# F R1,l ADD?F ! I 6,7 $OD?F R2 $OD;? D+1+ $OD?F !67 / F !TAT.!,2 /!F !TAT.!,1 / F TR6! ,1 / F TRI! ,2 / F TRI! ,3 / F !TAT.!,2 / F !TAT.!,1 /!F *ORT ,1 / F *ORT ,2 / F *ORT ,3 $ODF R0,7 A;; ;OO< $OD?F *ORTD A;; D#;A"8 / F *ORT ,1 / F *ORT ,3 /!F *ORT ,2 $ODF R1,7 A;; ;OO< $OD?F *ORTD A;; D#;A"8 / F *ORT ,2 / F *ORT ,1
II II
II
##
Ldisplaying 1 times
!!
displaying count on 3 segment
I
II II II
/ F *ORT#,7 / F *ORT#, 6 $ODF !6,7 /TF! !TAT.!,8
/!F *ORT ,3 $ODF R2,7 A;; ;OO< $OD?F *ORTD A;; D#;A"8 / F *ORT R / F *ORT ,2 / F *ORT ,1 D# F!G !I7,6 =OTO !! ,O*
,J I
II
R#T.R,
/ F !TAT.!,2 /!F !TAT.!,1 / F TRI!#,7 / F TRI!#, 6 /!F TRI!A,7 $OD;? 7F73 $OD?F AD O, 6 /!F TRI!A,0 /!F TR6!A,7 / F !TAT.!,2 / F !TAT.!,1 $OD;? /+l7777776+ $OD?F AD O,7
LAD for temperature sensing
I
/ F !TAT.!,2 /!F !TAT.!,1 $OD;? /+77777666+ $OD?F AD O,6 $OD;? /+l7777666+ $OD?F O*TIO, R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+811+ L97 micro second delay $OD?F T$R7 $ODF T$R7,7 /TF!! !TAT.!,8 =OTO FF /!F AD O,7,8 /TF! AD O,7,8 =OTO S:6 $ODF ADR#!%,7 $OD?F T l $OD;? D+97+
I
!./?FT6,7 /TF! !TAT.!,7 =OTO O, =OTO OFF /!F *ORT#,7 =OTO ;I=%T / F *ORT#,7 =OTO ;I=%T /TF!! *ORTA,0 =OTO O,; =OTO OFF; /!F *ORT#, 6 =OTO R#D / F *ORT#, 6 =OTO R#D ,O* R#T.R,
Ltemperature chec&ing
Lpowering on fan
Lpowering off fan
Lchec&ing light
Lpowering on the light
Lpowering off the light
/ F !TAT.!,2 /!F !TAT.!,1 $OD;? /J 67777666+ $OD?F O*TIO, R#= / F !TAT.!,2 / F !TAT.!,1 $OD;? D+817+ $OD?F T$RO RR $ODF T$R7,7 /TF!! !TAT.!,8 =OTORR ,O* R#T.R, / F !TAT.!,2 /!F !TAT.!,1 / F TRI!A,6 / F TRI!#,7 / F TRI!#,67 / F !TAT.!,2 / F !TAT.!,1 / F *ORTA, 6
L 6 millisecond delay
;O!#
Lclosing door,fan and light
I
/ F *ORT#,7 / F *ORT#, 6 =OTO "" D#;A"1C / F !TAT.!,1 $OD;? D+2+ $OD?F I A=AI,8C $OD;? DT $OD?F T$RO /!F !TAT.!,1 $OD;? /+77777666+ $OD?F O*TIO,R#= / F !TAT.!,1 $ODF T$R7,7 /TF!! !TAT.!,8 =OTO S:8 D# F!G . =OTO A=AI,8 R#T.R, ,O* #,D
L177$ !# D#;A"
CONCLUSION AN# FUTURE SCOPE
*hen %i$e in ! "7n!&ic >or%" o? ?!6t ch!n in technic!% ?rontier6, the con$ention!% 676te&6 !re @ein rep%!ce" @7 6ophi6tic!te" !n" !"$!nce" techno%o ie6) .eepin the %!te6t !n" tren"6 I &in", the "e6i ne" pro"5ct i6 !n inno$!ti$e one to ?!ci%it!te6 the !5to&!tion reA5ire&ent6 o? !n o??ice)
E
The "r!>@!cB6 o? the eCi6tin &!n5!% 676te& in o5r o??ice6, >hich in$o%$e6 >!6t! e o? e%ectricit7 "5e to in e??icient oper!tion o? ?!n6 !n" %i ht6, c!n @e 6o%$e")
The 6!%ient ?e!t5re6 o? the 676te& !re
T T
Entr7 !n" ECit checB S>itchin ON !n" OFF o? %i ht6 !n" ?!n6 !6 reA5ire" T It c!n @e e!6i%7 "e$e%ope" !n" pro r!&&e" to ?it the reA5ire&ent6 o? "i??erent o??ice6
I
The 6cope o? ?5t5re %ie6 in the ?!ct th!t >e h!$e not con6i"ere" th!t the centr!%iDe" %i ht !n" ?!n 676te& c!n @e &!"e "ecentr!%iDe" on the @!6i6 o? the n5&@er o? ch!ir6 occ5pie" in the o??ice) The 676te& i6 eCpecte" to @e >i"e%7 !ccepte" "5e to technic!% e??icienc7 !n" !"!pt!@%e n!t5re)
REFERENCES 6.PDesign with *I $icrocontrollersP Rohn /. *eatmann, 1th Indian reprint 8.PAssembly language programming with *I P /. R. %aris and ?olf, *enram Ul International *ublications UU 9. www.picboo&.com 0.www.atnel.com v 1. www.microchip.com UU 2.www.microcontroller.com , 3.www.electronicsforyou.com
% i I I
I I
I K i
I I
I I
lU
Office Automation
I i
doc_703986305.doc