release is now called

ZigBee 2004
. The second stack release is
called

ZigBee
2006
, and mainly replaces the

MSG/KVP

structure used in 2004 with a
"cluster library". The 2004 stack is now more or less obsolete.

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


43


VAST







ZigBee 2007
, now the current stack release, contains two stack profiles, stack
profile 1 (simply called ZigBee), f
or home and light commercial use, and stack profile
2 (called ZigBee Pro). ZigBee Pro offers more features, such as multi
-
casting, many
-
to
-
one routing and high security with Symmetric
-
Key Key Exchange (SKKE), while
ZigBee (stack profile 1) offers a sma
ller footprint in RAM and flash. Both offer full
mesh networking and work with all ZigBee application profiles.




ZigBee 2007 is fully backward compatible with ZigBee 2006 devices: A ZigBee
2007 device may join and operate on a ZigBee 2006 network

and vice versa. Due to
differences in routing options, ZigBee Pro devices must become non
-
routing ZigBee
End
-
Devices (ZEDs) on a ZigBee 2006 network, the same as for ZigBee 2006 devices
on a ZigBee 2007 network must become ZEDs on a ZigBee Pro network. Th
e
applications running on those devices work the same, regardless of the stack profile
beneath them.



5
.4.10 ZIGBEE Protocols




The protocols build on recent algorithmic research
(Ad
-
hoc On

demand
Distance vector, neuRFon)
to automatically cons
truct a low
-
speed ad
-
hoc network of
nodes. In most large network instances, the network will be a cluster of clusters. It can


also form a mesh or a single cluster. The current profiles derived from the ZigBee
protocols support beacon and non
-
beacon enable
d networks.






In non
-
beacon
-
enabled networks (those whose beacon order is 15), an
unslotted

CSMA/CA

channel access mechanism is used. In this type of network,
ZigBee Routers typically have their receivers continuously active, requiring a more
robus
t power supply. However, this allows for heterogeneous networks in which some
devices receive continuously, while others only transmit when an external stimulus is
detected. The typical example of a heterogeneous network is a

wireless light
switch
:


The Zi
gBee node at the lamp may receive constantly, since it is connected to the
mains supply, while a

battery
-
powered light switch would remain asleep until the
switch is thrown. The switch then wakes up, sends a command to the lamp, receives
an acknowledgment,

and returns to sleep.


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


44


VAST





In such a network the lamp node will be at least a ZigBee Router, if not the
ZigBee Coordinator; the switch node is typically a ZigBee End Device.

In beacon
-
enabled networks, the special network nodes called ZigBee Routers

transmit periodic
beacons to confirm their presence to other network nodes. Nodes may sleep between
beacons, thus lowering their

duty cycle

and extending their battery life. Beacon
intervals may range from 15.36 milliseconds to 15.36 ms * 2
14

= 251.65824
seconds
at 250

kbits/s
, from 24 milliseconds to 24 ms * 2
14
= 393.
216 seconds at 40 kbits/s

and
from 48 milliseconds to 48 ms * 2
14

= 786.432 seconds at 20 kbit/s. However, low
duty cycle operation with long beacon intervals requires precise timing, which c
an
conflict with the need for low product cost.




In general, the ZigBee protocols minimize the time the radio is on so as to reduce
power use. In beaconing networks, nodes only need to be active while a beacon is
being transmitted. In non
-
beacon
-
enab
led networks, power consumption is decidedly

asymmetrical: some devices are always active, while others spend most of their time
sleeping.



Except for the Smart Energy Profile 2.0, which will be MAC/PHY agnostic,
ZigBee devices are required to confor
m to the IEEE

802.15.4

Low
-
Rate Wireless
Personal Area Network (WPAN) standard. The standard specifies the lower

protocol
layers

the physical layer (
PHY
), and the media access control (
MAC
) portion of the


data link layer (
DLL
). This standard specifies ope
ration in the unlicensed
2.4

GHz

(worldwide), 915

MHz

(Americas) and 868

MHz (Europe)

ISM bands
. In the
2.4

GHz

band there are 16 ZigBee channels, with each channel requiring 5

MHz

of
bandwidth. The center frequency for each channel can be calculated as, F
C

= (2405 +
5 * (ch
-

11))

MHz
, where ch = 11, 12
,.....
26.




The radios use

direct sequence spread spectrum

coding, which is managed by the
digital stream into the modulator.

BPSK

is used in the 868 and 915

MHz bands,
and

OQPSK

that transmits four bi
ts per symbol is used in the 2.4

GHz band. The raw,

over
-
the
-
air data rate is 250

kbits

/
s

per

channel

in the 2.4

GHz band, 40 kbit/s per
channel in the 915

MHz band, and 20

kbit/s in the 868

MHz band. Transmission
range is between 10 and 75

meters

(33 and

246

feet
) and up to 1500 meters for
Zigbee


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


45


VAST




pro, although it is heavily dependent on the particular environment. The output power
of the radios is generally 0

dBm

(1

mW).



The basic channel access mode is "carrier sense, multiple access/collision
avoidance" (
CSMA/CA
). That is, the nodes talk in the same way that people
converse; they briefly check to see that no one is talking before they start. There are
three notable exceptions to the use of CSMA. Beacons are sent on a fixed timing
schedule, and
do not use CSMA. Message acknowledgments also do not use CSMA.
Finally, devices in Beacon Oriented networks that have low latency real
-
time
requirements may also use Guaranteed Time Slots (GTS), which by definition do not
use CSMA.




5
.4.11 Offset QPSK
(OQPSK)






Offset quadrature phase
-
shift keying

(
OQPSK
) is a variant of phase
-
shift keying
modulation using 4 different values of the phase to transmit. It is sometimes
called

Staggered quadrature phase
-
shift keying

(
SQPSK
).







Taking four val
ues of the phase (two

bits
) at a time to construct a QPSK symbol
can allow the phase of the signal to jump by as much as 180° at a time. When the
signal is low
-
pass filtered (as is typical in a transmitter), these phase
-
shifts result in
larg
e amplitude
fluctuations

an undesirable quality in communication systems. By
offsetting the timing of the odd and even bits by one bit
-
period, or half a symbol
-


period, the in
-
phase and quadrature components will never change at the same time.
In the constell
ation di
agram shown on the below
, it can be seen that this will limit the
phase
-
shift to no more than 90° at a time. This yields much lower amplitude
fluctuations than non
-
offset QPSK and is sometimes preferred in practice.





The picture on the right shows th
e difference in the behavior of the phase
between ordinary QPSK and OQPSK. It can be seen that in the first plot the phase can
change by 180° at once, while in OQPSK the changes are never greater than 90°.



The modulated signal is shown below for a s
hort segment of a random binary data
-
stream. Note the half symbol
-
period offset between the two component waves. The
sudden phase
-
shifts occur about twice as often as for QPSK (since the signals no

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


46


VAST



longer change together), but they are less severe. In ot
her words, the magnitude of
jumps is smaller in OQPSK when compared to QPSK.





Fig.5
.6

O
-
QPSK






5
.4.12 Mesh Networking








ZigBee is designed to do the mesh networking to the underlying 802.15.4 radio.
Mesh networking is used in applications
where the range between two points may
be
beyond

the range of the two radios located at those points, but intermediate radios are
in place that could forward on any messages to and from the desired radios.










Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


47


VAST




Fig 6.7

Mesh Networking






As an example, in the figure above suppose we wanted to transmit data from
point A to point B, but the distance was too great between the points. The message
could be transmitted through point C and a few other radios to reach the destination.



5
.4.13 Z
IGBEE v/s Bluetooth



ZigBee Protocol was developed to serve very different applications than
Bluetooth and leads to tremendous optimizations in power consumption. Some of the
key protocol differentiators are
:




ZigBee:



Very low duty cycle, very lo
ng primary battery life,



Static and dynamic star and mesh networks, >65,000 no
des, with low latency
available.




Ability to remain quiescent for long periods without communications,



Direct Sequence Spread Spectrum allows devices to sleep without the
requirement for close synchronization.


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


48


VAST





Bluetooth:



Moderate duty cycle, secondary battery lasts same as master,



Very high QoS and very low, guaranteed latency,



Quasi
-
static star netwo
rk up to seven clients with ability to participate in more
than one network,



Frequency Hopping Spread Spectrum is extremely difficult to create extended
networks without large synchronization cost.



5
.4.14 XBEE (ZIGBEE) Module






The XBee
(ZigBee) Module provides an alternative way to transfer data without
the use of wires. XBee transceiver is developed by

Digi
. XBee was among the first
transceivers that hit the market and came in a convenient to use casing.





The XBee (ZigBee) uses
a wireless 2.4GHz transceiver to communicate with
another XBee (ZigBee) module. Furthermore, XBee (ZigBee) modules are capable of
communicating with more than one XBee (ZigBee) module. Thus, it means you can
create a network of XBee modules all over

the pl
ace a
s long as they are in range, of
course.



Fig.5
.8

ZIGBEE Module



Some features of XBee are:



802.15.4 Protocol created by the IEEE foundation.



Data rate of 250KBps (Kilobits per second).

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


49


VAST





Can be used indoors and outdoors.



Range is from 100ft
-
300 for
standard XBee modules and 300ft
-
1 Mile for
XBee Pro Modules (depending on where it’s used and the line of sight from
one XBee to the next XBee).



The standard XBee has a 1mW transmit power and the XBee Pro has a 60mW
transmit power.



No configuration is requ
ired out of the box.



Default baud rate is 9600bps. Although, you can change the configuration of
how fast you want to transmit but for this tutorial we will just leave the baud
rate at default.



One of the great features of ZigBee networks is the
low power operation. XBee
makes sure you won’t be changing the batteries very often! It consumes about 35mA
during transmission (38mA while receiving) while it keeps it below 1uA while
sleeping. These are quite attractive specs. , XBee also allows invisibl
e operation. That
means you don't have to care about exchanging complicated information with the
module in order to send a packet. The invisible mode sets up a link of streaming data
over the ZigBee network. So all you need to do is to serially send the in
formation to
the transmitter and the receiver module will output them the same way to your target

machine. Quite simply, it replaces the serial communication cable. This can be very
handy. Overall the XBee modules are easy to use and provide great features
.
















Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


50


VAST





5
.4.15 Pin Diagram of ZIGBEE


The pin out of the Zigbee module is shown below:




Fig.5
.9

Pin Out of ZIGBEE



The details of
each pin are given in appendix
-
3
. For the data transmission &
reception only pin 1 (supply), pin 2
(transmit), pin 3 (receive) and pin 10 (ground) are
required.














Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


51


VAST

















RECEIVER SECTION







Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


52


VAST



6. RECEIVER SECTION


The transmitter part of the attendance automation system contains the following parts
:




ZIGBEE Module



IC MAX
-
232



RS
-
232
Serial Port



Computer

The circuitry of the receiver section is shown in chapter 4 (Fig.4.2). Each part of the
receiver section is explained below:




6
.1 ZIGBEE Module





The ZIGBEE module is the main part of the receiver section. In the receiver the
ZIGBEE can be used as receiver, since ZIGBEE is a transceiver. This module has a
ZIGBEE address, which is the destination address of ZIGBEE transmitters in the
transmitter sec
tion. The explanation of ZIG
BEE module is given in chapter 5


(section 5
.4).






Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


53


VAST




6
.2 IC MAX
-

232



The

MAX232

IC

is

used

to

convert

the

TTL/CMOS

logic

levels

to

RS232

logic

levels

during

serial

communication

of

microcontrollers

with

PC.

The

controller

operates

at

TTL

logic

level

(0
-
5V)

whereas

the

serial

communication

in

PC

works

on

RS232

standards

(
-
15

V

to

+

15V).

This

makes

it

difficult

to

establish

a

direct

link

between

them

to

communicate

with

each

other.

The

intermediate

link

is

provide
d

through

MAX232.

The

two

logic

levels

are

described

below:



RS2323

TTL

LOGIC

-
15V……
J

=
+2V…….+5V
=
N
=
+3V….…
J

=
0V……...0.8V
=
M
=
=
Ta扬e
=
S

=
i潧ic
=
C潮versi潮s
=
=
=

††=

jAu㈳O
=

=
a
=
摵al
=
摲iverLreceiver
=
that
=
inclu摥s
=
a
=
ca灡citive
=
v潬tage
=
generat潲
=

=
su灰py
=
op㈳O
=
v潬tage
=
levels
=
fr潭
=
a
=
single
=

=
su灰pyK
=
bach
=
receiver
=
c潮verts
=
op㈳O
=
in灵ts
=

=

=
TTiLCjlp
=
levelsK
=
These
=
receivers
=

1

&

R
2
)

can

accept

±30V

inputs.

The

drivers

(T
1

&

T
2
),

also

called

transmitters,

convert

the

TTL/CMOS

input

level

into

RS232

level.

T
he

transmitters

take

input

from

controller’s

serial

transmission

pin

and

send

the

output

to

RS232’s

receiver.

The

receivers,

on

the

other

hand,

take

input

from

transmission

pin

of

RS232

serial

port

and

give

serial

output

to

microcontroller’s

receiver

pin.

MAX232

needs

four

external

capacitors

whose

value

ranges

from

1µF

to

22µF.



Microcontroller

MAX232

RS232

Tx

T
1/2

In

T
1/2

Out

Rx

Rx

R
1/2

Out

R
1/2

In

Tx


Table

6
.2

MAX232

Connection




Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


54


VAST



In

this

project

only

the

conversion

from

TTL

logic

to

RS232

is

needed,

to

covert

the

received

data

(TTL

logic)

to

RS

232

logic.




The MAX232 has a successor, the MAX232
A
. The ICs are almost identical,
however, the MAX232A is much more often used (and easier to get) than the original
MAX232, and the MAX232A only
needs external capacitors 1/10th the capacity of
what the original MAX232 needs.

It should be noted that the MAX232 (A) is just a
driver/receiver. It does not generate the necessary RS
-
232 sequence of marks and

spaces with the right timing, it does not dec
ode the RS
-
232 signal, and it does not
provide a serial/parallel conversion.

All it does is to

convert signal voltage levels
.

Generating serial data with the right timing and decoding serial data has to be done by
additional circuitry.



6
.2.1 Pin out Dia
gram


The
pin out of MAX232 is shown below:




Fig.6
.1

Pin Out of MAX232



We use four capacitors, two for doubling the voltage & two for inverting the voltage.
The connection is described in Table 7.2. The functions of
each pin are given in
appendix
-
4
.


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


55


VAST





6
.3 RS 232 Serial Port





In

t
ele
communications
,

RS
-
232

(Recommended Standard 232) is the traditional
name for a series of standards for

serial

binary

single ended data

and

control

signals
connecting between a

DTE

(
Data Terminal Equipment
) and
a

DCE

(
Data Circuit
-
terminating Equipment
). It is commonly used in

computers serial ports
.




RS232 is the most known serial port used in transmitting the data in
communication and interface. Even though serial port is harder to program than the
parall
el port, this is the most effective method in which the data transmission requires
less wires that yields to the less cost. The RS232 is the communication line which
enables the data transmission by only using three wire links. The three links provides
‘tr
ansmit’, ‘receive’ and common ground.




The ‘transmit’ and ‘receive’ line on this
connecter send and receive data between the computers. As the name indicates, the
data is transmitted serially. The two pins are TXD & RXD. There are other lines on
this
port as RTS, CTS, DSR, DTR, and RTS, RI. The ‘1’ and ‘0’ are the data which
defines a voltage level of 3V to 25V and
-
3V to
-
25V respectively. The electrical
characteristics of the serial port as per the EIA (Electronics Industry Association)
RS232C Standa
rd specify a maximum baud rate of 20,000bps.




In RS
-
232, user data is sent as a

time series of bits
. Both synchronous and
asynchronous transmissions are supported by the standard. In addition to the data
circuits, the standard defines a number of cont
rol circuits used to manage the
connection between the DTE and DCE. Each data or control circuit only operates in
one direction that is, signaling from a DTE to the attached DCE or the reverse. Since
transmit data and receive data are separate circuits, th
e interface can operate in a

full
duplex

manner, supporting concurrent data flow in both directions. The standard does
not define character framing within the data stream, or character encoding.






Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


56


VAST




6
.3.1 Pin out Diagram





Fig.
6.
2

RS232 Port


The
details of each

pin are described in appendix
-
5
.








Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


57


VAST

















SOFTWARE
SECTION



Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


58


VAST



7. SOFTWARE SECTION



7.1 mickroC for PIC



The
programming for the PIC is
done by the software mickro
C.
The m
ikroC

for PIC is a powerful, feature
-
rich
development tool for PIC
microcontrollers. It is designed to provide the programmer with the easiest possible
solution to developing applications for embedded systems, without compromising
performance or control.

It is
a

successful match featuring highly
advanced IDE,
ANSI compliant compiler, broad set of hardware libraries, comprehensive
documentation, and plenty of ready
-
to
-
run examples.



Fig.7.1

mikroC

The source code

and the flow chart are

given in appendix
-
6
.




Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


59


VAST




7.2 Interfacing Software





Fig.7.2
interfacing

software




The interfacing software helps to retrieve the data from the input buffer of the
serial port and append it to a text file to store the transmitted data. Then the software
decodes the stored data to present the data in a

user friendly way.



The software is created using Visual Basic 6.The algorithm of the software is
given below:

1.

Accept the particular serial port number form the user as PORT_TO_
LISTEN.

2.

Listen to the port specified by the user using an infinite lo
op.

3.

Fetch the data and store it in the buffer until data transmission complete flag is
received.

4.

Log each data fetched from the buffer in a separate log file.

5.

Retrieve the data from the corresponding file specified by the user.

6.

Display the retrieved dat
a.


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


60


VAST



The data send by the transmitter section is in a particular pattern as
A
1
A
2
B
1
B
2
C
1
D
1
D
2
E
1
E
2
…….;

where every alphabet represents a character sent.

In the above data stream each characters represent specific information which are
given in the table
below:


Character

Information

A
1
A
2

The Class from which the data is transmitted. The
possible entries are :

01

=
cirst=yearK
=
〲M

=
pec潮搠yearK
=
〳M

=
Thir搠 yearK
=
〴M

=
c潵rth=vearK
=
B
1
B
2

The code representing the teacher handling the
hour. The possible
entries are :

01

=
Teacher彃
=
〲M

=
Teacher彄
=
〳M

=
Teacher彅
=
〴M

=
Teacher彆
=
C
1

Number of the hour. The possible entries are 1 to 7.

D
1
D
2
,
E
1
E
2
,…..
=
The=灡ir=潦=characters=fr潭=a
1
onwards represents
the roll number of absentees.

The possible entries can be
01,02,….10.
=
X
=
T漠in摩cate= the=en搠潦=the=摡ta=stream=fr潭= a=
transmitterK
=
=
Ta扬e=㜮ㄠTata=stream
=
†††
The= s潦tware= c潮tains= the= 摡ta扡se= 潦= 潮ly= 㐠 teachers= an搠 ㄰Nstu摥nts⸠ ft= can= 扥=
ex灡n摥搠 acc潲摩ng= t漠 the= re煵irement⸠ The= s潵rce= c潤o= 潦= the= 灲潧ram= is= given= in=
the=a灰pn摩x
J
㜮T
=
=


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


61


VAST



7.3 X
-

CTU for ZIGBEE




This software is used to check the worki
ng of the ZIGBEE module,
to calculate range of the module, to set the MY address of the module, etc.

for this
Connect the Xbee module to the USB port of the computer. Start the X
-
CTU
software and select the USB Serial Port of the Xbee module. Select the B
aud
-
Rate of
the Xbee module,

default 9600
, but this can be changed so it can be another value.


Fig.7.3 X
-
CTU PC settings

After entering the information press “Test/Query” button. Now select the “Modem
Configuration” tab and Press the “Read” button, the c
urrent configuration of the Xbee
module will be loaded into the software, this will look somehow like as shown

below
(fig.7.4). If other ZigBee networks are running, it is possible for non
-
coordinator
modules to join an unintended network. To avoid this si
tuation, we set a unique PAN
ID for all of the modules. Now we set MY address of the module
s
, also set the
destination address of the sender as
the MY address of the receiver. After setting all
data Press the “Write” Button, then all settings are saved to
this Xbee module.



Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


62


VAST




Fig.7.4 Modem Configuration

An example is given below:

Sender

Receiver

ID = 0x3456 'PAN ID

ID = 0x3456 'PAN ID

MY = 1 'my address

MY = 2 'my address

DL = 2 'destination address

DL = 1 'destination address

Table 7.2 Address Example




Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


63


VAST












ADVANTAGES & APPLICATIONS













Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


64


VAST



8. ADVANTAGES & APPLICATIONS



8
.1 Advantages




The system is very simple
.



Easy to operate
.



Data is more secure
.



Saves manual labour by automatically uploading
and logging

attendance in
any given personal computer.




Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


65


VAST




8
.2 Application




The system was tailor made for
automate
d logging of attendance in

schools
and colleges.



Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


66


VAST
















LIMITATIONS &

FUTURE
EXPANTION











Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


67


VAST



9. LIMITATIONS & FUTURE EXPANTION



9
.1

Limitations




The transmitter

section draws power
from a wall socket which prevents its use
in a mobile scenario where such provisions are absent.



Interfacing software lacks a standard database management system.



The serial

port used for interfacing receiver with the computer system is
obsolete.




Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


68


VAST




9
.2 Future Expansions of the Project




Power the transmitter section with a rechargeable battery pack.



Expand the

interfacing software to include a standard database management
system like MySQL.



Enable USB interface for the receiver.



Minor tweaks in the system firmware enable it to be used in any scenarios
involving mass data logging to a central server from multipl
e clients.





















Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


69


VAST

















CONCLUSION
















Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


70


VAST



10. CONCLUSION


10.1
Conclusion



The attendance automation system we designed can be used in schools
and colleges.
This is a simple system and can be easily operated. Moreover the
d
ata is
more secure and
it

saves manual labour by automatically uploading and logging
attendance in any given personal computer.




Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


71


VAST



References




http://ww1.microchip.com/downloads/en/devicedoc/39582b.pdf



http://www.embed4u.com/pic
-
16f877a
-
lcd
-
c
-
program/



http://www.technovelgy.com/



http://electronics.howstuffworks.com/



http://www.mikroe.com/pdf/mikroc/mikroc_manual.pdf



http://www.aplusinc.com.tw/data/apr9600.pdf



http://www.zigbee.org/en/about/faq.asp



http://www.zigbee.org/en/resources/#SlidePresentations



http://computing.arizona.edu/networkmasterplan/tech_hpe_0703.pdf



“Microcontrollers
-

theory and applications” By Ajay
V Desmukh




www.microchip.com



www.national.com






Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


72


VAST















APPENDIX
























Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


73


VAST



A
ppendix
-
1

Memory Organization of PIC





The program memory map and stack







Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


74


VAST







Data memory organization









Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


75


VAST



Appendix
-
2

Multiplexed Functions of
16F877A Pins




Analog input port (AN0 TO AN7) : these ports are used for interfacing analog
inputs.



TX and RX: These are the USART transmission and reception ports.



SCK: these pins are used for giving synchronous serial clock input.



SCL: these pins act as
an output for both SPI and I2C modes.



DT: these are synchronous data terminals.



CK: synchronous clock input.



SD0: SPI data output (SPI Mode).



SD1: SPI Data input (SPI mode).



SDA: data input/output in I2C Mode.



CCP1 and CCP2: these are capture/compare/PWM m
odules.



OSC1: oscillator input/external clock.



OSC2: oscillator output/clock out.



MCLR: master clear pin (Active low reset).



Vpp: programming voltage input.



THV: High voltage test mode controlling.



Vref (+/
-
): reference voltage.



SS: Slave select for the sy
nchronous serial port.



T0CK1: clock input to TIMER 0.



T1OSO: Timer 1 oscillator output.



T1OS1: Timer 1 oscillator input.



T1CK1: clock input to Timer 1.



PGD: Serial programming data.



PGC: serial programming clock.



PGM: Low Voltage Programming input.



INT: ex
ternal interrupt.



RD: Read control for parallel slave port.



CS: Select control for parallel slave.



PSP0 to PSP7: Parallel slave port.



VDD: positive supply for logic and input pins.



VSS: Ground reference for logic and input/output pins.






Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


76


VAST



A
ppendix
-
3

Pin

Details of ZIGBEE

















Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


77


VAST



Appendix
-
4

Pin Details of MAX232


Pin number

Name

Purpose

Signal
Voltage

Capacitor
Value
MAX232

1

C1+

+ connector
for capacitor
C1

capacitor
should stand
at least 16V

1µF

2

V+

output of
voltage pump

+10V,
capacitor
should stand
at least 16V

1µF to V
CC

3

C1
-

-

connector
for capacitor
C1

capacitor
should stand
at least 16V

1µF

4

C2+

+ connector
for capacitor
C2

capacitor
should stand
at least 16V

1µF

5

C2
-

-

connector
for capacitor
C2

capacitor
should stand
at least

16V

1µF

6

V
-

output of
voltage pump
/ inverter

-
10V,
capacitor
should stand
at least 16V

1µF to GND

7

T2
out

Driver 2
output

RS
-
232


8

R2
in

Receiver 2
input

RS
-
232


9

R2
out

Receiver 2
output

TTL


10

T2
in

Driver 2
input

TTL


11

T1
in

Driver 1
input

TTL


12

R1
out

Receiver 1
output

TTL


13

R1
in

Receiver 1
input

RS
-
232


14

T1
out

Driver 1
output

RS
-
232


15

GND

Ground

0V

1µF to V
CC

16

V
CC

Power supply

+5V

see above


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


78


VAST



V
+ (
2) is also connected to VCC

via a capacitor (C3). V
-
(6) is connected to GND via
a capacitor (C4). And
GND (
15) and
VCC (
16) are also connected by a capacitor
(C5), as close as possible to the pins.



Appendix
-
5

Pin Details of RS 232


DB
-
9 Pin

IDC internal

pin name
*

Name

Dir

Description

1

1

CD


Carrier Detect

2

3

RXD


Receive Data

3

5

TXD


Transmit Data

4

7

DTR


Data Terminal Ready

5

9

GND


System Ground

6

2

DSR


Data Set Ready

7

4

RTS


Request to Send

8

6

CTS


Clear to Send

9

8

RI


Ring
Indicator




Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


79


VAST



Appendix
-
6

Source Code

of PIC











Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


80


VAST



unsigned short
i,j,k,scan,scan1,read,v1[50],aa,v2,v3,v4,read1,pp,tt,cc,hh,r1,flag=0;

void main()

{

trisb=0xf0;

portb=0xff;

trisc.f5=1;

OPTION_REG.F7=0;

usart_init(9600);

lcd_init(&portd);

lcd_cmd(lcd_clear);

lcd_cmd(lcd_cursor_off);

lcd_out(1,1,"welcome");

delay_ms(1000);



while(1)

{

if((portc.f5==0)&&(flag==0))


{


START1:


lcd_cmd(lcd_clear);


lcd_out(1,1,"class?");


delay_ms(1000);


for(j=4;j<5;)


{


scan=0x01;


cc=0;


for(i=0;i<2;i++)


{


lcd_cmd(lcd_clear);


scan=~scan;


scan1=scan&0x0f;


portb= scan1;


scan=~scan;


scan=scan&0x0f;


scan=scan*2;


rea
d=portb;


read=(read&0xf0);


read1=(read+scan1);


switch(read1)


{


case 0xED:v1[j]=('4'); lcd_chr(1,1,'4');break;


case 0xDE:v1[j]=('1'); lcd_chr(1,1,'1');break;


case 0xBE:v1[j]=('2'); lcd_chr(1,1
,'2');break;


case 0x7E:v1[j]=('3'); lcd_chr(1,1,'3');break;


default:cc=cc+1; break;


}


delay_ms(1000);



}


j++;


if(CC==2)


{


j=j
-
1;


Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


81


VAST



} }


if((v1[4]=='4'||v1[4]=='3'||v1[4]=='2'||v1[4]=='1'))


{



START2:

lcd_out(1,1,"teacher ?");


delay_ms


(1000);


for(j=6;j<7;)

{

scan=0x08;


tt=0;

for(i=0;i<1;i++)

{

lcd_cmd(lcd_clear);

scan=~scan;

scan1=scan&0x0f;

portb= scan1;

scan=~scan;


scan=scan&0x0f;



read=portb;


read=(read&0xf0);


read1=(read+scan1);


switch(read1)


{

case 0xE7:v1[j]=('C'); lcd_chr(1,1,'C'); break;

case 0xD7:v1[j]=('D'); lcd_chr(1,1,'D'); break;


case 0x77:v1[j]=('F'); lcd_chr(1,1,'F'); break;


case 0xB
7:v1[j]=('E'); lcd_chr(1,1,'E'); break;


default:tt=tt+1; break;


}


delay_ms(1000);

}

j++;

if(tt==1)

{

j=j
-
1;


} }


if((v1[6]=='E'||v1[6]=='F'||v1[6]=='D'||v1[6]=='C'))


{


START3:


lcd_out(1,1,"hour ?");


delay_ms(1000);


for(j=7;j<8;)


{


scan=0x01;


hh=0;


for(i=0;i<2;i++)


{


lcd_cmd(lcd_clear);


scan=~scan;


scan1=scan&0x0f;


portb= scan1;


scan=~scan;

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


82


VAST



scan=scan&0x0f;


scan=scan*2;


read=portb;


read=(read&0xf0);


read1=(read+scan1);


switch(read1)


{


case 0xED:v1[j]=('4'); lcd_chr(1,1,'4');break;


case 0xDE:v1[j]=('1'); lcd_chr(
1,1,'1');break;


case 0xBE:v1[j]=('2'); lcd_chr(1,1,'2');break;


case 0x7E:v1[j]=('3'); lcd_chr(1,1,'3');break;


case 0x7D:v1[j]=('7');lcd_chr(1,1,'7'); break;


case 0xDD:v1[j]=('5'); lcd_chr(1,1,'5'); break;


c
ase 0xBD:v1[j]=('6');lcd_chr(1,1,'6'); break;


default:hh=hh+1; break;


}




delay_ms(1000);


}


j++;


if(hh==2)


{


j=j
-
1;



} }


if((v1[7]
-
0x30)>0&&(v1[7]
-
0x30)<8)

{

lcd_out(1,1,"absentees ?");

delay_ms(1000);


for(j=8;j<30;)

{

if(flag==1)

break;

scan=0x01;

aa=0;

for(i=0;i<3;i++)

{

if(flag==1)

break;

lcd_cmd(lcd_clear);

scan=~scan;

scan1=scan&0x0f;

portb= scan1;

scan=~scan;


scan=scan&0x0f;


scan=scan*2;


read=portb;


read=(read&0xf0);


read1=(read+scan1);


switch(read1)


{

case 0xEE:v1[j]=('0');lcd_chr(1,1,'0'); break;

case 0xED:v1[j]=('4'); lcd_chr(1,1,'4');break;

case 0xDE:v1[j]=('1'); lcd_chr(1,1,'1');break;

case 0xBE:v1[j]=('2'); lcd_chr(1,1,'2');break;

case 0x7E:
v1[j]=('3'); lcd_chr(1,1,'3');break;

case 0x7D:v1[j]=('7');lcd_chr(1,1,'7'); break;

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


83


VAST


case 0xDD:v1[j]=('5'); lcd_chr(1,1,'5'); break;

case 0xBD:v1[j]=('6');lcd_chr(1,1,'6'); break;

case 0xEB:v1[j]=('8');lcd_chr(1,1,'8'); break;

case 0xDB:v1[j]=('9');lcd_chr(
1,1,'9'); break;

case 0xBB:v1[j]=('A'); lcd_chr(1,1,'A'); break;

default:aa=aa+1; break;


}




if(v1[j]=='A')


{


//delay_ms(1000);


flag=1;


v1[2]='B';


v1[3]='0';


v1[5]='0';


v1[j]=';';


r1=j+1;


for(k=2;k<r1;k++)

{

//delay_ms(100);

usart_write(v1[k]);

}

lcd_out(1,1,"ok");


}


delay_ms(250);

}

j++;

if(aa==3)

{

j=j
-
1;


} }


}


else


{


goto START3;


}


}

else

{

goto START2;


} }



else


{


goto START1;


}



}}}






Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


84


VAST



Appendix
-
7

Source Code of Interfacing Software

Forml
-

1

Private Sub about Click()

Forml Hide

frrnAbout Show

End Sub

Private Sub CommandiClick()

Listl Clear

Dim mj var As String

If Comboi.Text
=
“First_Year” Then

Open App.Path &


\
ecltemp.log” For Input As #1

Input #1, mjvar, datel, timel

Close #1

End If

If Comboi.Text
=
“Second_Year” Then

Open App.Path & “
\
ec2 temp.log” For Input As #1

Input #1, mjvar, datel, timel

Close #1

End If

If Comboi.Text
=
“Thrid Year” Then

Ope
n App.Path & “
\
ec3temp.log” For Input As #1

Input #1, mjvar, datel, timel

Close #1

End If

If Comboi.Text
=
“Fourth_Year” Then

Open App.Path & “
\
ec4 temp.log” For Input As #1

Input #1, mjvar, datel, timel

Close #1

End If

Text5.Text
=
mjvar

Text3.T
ext
=
datel

Text6.Text
=
timel

class_code
=
Mid(mjvar, 1, 2)

teacher_code
=
Mid(mjvar, 3, 2)

hour_code
=
Mid(mjvar, 5, 1)

absent_i
=
Mid(mjvar, 6, 2)

absent 2
=
Mid(mjvar, 8, 2)

absent 3
=
Mid(mjvar, 10, 2)

absent 4
=
Mid(mjvar, 12, 2)

absent 5
=
Mid(mjvar, 14, 2)

absent 6
=
Mid(mjvar, 16, 2)

absent 7
=
Mid(mjvar, 18, 2)

absent 8
=
Mid(mjvar, 20, 2)

absent 9
=
Mid(mjvar, 22, 2)

absent 10
=
Mid(mjvar, 24, 2)

If teacher_code
=
“01” Then

Text2.Text
=
“EC Teacher 1”

Elself teacher_code
=
“02” T
hen

Text2.Text
=
“EC Teacher 2”

ElseIf teacher_code
=
“03” Then

Text2.Text
=
“EC Teacher 3”

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


85


VAST


ElseIf teacher_code
=
“04” Then

Text2.Text
=
“EC Teacher 4”

End If

If class_code
=
“01” Then

Textl.Text
=
“EC First Year”

ElseIf class_code
=
“02” Then

Te
xtl.Text
=
“EC Second Year”

ElseIf class_code
=
“03” Then

Textl.Text
=
“ECThridYear”

ElseIf class_code
=
“04” Then

Textl.Text
=
“EC Fourth Year”

End If

Formi
-

2

Text7.Text
=
hour_code

Select Case absent 1

Case “01”

Listl.Addltem

Student 1

Cas
e “02”

Listl.Addltem

Student 2

Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “05”

Listl.Addltem

Student 5

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Addltem

Student 7

Case “08”

Listl.Addltem

Student 8

Case “09”

Listl.Addltem

Student 9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case absent_2

Case “01”

Listl.Addltem

Student 1

Case “02”

Listl.Addltem

Student 2

Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Ad
dltem

Student 4

Case “05”

Listl.Addltem

Student_S

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Addltem

Student 7

Case “08”

Listl.Addltem

Student 8

Case “09”

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


86


VAST


Listl.Addltem

Student 9

Case “10”

Listl.Addltem

Student 10”

End Sel
ect

Select Case absent_3

Case “01”

Listl.Addltem

Student 1

Case “02”

Listl.Addltem

Student 2

Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “05”

Listl.Addltem

Student_S

Case “06”

Listl.Addltem

Student 6

C
ase “07”

Listl.Addltem

Student 7

Case “08”

Listl.Addltem

Student 8

Case “09”

Listl.Addltem

Student 9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case absent_4

Case “01”

Listl.Addltem

Student 1

Case “02”

Formi
-

3

Listl.Add
ltem

Student 2

Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “05”

Listl.Addltem

StudentS

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Addltem

Student 7

Case “08”

Listl.Addltem

Student_8

Case “09”

Listl.Addltem

Student_9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case absent_S

Case “01”

Listl.Addltem

Student 1

Case “02”

Listl.Addltem

Student 2

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


87


VAST


Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “OS”

Listl.Addltem

Student_S

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Addltem

Student 7

Case “08”

Listl.Addltem

Student 8

Case “09”

Listl.Addltem

Student 9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case ab
sent 6

Case “01”

Listl.Addltem

Student 1

Case “02”

Listl.Addltem

Student 2

Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “OS”

Listl.Addltem

Student_S

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Add
ltem

Student 7

Case “08”

Listl.Addltem

Student 8

Case “09”

Listl.Addltem

Student 9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case absent 7

Case “01”

Listl.Addltem

Student 1

Case “02”

Listl.Addltem

Student 2

Case “03”

L
istl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “OS”

Formi
-

4

Listl.Addltem

Student_5

Case “06”

Listl.Addltem

Student 6

Case “07”

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


88


VAST


Listl.Addltem

Student_7

Case “08”

Listl.Addltem

Student_8

Case “09”

Listl.Addltem

St
udent_9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case absent_8

Case “01”

Listl.Addltem

Student 1

Case “02”

Listl.Addltem

Student 2

Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “05”

Listl.Addl
tem

Student 5

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Addltem

Student 7

Case “08”

Listl.Addltem

Student 8

Case “09”

Listl.Addltem

Student 9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case absent_9

Case “01”

Li
stl.Addltem

Student 1

Case “02”

Listl.Addltem

Student 2

Case “03”

Listl.Addltem

Student 3

Case “04”

Listl.Addltem

Student 4

Case “05”

Listl.Addltem

Student_S

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Addltem

Student 7

Case “08”

Listl.Addltem

Student 8

Case “09”

Listl.Addltem

Student 9

Case “10”

Listl.Addltem

Student 10”

End Select

Select Case absent 10

Case “01”

Listl.Addltem

Student 1

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


89


VAST


Case “02”

Listl.Addltem

Student 2

Case “03”

Listl.Addltem

St
udent 3

Case “04”

Listl.Addltem

Student 4

Case “05”

Listl.Addltem

Student_S

Case “06”

Listl.Addltem

Student 6

Case “07”

Listl.Addltem

Student 7

Case “08”

Formi
-

5

Listi.Addltem

Student 8

Case “09”

Listi.Addltem

Student 9

Case
“10


Listi.Addltem

Student 10”

End Select

Labelil.Caption
=
Listl.ListCount

End Sub

Private Sub exit Click()

Unload Me

End Sub

Private Sub Form Load()

If MSComml.PortOpen
=
False Then

MSCommi.PortOpen
=
True

End If

Timeri.Enabled
=
True

Timeri.
Enabled
=
True

Dim mj var As String

Dim class_code As String

Dim temp As String

Dim teacher_code As String

Dim absent_i As String

Dim absent 2 As String

Dim absent_3 As String

Dim absent 4 As String

Dim absent_5 As String

Dim absent 6 As String

Dim absent 7 As String

Dim absent_S As String

Dim absent_9 As String

Dim absent iO As String

End Sub

Private Sub port Click()

Formi Hide

portfrm. Show

End Sub

Private Sub TimerlTimer()

Label6.Caption
=
TimeValue (Now)

LabelS.Caption
=
DateValue
(Now)

End Sub

Private Sub Timer2Timer()

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


90


VAST


MSComrnl.InputLen
=
1

strdata
=
MSConimi.Input

If strdata
= “;“
Then

temp
=
Mid(Text4.Text, 1, 2)

If temp
=
“01” Then

Open App.Path & “
\
ecldata.log” For Append As #1

Write #i, Text4.Text, Date, Time

Close #
i

Open App.Path & “
\
ecltemp.iog” For Output As #1

Write #i, Text4.Text, Date, Time

Close #i

ElseIf temp
=
“02” Then

Open App.Path & “
\
ec2data.log” For Append As #1

Formi
-

6

Write #1, Text4.Text, Date, Time

Close #1

Open App.Path & “
\
ec2temp.log”
For Output As #1

Write #1, Text4.Text, Date, Time

Close #1

ElseIf temp
=
“03” Then

Open App.Path & “
\
ec3data.log” For Append As #1

Write #1, Text4.Text, Date, Time

Close #1

Open App.Path & “
\
ec3temp.log” For Output As #1

Write #1, Text4.Text, Date,

Time

Close #1

ElseIf temp
=
“04” Then

Open App.Path & “
\
ec4data.log” For Append As #1

Write #1, Text4.Text, Date, Time

Close #1

Open App.Path & “
\
ec4temp.log” For Output As #1

Write #1, Text4.Text, Date, Time

Close #1

End If

Text4.Text
=

Else:
Text4.Text
=
Text4.Text + strdata

End If

End Sub

frrnAbout
-

1

Option Explicit

Req Key Security Options...

Const READ_CONTROL
=
&H20000

Const KEY_QUERY_VALUE
=
&Hl

Const KEY_SET_VALUE
=
&H2

Const KEY CREATE SUB KEY
=
&H4

Const KEY ENUMERATE SUB KEYS
=
&H8

Const KEY NOTIFY
=
&HlO

Const KEY_CREATE_LINK


&H20

Const KEY_ALL_ACCESS
=
KEY_QUERY_VALUE + KEY_SET_VALUE +

KEY_CREATE_SUB_KEY + KEY ENUMERATE SUB KEYS +

KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL

Req Key ROOT Ty
pes...

Const HKEY LOCAL MACHINE
=
&H80000002

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


91


VAST


Const ERROR SUCCESS
=
0

Const REG SI
=
1

Unicode nul terminated strinq

Const REG DWORD
=
4

32
-
bit number

Const qREGKEYSYSINFOLOC
=
“SOFTWARE
\
Microsoft
\
Shared Tools Location”

Const qREGVALSYSINFOLOC
=

MSINFO”

Const qREGKEYSYSINFO
=
“SOFTWARE
\
Microsoft
\
Shared Tools
\
MSINFO”

Const qREGVALSYSINFO
=
“PATH”

Private Declare Function ReqOpenKeyEx Lib “advapi32” Alias
“ReqOpenKeyExA” (ByVal hKey As Lonq, By al lpSubKey As Strinq, ByVal
ulOptions As Lonq, ByVa
l samDesired As Lonq, ByRef phkResult As Lonq)
As Lonq

Private Declare Function ReqQueryValueEx Lib “advapi32” Alias
“ReqQueryValueExA” (ByVal hKey As Lox q, ByVal lpValueName As Strinq,
ByVal lpReserved As Lonq, ByRef ipType As Lonq, ByVal lpData As Sti
inq, ByRef lpcbData As Lonq) As Lonq

Private Declare Function ReqCloseKey Lib “advapi32” (ByVal hKey As
Lonq) As Lonq

Private Sub cmdSyslnfoClick()

Call StartSyslnfo

End Sub

Private Sub cmdOKClick()

Unload Me

Forml
.
Show

End Sub

Public Sub StartS
yslnfo()

On Error GoTo SyslnfoErr

Dim rc As Lonq

Dim SyslnfoPath As Strinq

Try To Get System Info Proqram Path
\
Name From Reqistry...

If GetKeyValue(HKEY LOCAL MACHINE, qREGKEYSYSINFO, qREGVALSYSINFO,
SyslnfoPath) Then Try To Get System Info Proqram Pa
th Only From
Reqistry...

ElseIf GetKeyValue (HKEY LOCAL MACHINE, qREGKEYSYSINFOLOC,
qREGVALSYSINFOLOC, SyslnfoPath) Then Validate Existance Of Known 32
Bit File Version

If (Dir(SyslnfoPath & “
\
MSINFO32.EXE”) <> “) Then

SyslnfoPath
=
SyslnfoPath & “
\
MSIN
FO32.EXE”

Error


File Can Not Be Found...

Else

GoTo SyslnfoErr

End If

Error
-

Reqistry Entry Can Not Be Found...

GoTo SyslnfoErr

End If

Call Shell (SyslnfoPath, vbNormalFocus)

Exit Sub

SyslnfoErr:

MsqBox “System Information Is Unavailable At Th
is Time”, vbOKOnly

End Sub

Public Function GetKeyValue(KeyRoot As Lonq, KeyName As Strinq,
SubKeyRef As Strinq, ByRef KeyVal I s Strinq) As Boolean

frrnAbout
-

2

i As Long

rc As Long

Attendance Automation


MINI

PROJECT REPORT ‘1
1







Dept. of ECE


92


VAST


hKey As Long

hDepth As Long

KeyValType As Long tmpVal As String

Loop Counter

Return Code

Handle To An Open Registry Key

Data Type Of A Registry Key Tempory Storage For A Registry Key V

Dim KeyValSize As Long

Size Of Registry Key Variable

Open RegKey Under KeyRoot {HKEY LOCAL MACHINE.

rc
=
RegOpenKeyEx(KeyRoot,
KeyName, 0, KEYALLACCESS, hKey)

Open
Registry Key

If (rc
<>
ERROR_SUCCESS) Then GoTo GetKeyError

tmpVal
=
String$(1024, 0)

KeyValSize
=
1024

If (rc
<>
ERROR_SUCCESS) Then GoTo GetKeyError

If (Asc(Mid(tmpVal, KeyValSize, 1))
=
0) Then tmpVal
=
Left (
tmpVal,
KeyValSize


1)

Else

tmpVal
=
Left (tmpVal, KeyValSize)

End If

Determine Key Value Type For Conversion.

Select Case KeyValType

Case REGSZ

KeyVal
=
tmpVal

Case REGDWORD

For i
=
Len (tmpVal) To 1 Step
-
l

KeyVal
=
KeyVal + Hex(Asc(Mid(tmpVal
, i, 1)))

Next

KeyVal
=
Format$(”&h” + KeyVal) End Select

GetKeyValue
=
True rc
=
RegCloseKey(hKey) Exit Function

GetKeyError:

Cleanup After An Error Has Occured.

KeyVal
=

GetKeyValue
=
False

rc
=
RegCloseKey(hKey)

End Function

Private Sub Form Unload (Cancel As Integer)

Forml
.
Show

Handle Error.

Allocate Variable Space

Mark Variable Size