Sie sind auf Seite 1von 82

1

ABSTRACT

RFID (radio frequency identification)based attendance system is a microcontroller based system for identifying persons, automatically register the attendance and stores it in the EEPROM. The main components of this system are an 89S52 microcontroller, an RFID reader module and an EEPROM.

RFID reader module, also called as interrogators, convert radio waves


returned from the RFID tag into a form that can be passed on to Controllers, which can make use of it. RFID tags and readers have to be tuned to the same frequency in order to communicate. RFID systems use many different frequencies, but the most common and widely used & supported by our Reader is 125 KHz. Each individual is given a tag, and the passive tags are excited when it is in magnetic proximity of the reader module and sends a code. The code is received, decoded and processed by the microcontroller and stored in the EEPROM

INDEX

CHAPTER
1.

CONTENTS Introduction Block Diagram 2.1 Block Diagram Description

PAGE 1

2.

3.

Circuit 3.1 3.2 Circuit Description Circuit Operation 4 8 10

4. 5.

Microcontroller Program PCB 5.1 5.2 5.3 PCB Fabrication PCB & Component Layout Soldering

13 15 17 19 20

6. 7.

Estimate Conclusion

References Datasheets

21 22

CHAPTER 1 INTRODUCTION
Nowadays electronics and communication engineering is a fast growing field. The fast growing technology is being implemented in almost all fields including buisness, academics, medicine etc. Almost every aspects of our day to day life are influenced by these changes in the electronics industry. The result is better reliability and greater profit with low cost. Here, in this project we introduce a fully automated, electronic version of our daily attendance system. We use a radio frequency identification module for identifying individuals. Each individual is provided with a RF tag (which consists of an antenna and an embedded chip). The RF tag gets energized by the magnetic field provided by the receiver module when it is in close proximity (within 15 cm) and sends the particular code stored within. The RF reader module receives the code, decodes it is stored in the EEPROM connected along with the time and date provided by the DS 1307(real time clock).

CHAPTER 2 BLOCK DIAGRAM

2.1 BLOCK DIAGRAM DESCRIPTION


EEPROM

REAL TIME CLOCK

RF tag

RF ID reader module

Microcontroller

Keyboard and display unit

Serial port

Fig 2.1 Block Diagram

2.1 BLOCK DIAGRAM DESCRIPTION

Figure 2.1 shows the block diagram .Following is the description of each block in detail. RF ID tag consists of a small antenna and a chip (memory element) embedded within. It is designed in such a way that it looks like an identification card; we can write anything on it. The tag is energized when it is in the close proximity of the receiver module and it sends the data to the receiver module serially. Here we use passive tagsi.e., tags which do not need any power supply. RF ID receiver consists of a chip programmed for the sole purpose. It includes a magnetising coil for creating a field. The field have a range up to 15 cm. Here we use the whole receiver unit can be considered as a 10 pin IC. 89S52 microcontroller is used here. Microcontroller is programmed to co-ordinate the whole processes. DS1307 is used as the real time clock. Real-time clock (RTC) counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap-year compensation valid up to 2100. It is battery backed and has two wire serial interface. The RTC provides the date and time for registering the attendance. AT24C08 is the EEPROM used. It is an Internally Organized 256 x 8 (2K), 512 x 8 (4K) or 1024 x 8 (8K) memory unit with 2-Wire Serial Interface. The name, date and time is stored in the EEPROM. Data is written using the I2C protocol. Keyboard and display unit consists of the keyboard and a 16*1 LCD screen for display. Individual names can be entered using the keyboard and LCD displays all the procedures. Serial port provides path for communication with PC. The name, time and date are displayed in the PC. PC can also be used to store the data in replacement of the EEPROM.

CHAPTER 3

CIRCUIT

3.1 CIRCIUT DESCRIPTION Figure 3.1 shows the circuit diagram of the RFID attendance system Figure 3.0 shows the circuit diagram of the power supply circuit. This section uses a voltage regulator LM 7805, 4 diodes and two capacitors. The voltage regulator IC has three pins-input pin, output pin and ground pin. The diode D2 ensures that the circuit does not get damaged even if the power source gets reversed. Two capacitors C3 and C4 are used at the input and output of the voltage regulator in order to avoid ripples in the input and output voltage of the regulator. Figure 3.1 shows the circuit diagram of the RFID attendance system .The circuits consists of the 89S52 microcontroller, RFID reader module, a real time clock IC, an EEPROM,LCD, keyboard and arrangements for serial communication. Each component is explained as below. The RFID receiver module communicates serially with the microcontroller through the RXD pin (pin 10). Receiver module consists of an embedded circuit solely designed for this purpose and a magnetising coil for energising the tags. The LCDs pins D0 to D7 are connected to the port 1(p1.0 to p1.7). The LCD is 16*1 type and has to be provided with separate supply for backlight. The RS, RW, E pins are connected to p0.0, p0.1, p0.2 respectively. We use DS1307 as the real time clock. The DS1307 Serial Real-Time Clock is a lowpower; full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially via a 2-wire, bi-directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24hour or 12-hour format with AM/PM indicator. The DS1307 has a built-in power sense circuit that detects power failures and automatically switches to the battery supply. It is a 56-byte, battery-backed, non-volatile (NV) RAM for data storage with two-wire serial interface. It has Programmable square wave output signal. It consumes less than 500nA in battery backup mode with oscillator running. AT24C08 is the EEPROM used. The AT24C08 provides 8192 bits of serial electrically erasable and programmable read only memory (EEPROM) organized as 1024 word of 8 bits each. The device is optimized for use in many industrial and commercial applications where low power and low voltage operation are essential. It is an 8-pin IC and we write data by I2C protocol. MAX232 is used for serial communication. It is a +5V-Powered, Multichannel RS232Drivers/Receivers and pin 10(t1 in) is connected to the TXD pin of the microcontroller.

CIRCUIT DIAGRAM

+5V D1 L1 230V AC 230/0-12V D2 1N4007 1N4007 D3 D4 1N4007 C1 IC1 1 LM7805 3 C2

1000uF/25V 2

100uF/16 v

1N4007

Fig 3.0 Circuit diagram of the power supply unit

Fig 31 main Circuit diagram

3.2 CIRCUIT OPERATION The tag gets energized when it is in the magnetic proximity of the RFID receiver module. The receiver module reads the data in the individual cards and sends it serially to the pin 10(RXD). The microcontroller is programmed to process the data and store the date and time for registering the address. The date and time is provided by the DS1307 real time clock. The DS1307 Serial Real-Time Clock is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially via a 2-wire, bi-directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12 hour format with AM/PM indicator. The DS1307 has a built-in power sense circuit that detects power failures and automatically switches to the battery supply. The details of the authorised individuals will be stored in the microcontroller and when the mc receives the data serially from the RFID reader, it checks the details; say it checks the last 2 bytes of the 12byte address. Using the keyboard we can add or discard an user. Also we can enter the name of the individual using the 4*4 keyboard. AT24C08 is used as EEPROM with an internally organised 8K memory. It is programmed using the I2C protocol through the 2-wire serial interface. The device is optimized for use in many industrial and commercial applications where low power and low voltage operation are essential. The name of the individual, date and time of logging in is stored in the EEPROM. The SDA and SCL pins are connected to the port 0.6 and port 0.7 resp. the A0, A1, A2 pins are grounded. The LCD is connected to the port 1; i.e. D0 to D7 are connected to p1.0 to p1.7 respectively. Other connections of the LCD are given accordingly. The LCD is programmed so that it displays all the proceedings including displaying the name, date, time and data stored in the EEPROM. The PC interfacing is provided using serial data transfer and with the help of a VISUAL BASIC program. The name of the individuals, date and time are displayed and along with that an attendance register is created. The serial data transfer is done through one of the COM ports of the PC using an RS232 connector. To drive the RS232 we use a MAX232 IC which is a 16 pin IC. The connections are made as shown in the circuitdiagram.

10

CHAPTER 4 MICROCONTROLLER PROGRAM


;p1.0_7 connected to D0_7 of lcd ;p0.0 to RS ;p0.1 to RW ;p0.2 to E ;p0.3 to sda rtc ;p0.4 to scl rtc ;p0.5 to sda1 eeprom

11

;p0.6 to scl1 eeprom ;p3.0(rxd) to rfid ;p3.1(txd) to pc ;******************************************************* ;******************************************************* SDA SCL EQU P0.3 EQU P0.4

SDA1 EQU P0.5 SCL1 EQU P0.6

RB0 RB1 RB2

EQU 00H EQU 08H EQU 10H

DS1307W DS1307R

EQU 0D0H EQU 0D1H

ROM_W ROM_R

EQU 0A0H EQU 0A1H

UP

EQU P3.2 EQU P3.3 EQU P3.4 EQU P3.5

DOWN ENTER CANCEL

DSEG

;internal data memory

12

ORG 20H FLAGS1: RECEIVED AM MAS BIT BIT BIT DS 1

;bit addressable

FLAGS1.0 FLAGS1.1 FLAGS1.2 FLAGS1.3 1 DS 1

LASTREAD BIT COUNTER: BITCNT: BYTECNT: BYTE: BYTES: SECS: MINS: HRS: DAY: DATE1: MONTH: YEAR: TOTAL: TEMP: TEMPS: KB_DATA: ROLLNOS: COUNTT: STACK: DS DS DS DS DS DS DS DS DS DS DS

1 12 DS 1 1 1 1 DS DS 1 DS 1 DS 1 2 DS DS ;hold card owner roll no 1 1 1 1 1 1 12 ;hold data read from eeprom

;*****MACROS******

13

SCL_HIGH MACRO SETB SCL JNB SCL, $ ENDM

CSEG

;program memory

; ---------==========----------==========---------=========--------; Main routine. Program execution starts here. ; ---------==========----------==========---------=========--------ORG 0H

AJMP MAIN

ORG 23H JMP SERIAL ; ---------==========----------==========---------=========--------MAIN: MOV PSW, #RB0 MOV SP, #STACK ; ********************************************************** ; INITILIZE RTC ; Select register bank 0

; ********************************************************** SETB SDA SCL_HIGH ; ENSURE SDA HIGH ; ENSURE SCL HIGH

14

CALL OSC_CONTROL

;Initilize the RTC

; ********************************************************** MOV TMOD, #20H MOV TH1, #0FDH MOV SCON, #50H SETB ES SETB EA SETB TR1

MOV COUNTER, #01H CLR RECEIVED

CALL INT_LCD CALL TITLES CALL DELAYS CALL DELAYS

CALL READ_TOTAL

; ********************************************************** ; CHECK FOR ENTER THE TIME

; ********************************************************** LCALL SEND_START MOV A, #DS1307W LCALL SEND_BYTE ; SEND 2WIRE START CONDITION ; SEND DS1307 WRITE COMMAND

15

MOV A, #08H DS1307 LCALL SEND_BYTE LCALL SEND_STOP LCALL SEND_START MOV A, #DS1307R LCALL SEND_BYTE LCALL READ_BYTE MOV R1, A LCALL SEND_STOP

; SET POINTER TO REG 08H ON

; SEND STOP CONDITION ; SEND START CONDITION ; SEND DS1307 READ COMMAND

; READ A BYTE OF DATA

; SEND 2WIRE STOP CONDITION

CJNE A, #0AAH, SET_RTC AJMP TOP

;************************************************************ TOP: CALL RTCLOCK MOV R0, #04H RX3: RX1: RX2: MOV R1, #0FFH MOV R2, #0FFH JB RECEIVED,TOPS DJNZ R2, RX2 DJNZ R1, RX1 DJNZ R0, RX3 AJMP TOP ;************************************************************ TOPS: MOV COUNTER, #01H CLR ES

16

CLR RECEIVED MOV R1, #BYTES MOV R4,#03H MOV R6, #12 ;CHECK FOR MASTER CARD ;MASTER ADDRESS ;NUMBER OF BYTES

CALL READ_EEPROM CLR MAS CALL COMPARE JNB MAS, OTHER1 CALL DISPLAY CALL DELAYS CALL DELAYS ;"MASTER DETECTED

REP1:

MOV TEMP, #01H CALL DISPLAY1 SETB UP SETB DOWN SETB ENTER SETB CANCEL ;"Press enter to add tag"

UJI1:

JNB CANCEL, VBN1 JNB UP, VBN2 JNB DOWN, VBN3 JNB ENTER, VBN4 AJMP UJI1

OTHER1:

AJMP OTHER

VBN1:

JNB CANCEL, $

17

SETB ES CLR RECEIVED AJMP TOP

VBN2:

JNB UP, $ CALL DISPLAY1 MOV TEMP, #01H AJMP UJI1 ;"PRESS ENTER TO ADD TAG"

VBN3: TAG"

JNB DOWN, $ CALL DISPLAY2 MOV TEMP, #02H AJMP UJI1 ;"PRESS ENTER TO EDIT

;************************************************************** GHO1: CJNE R5, #02H, GHO2 JNB ENTER, $ JMP DELETE_PGM ;Delete Tag

GHO2:

JNB ENTER, $ AJMP UJI1

REAP1:

CALL DELAY JNB CANCEL, $ AJMP REP1

;************************************************************* VBN4: MOV R5, TEMP CJNE R5, #01H, GHO1 ;Add tag

18

VBC1:

CLR RECEIVED CALL DISPLAY3 SETB ES ;Show Tag

FVG1: receive tag

JNB CANCEL, REAP1 JNB RECEIVED,FVG1 CLR ES

;stay in loop untill cancell or

LOOP1:

CALL DISPLAY4 MOV TEMP, #00H CALL CLEAR_RAM

;plz enter ROLL NO:

;CLEARS ROLLNOS IN RAM

EDC: lcd

CLR C CALL LOOP INC TEMP MOV R2,TEMP CJNE R2, #01H, EDC1 MOV R1, #ROLLNOS MOV @R1, KB_DATA ;key is stored in KB_DATA, displays on

EDC1: CJNE R2, #02H, EDC MOV R1, #ROLLNOS+1 MOV @R1, KB_DATA CALL DELAYS CALL PRESS_ENTER SETB ENTER SETB CANCEL HHJ: JNB CANCEL, LOOP1S

19

JB ENTER, HHJ JNB ENTER, $ CALL READ_TOTAL INC TOTAL

MOV R7, T0TAL CALL GET_ADDRESS MOV R1, #BYTE MOV R4, R7 MOV R6, #12 CALL STORE_EEPROM CALL MDELAY MOV R1, #ROLLNOS MOV A, R7 ADD A, #0CH MOV R4, A MOV R6, #2 CALL STORE_EEPROM CALL MDELAY CALL ID_SAVED CALL WRITE_TOTAL CALL DELAYS JNB ENTER, $ AJMP REP1 LOOP1S: AJMP LOOP1

;********************************************************************* LOOP:

20

ACALL GET_KEY JNB ENTER, GHBH JNB CANCEL, DCFV1 JNC LOOP MOV R4, KB_DATA CALL DATAWRT RET GHBH: JNB ENTER, $ MOV TEMP, #2 RET DCFV1: JNB CANCEL, $ AJMP LOOP1 ;******************************************************************** OTHER: CALL READ_TOTAL MOV R2, TOTAL CALL CLEAR_RAM

MOV TEMP, #01H JKP: MOV R7, TEMP CALL GET_ADDRESS MOV A, R7 CJNE A, #0FFH, CONT SJMP ERR CONT:MOV R1, #BYTES

21

MOV R4, R7 MOV R6, #12 CALL READ_EEPROM CLR MAS INC TEMP CALL COMPARE JNB MAS, JKP MOV R1, #ROLLNOS MOV A, R7 ADD A, #0CH MOV R4, A MOV R6, #2 CALL READ_EEPROM CALL NAMES1 CALL DISP_ROLLNO AJMP DON

ERR: CALL CARD_ERROR SETB ES CALL DELAYS CALL DELAYS AJMP TOP

DON: CALL TRANSMIT_DATA SETB ES CALL DELAYS CALL DELAYS

22

AJMP TOP

NAMES1:

JNB AM, ASX1

CALL NAME1 RET ASX1: CALL NAME2 RET

;******************************************************************* SEND_START: SETB SDA ; BEGIN START CODITION

SCL_HIGH CLR NOP NOP CLR RET ;**************************************************************** SEND_BYTE: MOV BITCNT, #08H SB_LOOP: RLC A MOV SDA, C SCL_HIGH NOP NOP CLR SCL SCL SDA

23

DJNZ BITCNT, SB_LOOP SETB SDA SCL_HIGH NOP NOP CLR SCL NOP NOP RET ; ************************************************************* ; ********************************************************** SEND_STOP: CLR SDA

SCL_HIGH SETB RET ;********************************************************** ;********************************************************** SDA

READ_BYTE: MOV BITCNT, #08H MOV A, #00H SETB SDA READ_BITS: SCL_HIGH MOV C, SDA RLC A

24

CLR SCL DJNZ BITCNT, READ_BITS JB LASTREAD, ACKN CLR SDA ACKN: SCL_HIGH CLR SCL RET ;*********************************************************** SERIAL: PUSH PSW MOV PSW,#RB1 PUSH ACC JB TI,TRANS MOV A,SBUF CJNE A,#0AH,DOWNW MOV COUNTER,#01H AJMP DDWN DOWNW:CJNE A,#0DH,DOWN2 MOV COUNTER,#01H AJMP DDWN DOWN2: MOV R1,COUNTER CJNE R1,#01H,YH1 MOV BYTE,A AJMP DOWN1 YH1: CJNE R1,#02H,YH2 ; save current registerset

25

MOV BYTE+1,A AJMP DOWN1 YH2: CJNE R1,#03H,YH3 MOV BYTE+2,A AJMP DOWN1 YH3: CJNE R1,#04H,YH4 MOV BYTE+3,A AJMP DOWN1 YH4: CJNE R1,#05H,YH5 MOV BYTE+4,A AJMP DOWN1 YH5: CJNE R1,#06H,YH6 MOV BYTE+5,A AJMP DOWN1 YH6: CJNE R1,#07H,YH7 MOV BYTE+6,A AJMP DOWN1 YH7: CJNE R1,#08H,YH8 MOV BYTE+7,A AJMP DOWN1 YH8: CJNE R1,#09H,YH9 MOV BYTE+8,A AJMP DOWN1 YH9: CJNE R1,#0AH,DOWN1 MOV BYTE+9,A SETB RECEIVED AJMP DOWN1

26

DOWN1:INC COUNTER

DDWN:

CLR RI POP ACC

POP PSW RETI

TRANS: CLR TI POP ACC POP PSW RETI ;*********************************************************** ;**********************************************************

OSC_CONTROL: ACALL MOV ACALL MOV ACALL SETB ACALL ACALL MOV ACALL ACALL CLR SEND_START ; GENERATE START CONDITION A,#DS1307W ; 1101 0000 ADDRESS + WRITE-BIT SEND_BYTE ; SEND BYTE TO 1307 A,#00H ; ADDRESS BYTE TO REGISTER 00H

SEND_BYTE ; SECONDS REGISTER, ALWAYS LEAVE LASTREAD ; REG 00H-BIT #7 = 0 (LOW) SEND_STOP ; IF REG 00H-BIT #7 = 1 CLOCK SEND_START ; OSCILLATOR IS OFF. A,#DS1307R ; 1101 0001 ADDRESS + READ-BIT SEND_BYTE ; READ_BYTE ; READ A BYTE FROM THE 1307 ACC.7 ; CLEAR REG 00H-BIT #7 TO ENABLE

27

OSC_SET: PUSH ACALL ACALL MOV ACALL MOV ACALL POP ACALL ACALL RET ACC

; OSCILLATOR. ; SAVE ON STACK

SEND_STOP ; SEND_START ; A,#DS1307W ; SETUP TO WRITE SEND_BYTE ; A,#00H ; REGISTER 00H ADDRESS

SEND_BYTE ; ACC ; GET DATA TO START OSCILLATOR

SEND_BYTE ; SEND IT SEND_STOP

;******************************************************************** ;lcd subroutines ;******************************************************************** INT_LCD: ;initialise lcd

MOV A, #38H;5*7 matrix ACALL CMDWRT MOV A, #0EH ACALL CMDWRT MOV A, #01H;clr disp ACALL CMDWRT MOV A, #084H ACALL CMDWRT RET CMDWRT: PUSH ACC ;write command, command in R4 ;first row, 4th position ;disp on, cursor blinks

28

ACALL READY MOV A, R4 MOV P1, A CLR P2.0 CLR P2.1 SETB P2.2 CLR P2.2 POP ACC RET DATAWRT: PUSH ACC ;write data, data in R4 ;set e high ;h-l pulse

ACALL READY MOV A, R4 MOV P1, A SETB P2.0 CLR P2.1 SETB P2.2 CLR P2.2 POP ACC RET READY: SETB P1.7 CLR P2.0 SETB P2.1 BACK: CLR P2.2 SETB P2.2 ;to check disp ready ;h-l pulse

29

JB P1.7, BACK RET BCDWRT: PUSH ACC ;write packed bcd, bcd data in R3

ACALL READY MOV A, R3 ANL A, #0F0H SWAP A ADD A, #30H MOV R4, A CALL DATAWRT MOV A, R3 ANL A, #0FH ADD A, #30H MOV R4, A CALL DATAWRT POP ACC RET ; ********************************************************************** **

TITLES: MOV DPTR,#MSAG CALL LCD_MSG RET MSAG: DB 1H,81H,'RFID Based',0C0H,'Attendance Sys',00H

30

;************************************************************* DELAYS: MOV R0,#05H RS3: MOV R1,#0FFH ;One second delay routine

RA1: MOV R2,#0FFH RS2: NOP DJNZ R2,RS2 DJNZ R1,RA1 DJNZ R0,RS3 RET ;************************************************************** READ_TOTAL: MOV SEND ADDRESS CALL OUTS MOV A,#02H ;SEND IT ;GET LOW BYTE ADDRESS ;SEND IT ;GET DATA BYTE A,#WTCMD ;LOAD WRITE COMMAND TO

CALL OUT CALL CREAD MOV TOTAL,R1 CALL MDELAY RET

; ********************************************************************** ****** SET_RTC: MOV TEMP, #00H LAOP: INC TEMP MOV R1, TEMP

31

CJNE R1,#01H,IOP1 CALL DATE_DISP CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H SWAP A MOV DATE1, A CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H ORL A, DATE1 MOV DATE1, A CALL DELAY AJMP LAOP ;enter date ;key in kb_data(ascii), displayed on lcd

IOP1: CJNE R1, #02H, IOP2 CALL MON_DISP CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H SWAP A MOV MONTH, A CALL GET_KEY

;GET MONTH

32

MOV A, KB_DATA CLR C SUBB A, #30H ORL A, MONTH MOV MONTH, A CALL DELAY AJMP LAOP

IOP2: CJNE R1, #03H, IOP3 CALL YR_DISP CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H SWAP A MOV YEAR, A CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H ORL A, YEAR MOV YEAR, A CALL DELAY AJMP LAOP IOP3: CJNE R1, #04H, IOP4 CALL DAY_DISP CALL GET_KEY

;GET YEAR

;GET DAY

33

MOV A, KB_DATA CLR C SUBB A, #30H MOV DAY, A CALL DELAY AJMP LAOP IOP4: CJNE R1, #05H, IOP5 CALL HR_DISP CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H SWAP A MOV HRS, A CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H ORL A, HRS MOV HRS, A CALL DELAY AJMP LAOP IOP5: CJNE R1, #06H, IOP6 CALL MIN_DISP CALL GET_KEY MOV A, KB_DATA CLR C ;GET MIN ;GET HOUR

34

SUBB A, #30H SWAP A MOV MINS, A MOV R4, KB_DATA CALL WRLCDDATA CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H ORL A, MINS MOV MINS, A CALL DELAY AJMP LAOP IOP6: CJNE R1, #07H, STORE_RTC CALL AMS_DISP CALL GET_KEY MOV A, KB_DATA CLR C SUBB A, #30H CJNE A, #00H, GBBN1 ;GET AM/PM

SETB AMS CALL AM_DISP AJMP GBBN2 GBBN1: CLR AMS

CALL PM_DISP GBBN2: CALL DELAY

35

AJMP LAOP ; ********************************************************************** ********** STORE_RTC: LCALL SEND_START MOV A, #DS1307W LCALL SEND_BYTE MOV A, #08H BEGINNING LCALL SEND_BYTE MOV A, #0AAH SPACE LCALL SEND_BYTE LCALL SEND_STOP ; SEND 2WIRE STOP CONTION ; SEND 2WIRE START CONDITION ; LOAD DS1307 WRITE COMMAND ; SEND WRITE COMMAND ; SET DS1307 DATA POINTER TO ; OF USER RAM 08H ; WRITE BYTE TO ENTIRE RAM

LCALL SEND_START MOV A, #DS1307W LCALL SEND_BYTE MOV A, #01H BEGINNING LCALL SEND_BYTE MOV A, MINS LCALL SEND_BYTE MOV A, HRS SETB ACC.6 JNB AMS, YUH CLR ACC.5 AJMP YUH1

; SEND 2WIRE START CONDITION ; LOAD DS1307 WRITE COMMAND ; SEND WRITE COMMAND ; SET DS1307 DATA POINTER TO ; OF 00H ; Send min

;send hr ;12 HR MODE

;AM/PM

1=PM,0=AM

36

YUH: SETB ACC.5 YUH1: LCALL SEND_BYTE MOV A, DAY LCALL SEND_BYTE MOV A, DATE1 LCALL SEND_BYTE MOV A, MONTH LCALL SEND_BYTE MOV A, YEAR LCALL SEND_BYTE LCALL SEND_STOP RET ; ********************************************************************** ******* GET_KEY: MOV P2, #0FFH K1: MOV P1, #0 MOV A, P2 ANL A, #0FH CJNE A, #0FH, K1 K2: ACALL DELAY_KB MOV A, P2 ANL A, #0FH CJNE A, #0FH, OVER SJMP K2 OVER:ACALL DELAY_KB MOV A, p2 ; SEND 2WIRE STOP CONTION ; Send yr ; Send month ; Send date ; Send Day

37

ANL A, #0FH CJNE A, #0FH, OVER1 SJMP K2 OVER1: MOV P1, #0FEH

MOV A, P2 ANL A, #0FH CJNE A, #0FH, ROW_0 MOV P1, #0FDH MOV A, P2 ANL A, #0FH CJNE A, #0FH, ROW_1 MOV P1, #0FBH MOV A, P2 ANL A, #0FH CJNE A, #0FH, ROW_2 MOV P1, #0F7H MOV A, P2 ANL A, #0FH CJNE A, #0FH, ROW_3 LJMP K2

ROW_0:

MOV DPTR, #KCODE0

SJMP FIND ROW_1: MOV DPTR, #KCODE1

SJMP FIND ROW_2: MOV DPTR, #KCODE2

SJMP FIND

38

ROW_3:

MOV DPTR, #KCODE3

FIND: RRC A JNC MATCH INC DPTR SJMP FIND MATCH: CLR A

MOVC A, @A+DPTR MOV KB_DATA, A SETB C RET DELAY_KB: PUSH R1 MOV R1, #6 AGAIN: CALL MDELAY

DJNZ R1, AGAIN POP R1 RET ;look-up table KCODE0: KCODE1: KCODE2: KCODE3: DB '0', '1', '2', '3' DB '4', '5', '6', '7' DB '8', '9', 'A', 'B' DB 'C', 'D', 'E', 'F'

;************************************************************* RTCLOCK: PUSH ACC CALL READ_CLOCK

39

MOV A, #01H CALL CMDWRT MOV A, #81H CALL CMDWRT

MOV R3, DATE1 CALL BCDWRT MOV A, #'-' CALL DATAWRT MOV R3, MONTH CALL BCDWRT MOV A, #'-' CALL DATAWRT MOV A, #'2' CALL DATAWRT MOV A, #'0' CALL DATAWRT MOV R3, YEAR CALL BCDWRT

MOV A,DAY CJNE A,#01H,TGY1 CALL SUN JMP TGY TGY1: CJNE A,#02H,TGY2 CALL MON JMP TGY

40

TGY2: CJNE A,#03H,TGY3 CALL TUE JMP TGY TGY3: CJNE A,#04H,TGY4 CALL WED JMP TGY TGY4: CJNE A,#05H,TGY5 CALL THU JMP TGY TGY5: CJNE A,#06H,TGY6 CALL FRI JMP TGY TGY6: CJNE A,#07H,TGY CALL SAT JMP TGY TGY: MOV A, #0C3H CALL CMDWRT MOV A, HRS JNB ACC.5, DCF3 CLR AM AJMP DCF2 DCF3: SETB AM DCF2: ANL A, #00011111B MOV R3, A CALL BCDWRT MOV A, #':' CALL DATAWRT

41

MOV R3, MINS CALL BCDWRT MOV A, #':' CALL DATAWRT MOV R3, SECS CALL BCDWRT MOV A, #' ' CALL DATAWRT

JNB AM, DCF0 MOV A, #'A' CALL DATAWRT JMP DCF4 DCF0: MOV A, #'P' CALL DATAWRT

DCF4: MOV A, #'M' CALL DATAWRT NOP POP ACC RET ; ********************************************************************** ** READ_EEPROM: MOV A,#ROM_W ADDRESS CALL OUTS ;SEND IT ;LOAD WRITE COMMAND TO SEND

42

MOV A,R4 CALL OUT

;GET LOW BYTE ADDRESS ;SEND IT ;LOAD READ COMMAND

MOV A, #ROM_R

CALL OUTS ;SEND IT BRDLP: CALL IN ;READ DATA

MOV @R1,a ;STORE DATA INC R1 DJNZ R6,AKLP ;INCREMENT DATA POINTER ;DECREMENT LOOP COUNTER

CALL STOP ;IF DONE, ISSUE STOP CONDITION RET ;DONE, EXIT ROUTINE

AKLP:

CLR SDA1 SETB SCL1 NOP NOP NOP NOP NOP CLR SCL1

;NOT DONE, ISSUE ACK

;NOTE 1

;NOTE 2

JMP BRDLP ;CONTINUE WITH READS ; ********************************************************************** *** STORE_EEPROM: MOV A, #ROM_W ;LOAD WRITE COMMAND

CALL OUTS ;SEND IT MOV A, R4 CALL OUT ;GET LOW BYTE ADDRESS ;SEND IT

43

BTLP: MOV A, @R1 CALL OUT INC R1 DJNZ R6, BTLP

;GET DATA ;SEND IT ;INCREMENT DATA POINTER ;LOOP TILL DONE

CALL STOP ;SEND STOP CONDITION RET ; ********************************************************************** *** OUTS: CALL START CALL DATA_WRITE CALL ACK RET ; ********************************************************************** *** OUT: CALL DATA_WRITE CALL ACK RET ; ********************************************************************** *** STOP: CLR SDA1 NOP SETB SCL1 NOP NOP SETB SDA1 NOP

44

NOP CLR SCL1 NOP SETB SDA1 RET ; ********************************************************************** ** START: NOP SETB SCL1 NOP NOP CLR SDA1 NOP NOP CLR SCL1 NOP RET ; ********************************************************************** ** DATA_WRITE: CLR C MOV R2, #08H HERE7: RLC A MOV SDA1, C SETB SCL1 SETB SDA1

45

JNB SCL1, $ NOP NOP CLR SCL1 JB SCL1, $ NOP NOP DJNZ R2, HERE7 RET ; ********************************************************************** * IN: CLR A CLR C SETB SDA1 MOV R2, #08H HERE8: SETB SCL1 JNB SCL1, $ NOP MOV C, SDA1 CLR SCL RLC A DJNZ R2, HERE8 RET ; ********************************************************************** * COMPARE:

46

MOV A, BYTES CJNE A, BYTE, FGG MOV A, BYTES+1 CJNE A, BYTE+1, FGG MOV A, BYTES+2 CJNE A, BYTE+2, FGG MOV A, BYTES+3 CJNE A, BYTE+3, FGG MOV A, BYTES+4 CJNE A, BYTE+4, FGG MOV A, BYTES+5 CJNE A, BYTE+5, FGG MOV A, BYTES+6 CJNE A, BYTE+6, FGG MOV A, BYTES+7 CJNE A, BYTE+7, FGG MOV A, BYTES+8 CJNE A, BYTE+8, FGG MOV A, BYTES+9 CJNE A, BYTE+9, FGG MOV A, BYTES+10 CJNE A, BYTE+10, FGG MOV A, BYTES+11 CJNE A, BYTE+11, FGG SETB MAS FGG: RET

47

; ********************************************************************** * DISPLAY: MOV DPTR,#MSAG2 CALL LCD_MSG RET MSAG2: DB 1H,80H,'Master Card',0C0H,'Detected...',00H ;********************************************************************** DISPLAY1: MOV DPTR, #MSAG3 CALL LCD_MSG RET MSAG3: DB 1H,80H,'Press Enter...',0C0H,'*** ADD TAG ***',00H ;********************************************************************** DISPLAY2: MOV DPTR,#MSAG4 CALL LCD_MSG RET MSAG4: DB 1H,80H,'Press Enter...',0C1H,'** EDIT TAG **',00H ;********************************************************************** DISPLAY3: MOV DPTR,#MSAG5 CALL LCD_MSG RET

48

MSAG5: DB 1H,80H,'Please show the',0C3H,'** TAG **',00H ;********************************************************************** DISPLAY4: MOV DPTR,#MSAG6 CALL LCD_MSG RET MSAG6: DB 1H,0FH,80H,'Plz enter Name',0C0H,00H ;********************************************************************** PRESS_ENTER: MOV DPTR,#MSG11 CALL LCD_MSG RET MSG11: DB 1H,82H,'Press Enter',0C4H,'to Save',00H ;********************************************************************* ID_SAVED: MOV DPTR,#MSG12 CALL LCD_MSG RET MSG12: DB 1H,83H,'TAG Saved',0C2H,'Sucessfully',00H ;********************************************************************* CARD_ERROR: MOV DPTR,#MSG14 CALL LCD_MSG

49

RET MSG14: DB 1H,84H,'Card Not',0C3H,'Programmed',00H ;********************************************************************* DELETE_PGM: CALL READ_TOTAL MOV TEMPS, TOTAL SETB UP SETB DOWN SETB ENTER SETB CANCEL MOV R5, TEMPS CJNE, R5, #00H, EDT0 CALL NO_CARD CALL DELAYS JMP REP1 EDT0: MOV R7, TEMPS CALL GET_ADDRESS MOV A, R7 ADD A, #12 MOV R1, #ROLLNOS MOV R4, A MOV R6, #2 AJMP EDIT

EDIT: CALL READ_EEPROM

50

CALL DISPLAY5 CALL DISPLAY_ROLLNO

EDIT7:JNB UP, GBN2 JNB CANCEL, VFR3 JNB DOWN, GBN1 JNB ENTER, EDIT_NAME AJMP EDIT7

VFR3: CALL DELAY JNB CANCEL, $ JMP REP1

GBN2: JNB UP, $ MOV A, TEMPS CJNE A, #01H, VFR2 MOV TEMPS, TOTAL JMP EDT0

VFR2: DEC TEMPS JMP EDT0

VFR1: INC TEMPS JMP EDT0

GBN1: JNB DOWN, $ MOV A, TEMPS

51

XRL A, TOTAL JNZ VFR1 MOV TEMPS, #01H JMP EDT0 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EDIT_NAME: JNB ENTER, $ AJMP EDIT_NAM

EDIT_NAM: NOP LAOP1: CALL DISPLAY4 ;plz enter roll no

MOV TEMP, #00H CALL CLEAR_RAM

EADC:CALL LOOPZ INC TEMP MOV R2, TEMP CJNE R2, #01H, EADC1 MOV R1, #ROLLNOS MOV @R1, KB_DATA EADC1: CJNE R2, #02H, EADC

MOV R1, #ROLLNOS+1 MOV @R1, KB_DATA

CALL DELAYS CALL PRESS_ENTER SETB ENTER

52

SETB CANCEL HHJS: JNB CANCEL, LAOP1 JB ENTER, HHJS

MOV A, TEMPS MOV R7, A CALL GET_ADDRESS MOV A, R7 ADD A, #12 MOV R1, #ROLLNOS MOV R4, A MOV R6, #2 CALL STORE_EEPROM

CALL ID_SAVED CALL DELAYS JNB ENTER, $ JMP DELETE_PGM LOOPZ: CALL GET_KEY

JNB ENTER, GAHBH JNB CANCEL, DCFAV1 JNC LOOPZ MOV R4, KB_DATA CALL WRTDATA RET GAHBH: JNB ENTER, $

MOV TEMP, #02

53

RET DCFAV1: JNB CANCEL, $

POP ACC JMP DELETE_PGM ; ********************************************************************** ***** CLEAR_RAM: MOV ROLLNOS, #0FFH MOV ROLLNOS+1, #0FFH RET ; ********************************************************************** ***** GET_ADDRESS: PUSH ACC MOV A, R7 MOV B, #10 MUL AB MOV R7, A POP ACC RET ; ********************************************************************** **** MDELAY: PUSH MOV MD_OLP: ACC A,#0A6H

54

INC NOP NOP NOP NOP NOP NOP NOP NOP JNZ NOP POP RET MADELAY: PUSH MOV MAD_OLP: INC NOP NOP NOP NOP NOP NOP NOP NOP JNZ

MD_OLP

ACC

ACC A,#036H

MAD_OLP

55

NOP POP RET ; ********************************************************************** **** WRITE_TOTAL: MOV CALL OUTS MOV A,#05H A,#WTCMD ;SEND IT ;GET BYTE ADDRESS ;SEND IT ;GET DATA ;SEND IT ;SEND STOP CONDITION ;LOAD WRITE COMMAND ACC

CALL OUT MOV A,TOTAL

CALL OUT CALL STOP CALL MDELAY RET

; ********************************************************************** **** DISP_ROLLNO: MOV R4, ROLLNOS CJNE R4, #0FFH, FV1 RET FV1: CALL DATAWRT CALL MDELAY MOV R4, ROLLNOS+1 CJNE R4, #0FFH, FV2 RET FV2: CALL DATAWRT

56

CALL MDELAY RET ; ********************************************************************** *** TRANSMIT_DATA:

MOV SBUF,#'@' CALL MDELAY MOV R3,DATE1 CALL SPLIT_DATAS MOV R3,MONTH CALL SPLIT_DATAS MOV R3,YEAR CALL SPLIT_DATAS MOV R3,DAY CALL SPLIT_DATAS MOV A,HRS ANL A,#00011111B MOV R3,A CALL SPLIT_DATAS MOV R3,MINS CALL SPLIT_DATAS MOV R3,SECS CALL SPLIT_DATAS JNB AM,DFV2 MOV SBUF,#'A' AJMP DFV1

57

DFV2: MOV SBUF,#'P' DEV1: CALL MDELAY MOV SBUF, #'#' CALL MDELAY MOV R3, ROLLNOS CALL MDELAYX MOV R3, ROLLNOS+1 CALL MDELAYX MOV R3,#0CCH CALL MDELAYX MOV SBUF,#'$' CALL MDELAY RET SPLIT_DATAS: MOV A,R3 ANL A,#0F0H SWAP A ADD A,#30H MOV SBUF,A CALL MDELAY MOV A,R3 ANL A,#0FH ADD A,#30H MOV SBUF,A CALL MDELAY RET MDELAYX:

58

CJNE R3,#0FFH,WSE RET WSE: MOV SBUF,R3 CALL MDELAY RET

59

CHAPTER 5 PCB
5.1 PCB FABRICATION PCB Preparation You need to generate a positive (copper black) UV translucent artwork film. You will never get a good board without good artwork, so it is important thing to get a clear sharp image with a very solid opaque black. Artwork is drawn using PCB Wizard software. While designing immense care must be taken to minimize jumpers. It is absolutely essential that your PCB software prints holes in the middle of pads, which will act as center marks when drilling. It is virtually impossible to accurately hand-drill boards without these holes. The artwork must be printed such that the printed side is in contact with the PCB surface when exposing, to avoid blurred edges. In practice, this means that if you design the board as seen from the component side, the bottom (solder side) layer should be printed mirrored. Etching Ferric Chloride etchant is a messy stuff, but easily available and cheaper than most alternatives. It attacks any metal including stainless steel. So when setting up a PCB etching area, use a plastic or ceramic sink, with plastic fittings and screws wherever possible, and seal any metal screws with silicon. Use hex hydrate type of ferric chloride, which should be dissolved in warm water until saturation. Adding a teaspoon of table salt helps to make the etchant clearer for easier inspection. Always take extreme care to avoid splashing when dissolving ferric chloride, as it trends to clump together and you often get big chunks coming out of the container and splashing into the solution. It can damage your eyes and permanently stain clothing. Drilling For Fibreglass (FR4) board, you must use tungsten carbide drill bits. Carbide drill bits are expensive and the thin ones snap very easily. When using carbide drill bits below 1mm, you must use a good vertical drill stand to avoid frequent breaking. Carbide drill bits are available as straight- shank or thick (sometimes called turbo)

60

shank. In straight-Shank, the whole bits is the diameter of the hole, and in thick shank, a standard- size shank tapers down to hole size. The straight-shank drills are usually preferred because they break less easily and are usually cheaper. The longer thin section provides more flexibility. Small drills for PCB use usually come with either set of collets of various size or a 3-jaw chunk. For accuracy however, 3-jaw chunks are not brilliant, and small drill sizes below 1mm quickly form grooves in the jaws, preventing good grip. You need a good strong light on the board when drilling, to ensure accuracy.

61

5.2 PCB & COMPONENT LAYOUT

Fig 5.2 (a) PCB layout of the circuit.

62

Fig 5.2 (b) Component layout of the transmitter circuit

POWER SUPPLY

63

Fig 5.2 (c) PCB layout of the power supply

Fig 5.2 (d) Component layout of power supply

5.3 SOLDERING Soldering is the joining together of two metals to give physical bonding and good electrical conductivity. It is used primarily in electrical and electronic circuitry. Solder is a combination of metals, which are solid at normal room temperature and becomes liquid at between 180o C and 200oC. Solder bonds well to various metals, and extremely well to copper. Soldering is the primary way how electronics components are connected to circuit boards, wires and sometimes directly to other components. To solder you need a soldering iron. A modem basic electrical soldering iron consists of a heating element, a soldering bit (often called tip), a handle and a power cord. The heating element can either be a resistance wire wound around a ceramic tube or a thick film resistance element printed on to a ceramic base. The element is then insulated and placed into a metal tube for strength and protection. This is then thermally insulated from the handle. The heating element of the soldering iron usually reaches the temperatures around 370 to 400 C (higher than required to melt the solder). The soldering bit is a specially shaped piece of copper plated with iron and then with chrome or iron. The tip planting makes it very resistant to aggressive solders and fluxes.

64

The strength of a soldering iron is usually expressed in Watts. Irons used in electronics are usually of the range 12 to 25 Watts. For advanced soldering work you will need soldering iron with temperature control. You need to be careful in soldering because most of the electronic components are fragile and heat sensitive. Usually the biggest concern is heat. Low enough soldering temperature and short enough soldering time will keep the components in good shape. Prolonged exposure to heat may heat up the inside of the component and damage it permanently. Currently the best commonly available solder alloy is eutectic solder (63% lead and 37% tin). It has the character of being in both solid and liquid state at the same temperature. Flux is vital in good solder. It is an aggressive chemical that removes oxides and impurities from the parts to be soldered. Always wash your hand prior to eating , drinking or going to bathroom after soldering. When you solder tiny balls of soldering tin will get on your hands and they need to be washed off before it gets to your body. Also do not keep food near soldering works since there is a chance of small bubbles of soldering tin flying from the tip of the soldering iron.

65

CHAPTER 6 ESTIMATE

COMPONENT
MICROCONTROLLER DS1307 AT245C08 16*2 LCD MODULE MAX232 4*3 KEYPAD RS232 CONNECTOR RFID RECIVER MODULE CRYSTAL OSCILLATOR RFID TAGS POTENTIMETER 3V BUTTON CELL SWITCHES VOLTAGE REGULATOR DIODES RESISTORS CAPACITORS PCB PREPARATION

QUANTITY
1 1 1 1 1 1 1 1 3 5 1 1 4 2 3 16 12 2

PRICE
50.00 25.00 10.00 108.00 13.00 100.00 5.00 1200.00 30.00 100.00 5.00 10.00 20.00 24.00 6.00 3.00 30.00 250.00

66

LED MISCELLANEOUS

4.00 23.00

TOTAL

2016.00

CHAPTER 7 CONCLUSION

The presented project is a microcontroller based attendance system using RFID module. The system can be used to register attendance in classes, industries etc. although the RFID module costs a little, we can economically implement this in a large scale. As an emerging technology this can effectively reduce much of our difficulties in logging system and security system. Advantages
1. Easier method of registering attendance.

2. Better facility for storage and archiving. 3. More reliable and efficient. 4. Multiple functions can be done, like attendance, data logging, security etc. 5. Components are easily available.

67

Disadvantages 1. RFID receiver has a very short range; tag has to in 15 cm distance of the receiver 2. RFID reviver module is a little costly if we have to do it in small scale 3. Storage capacity of the EEPROM is limited, but we can easily improve this.

REFERENCES

1.

The 8051 Microcontroller And Embedded SystemsMuhammad Ali Mazidi Op-Amps&Linear Integrated Circuits-Ramakant A Gayakwad www.8051projects.info www.8051projects.net www.alldatasheet.com www.atmel.com

2.

3. 4. 5. 6.

68

DATASHEETS 1.89S51

69

70

71

2. DS 1307

72

73

74

75

76

77

78

79

80

3. AT 24C08

81

82

Das könnte Ihnen auch gefallen