151
RF ID ATTENDENCE RECORD LOGIC.

Rf Id Attendence Memory

Embed Size (px)

DESCRIPTION

how rfid circuit works

Citation preview

SMART CARD CONTROL ATTENDENCE

RF ID ATTENDENCE

RECORD

LOGIC.

In this project we show the concept of auto attendance recorder with the HELP OF THE RF ID DATA TRANSFER. As the teacher or any person is enter in the room, then first of all he SEND ITS RF DATA , if the card data base is match with the data base then door is open for some time. When door is open then for that day and that time this is to be recorded in the data base. Now in the evening it is possible to check the record of the this smart card for which time he enter in the area and for which time he exit from the area by enter in the menu driven program. In the menu driven program the we check the card number and card number show the detail of the card automatically.

Data base is to be recorded in the external memory. Here we use ic 24c02 memory to record all the data. For the time calculation we use RTC interface. RTC is a real time clock and with the help of this RTC clock it is possible to maintain the record of the date, time and day also.

Main components:

Rf module ask 433 Mhtz tx and rx

Microcontroller 89s51

Lcd 2 by 16.

Encoder and decoder HT 12E and HT12D

In every card we use one encoder ic with digital data base, this digital data base may be 16 bit or 32 bit. In this project we use 4 bit data base to show the basic concept of this project. There are many type of encoder and decoder are available in the market. Easily available encoder and decoders are HT12 E and HT 12D. HT12 E is encoder ic and HT 12D is decoder ic. These encoder and decoder ic is designed by the HOLTEK company. We use 18 pin version of encoder and decoder ic.

Selection Table

General Description

The 212 encoders are a series of CMOS LSIs for remote control system applications.

They are capable of encoding

information which consists of N address bits and 12_N data bits. Each address/data input can be set to

one of the two logic states. The programmed addresses/ data are transmitted together with the header

bits via an RF or an infrared transmission medium upon receipt of a trigger signal. The capability to select a TE

trigger on the HT12E or a DATA trigger on the HT12A further enhances the application flexibility of the 212 series

of encoders. The HT12A additionally provides a 38kHz carrier for infrared systems.

Features

_ Operating voltage

_ 2.4V~5V for the HT12A

_ 2.4V~12V for the HT12E

_ Low power and high noise immunity CMOS

technology

_ Low standby current: 0.1_A (typ.) at VDD=5V

_ HT12A with a 38kHz carrier for infrared transmission

medium

_ Minimum transmission word

_ Four words for the HT12E

_ One word for the HT12A

_ Built-in oscillator needs only 5% resistor

_ Data code has positive polarity

_ Minimal external components

_ Pair with Holtek_s 212 series of decoders

_ 18-pin DIP, 20-pin SOP package

Applications

_ Burglar alarm system

_ Smoke and fire alarm system

_ Garage door controllers

_ Car door controllers

_ Car alarm system

_ Security system

_ Cordless telephones

_ Other remote control systems

Pin no 1 to pin no 8 is for the address line . If we use one encoder and one decoder ic then we give a same address in encoder and decoder ic. In this project we connect all the address pin to join together and connect to the ground pin. So we provide a 00 address to all the pin of the address pin. So we provide a same data to the decoder ic by connecting all the address pin to the same ground voltage Pin no 9 is Vss pin , so we provide a negative voltage to the Vss pin. Pin no 10 to pin no 13 is for the data line. In this project we connect a changeable data base logic to these point. By connecting a DIP switch to these pins. Dip switch is for the external data base. By changing the slide switch we change the data base..

Pin no 15 and 16 is for the oscillator pin. On this pin we connect one resistor to these pin. On these pin we connect 1 M ohm resistor. Pin no 17 is for digital output pin. When we press the pin no 14 then data available on the pin no 10-13 is transmit from the pin no 17 in serial mode. On this pin we connect a rf module. Rf module transfer the data in air. There are two type of rf module available in the market. ASK AND FSK . Here in theses project we use ASK rf module. FSK is better then ASK module, but fsk is not easily available. Pi no 18 is for the positive voltage , on this pin we provide a positive supply .

Data from the rf transmitter is receive by the rf receiver module . Modulation frequency of the transmitter and receiver is same 433 Mhtz. So every time when receive the data then rf modulrt receive the data and transfer this data serially into decoder ic. Decoder ic receive the data serially and decoder deliver a data parallel.

The TWS-434 and RWS-434 are extremely small, and are excellent for applications requiring short-range RF remote controls. The transmitter module is only 1/3 the size of a standard postage stamp, and can easily be placed inside a small plastic enclosure.TWS-434: The transmitter output is up to 8mW at 433.92MHz with a

range of approximately 400 foot (open area) outdoors. Indoors, the range is approximately 200 foot, and will go through most walls.....

TWS-434AThe TWS-434 transmitter accepts both linear and digital inputs, can operate from 1.5 to 12 Volts-DC, and makes building a miniature hand-held RF transmitter very easy. The TWS-434 is approximately the size of a standard postage stamp.

TWS-434 Pin Diagram

Sample Transmitter Application Circuit

RWS-434: The receiver also operates at 433.92MHz, and has a sensitivity of 3uV. The RWS-434 receiver operates from 4.5 to 5.5 volts-DC, and has both linear and digital outputs.Click on picture for larger image

RWS-434 Receiver

RWS-434 Pin Diagram

Sample Receiver Application Circuit

The example above shows the receiver section using the HT-12D decoder IC for a 4-bit RF remote control system. The transmitter and receiver can also use the Holtek 8-bit HT-640/HT-648L remote control encoder/decoder combination for an 8-bit RF remote control system. Here are the schematics for an 8-bit RF remote control system:

Transmitter is connected to the pin no 11 of the ic. This pin is for the serial data transfer. Transmitter is connected with this pin with one transistor circuit. Receiver is also connected with the pin no 10 which is rx pin of the serial buffer through one npn transistor circuit.

Components used in the receiver circuit.

89s51 controller.

40 pin base

lcd 2 by 16 with base

crystal 12 mhz

step down transformer 9-0-9 ac

diode in 4007 (2)

regulator 7805 (1)

transmitter 433 Mhz

RF MODELULE IS CONNECTED WITH THE MICROCONTROLLER VIA DECODER IC HT 12 D.

LCD : in this project we use 2 by 16 lcd . On This lcd we show all the detail, for day, time, clock and all the data base system. Here we use 2 by 16 lcd. Here 2 means 2 lines and 16 means 16 character. In this lcd there is total 8 pins for the data input/ output and 3 pin for control the command mode and data mode. In the command mode we send the command and in the data mode we send the data. These three pin s are RS, RW, enable.

Supply voltage of the lcd is 5 volt dc.

5 VOLT REGULATED POWER SUPPLY CIRCUIT.

In this project firstly we use one step down transformer. Step down transformer step down the voltage from 220 volt Ac to 12 volt Ac. This Ac voltage is further converted into DC with the help of rectifier circuit. In rectifier circuit we use four diode. All the diodes are arranges as a bridge rectifier circuit. Output of this rectifier is pulsating Dc. To convert this pulsating DC into smooth dc we use one capacitor as a filter components. Capacitor converts the pulsating Dc into smooth DC with the help of its charging and discharging effect.

Output of the rectifier is now regulated with the help of IC regulator circuit. In this project we use positive voltage regulator circuit. Here we use three pin regulator. Output of this regulator is regulated voltage. If we use 7805 regulator then its means its is 5 volt regulator and if we use 7808 regulator then its means that it is 8 volt regulator circuit.

PIN CONNECTION OF CONTROLLER WITH INPUT AND OUTPUT DEVICES.

In this project we use 89s51 controller to control all the input and output of the project. This controller is 40 pin ic. Pin no 40 of the ic is connected to the positive supply. Pin no 20 of the controller is connected to the negative supply. Pin no 18 and 19 of the ic is connected to the external crystal oscillator circuit. With the help of this crystal we control the speed of the microcontroller. Two 27 pf ceramic capacitor is grounded from the crystal to reduce the ripples IN the oscillator frequency. Pin 9 is reset pin. On this pin we connect one capacitor and resistor to provide a auto reset option. With the help of this option it is possible to provide a auto reset logic to the controller. When power is on then capacitor charge to the peak value and reset automatically with the help of 10 k ohm resistor and provide a auto reset option to the circuit.

Data from card is transmit in the air by the Radio frequency Module. This data is receive by the radio frequency receiver and this data is demodulate by

The Rf receiver and converted into serial. This serial data is further decoded by the H 12 D decoder. Output of the HT 12 D decoder is further connected to the microcontroller for data base comparison

and from decoder is connected to the port p1 , which is pin no 1,2,3,4 and 12 , Pin no 12 is special pin for check the ack data signal.. Pin no 17 of the H 12 d decoder is connected to this pin. Along with the data we check the ACK signal also.Pin 31 is also connected to the positive line with pin no 40. Pin no 31 is excess enable pin. If we provide a positive voltage on this pin then it means that we use the internal memory of the ic. If we use external memory then we connect a pin no 31 to the negative line. This memory means ROM memory , not ram memory

Pin no 16 and 17 of the ic is connected to the external ram memory. Here we use 24c02 memory to store the ram data. On this memory we store the detail of the all the card. This ic is a 8 pin ic. Pin no 8 of the ic is connected to the positive supply. Pin no 1,2,3,4 and 7 is also connected to the ground pin. Pin no 5 and 6 is connected to the microcontroller.

For the real time clock we use 8563 ic. 8563 is a 8 pin ic. Pin no 8 connected to the positive supply. Pin no 4 is connected to the ground pin. Pin no 1 and 2 is connected to the external crystal to provide a constant frequency for long time. External battery from battery backup is connected to the pin no8

To provide a battery backup for long time.

General descriptionThe PCF8563 is a CMOS real time clock/calendar optimized for low power consumption. A programmable clock output, interrupt output and voltage-low detector are also provided. All address and data are transferred serially via a two-line bidirectional I2C-bus. Maximum bus speed is 400kbit/s. The built-in word address register is incremented automatically after each written or read data byte.2.FeaturesProvides year, month, day, weekday, hours, minutes and seconds based on 32.768kHz quartz crystalCentury flagClock operating voltage: 1.8Vto5.5VLow backup current; typical 0.25Aat VDD=and Tamb=25C400kHz two-wire I2C-bus interface (at VDD=Programmable clock output for peripheral devices (32.768kHz, 1 024Hz, 32Hzand 1Hz)Alarm and timer functionsIntegrated oscillator capacitorInternal power-on resetI2C-bus slave address: read A3h and write A2hOpen-drain interrupt pinElectroStatic Discharge (ESD) protection exceeds 2 000 V Human Body Model (HBM) per JESD22-A114, 200 V Machine Model (MM) per JESD22-A115 and 2 000 V Charged Device Model (CDM) per JESD22-C101Latch-up testing is done to JEDEC standard JESD78 which exceeds 100 mA3.ApplicationsMobile telephonesPortable instrumentsElectronic meteringBattery powered products

OSCI11oscillator input

OSCO22oscillator output

n.c-3not connected

INT34interrupt output (open-drain; active LOW)

VSS45ground

SDA56serial data input and output

SCL67serial clock input

CLKOUT78clock output, open-drain

VDD89positive supply voltage

n.c-10not connected

Components used in this project.

Step down transformer 220 volt ac to 9 volt ac.

Diode in 4007 (2)

Capacitor 1000mfd (2)

7805 regulator to provide 5 volt regulated power supply.

10 mfd capacitor for reset.

Moc 3011 slotted optocoupler.

( 5 pc)

crystal 12 mhz. for microcontroller clock.

Crystal 32 k hz for rtc

Ic 8563 RTC.

Ic 24co2 memory ic.

Lcd 2 by 16 digit

Microcontroller 89s51.

Cmos battery for 3.6 volt with 8563 ic.

1o k ohm pull up resistor 5 pc.

10 k pull resisitor array with port p0 to provide a external pull up resistor.

4.7 k ohm preset to control the constrast of lcd

4 switch for different inputs provided to the different operation of the smart card.

Program code of this project.

LCD_DATA equ P0

cd_rs bit P2.7

lcd_rw bit P2.6

lcd_en bit P2.5

bit flahlh.7

axs_in_minutes equ 30h

axs_in_hours equ 31h

axs_out_minutes equ 32h

axs_out_hours equ 33h

seconds equ 34h

minutes equ 35h

hours equ 36h

days equ 37h

weekdays equ 38h

months equ 39h

years equ 3ah

RTC_ADD

equ

3bh

RTC_ADD_DATA

equ

3ch

axs_flag

equ 3dh

axs_flag1

equ 3eh

chanj

equ

3fh

axs_data

equ p1

key0

bit

p2.3

key1

bit

p2.2

key2

bit

p2.0

key3

bit

p2.1

output

bit

p3.0

WRITE_C

EQU

0a2h

READ_C

EQU

0a3h

ACK_READ

EQU

8ah

First of all when we switch on the project then it takes few second to display the time day and other detail on the lcd, once its appear on the lcd then we insert the card in slotted opto coupler. When we enter a card then first of all card is compare with the data base.

org 0000h

ljmp main

lcall CLR_LCD

mov dptr,#MSG5

lcall LINE_1

mova,axs_data

In the logic we get a data from the card sytem to accumulator. Axs data is a variable where the data is to be stored

cpla

anla,#0fh

cjnea,#1d,axs_data_nxt0

if the data base is compare then we open the door and store this card data in external memory with real time interface.

clroutput

jb

flag32,axs_add0_nxt0

setbflag32

mov 1ah,minutes

mov 1bh,#4d

LCALL write

mov 1ah,hours

mov 1bh,#5d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt0:

jb

flag44,axs_add1_nxt0

setbflag44

mov 1ah,minutes

mov 1bh,#6d

LCALL write

mov 1ah,hours

mov 1bh,#7d

LCALL write

axs_add1_nxt0:

ljmpaxs_data_nxt12

axs_data_nxt0:

cjnea,#2d,axs_data_nxt1

clroutput

jb

flag33,axs_add0_nxt1

setbflag33

mov 1ah,minutes

mov 1bh,#8d

LCALL write

mov 1ah,hours

mov 1bh,#9d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt1:

jb

flag45,axs_add1_nxt1

setbflag45

mov 1ah,minutes

mov 1bh,#10d

LCALL write

mov 1ah,hours

mov 1bh,#11d

LCALL write

axs_add1_nxt1:

ljmpaxs_data_nxt12

axs_data_nxt1:

cjnea,#3d,axs_data_nxt2

clroutput

jb

flag34,axs_add0_nxt2

setbflag34

mov 1ah,minutes

mov 1bh,#12d

LCALL write

mov 1ah,hours

mov 1bh,#13d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt2:

jb

flag46,axs_add1_nxt2

setbflag46

mov 1ah,minutes

mov 1bh,#14d

LCALL write

mov 1ah,hours

mov 1bh,#15d

LCALL write

axs_add1_nxt2:

ljmpaxs_data_nxt12

axs_data_nxt2:

cjnea,#4d,axs_data_nxt3

clroutput

jb

flag35,axs_add0_nxt3

setbflag35

mov 1ah,minutes

mov 1bh,#16d

LCALL write

mov 1ah,hours

mov 1bh,#17d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt3:

jb

flag47,axs_add1_nxt3

setbflag47

mov 1ah,minutes

mov 1bh,#18d

LCALL write

mov 1ah,hours

mov 1bh,#19d

LCALL write

axs_add1_nxt3:

ljmpaxs_data_nxt12

axs_data_nxt3:

cjnea,#5d,axs_data_nxt4

clroutput

jb

flag36,axs_add0_nxt4

setbflag36

mov 1ah,minutes

mov 1bh,#20d

LCALL write

mov 1ah,hours

mov 1bh,#21d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt4:

jb

flag48,axs_add1_nxt4

setbflag48

mov 1ah,minutes

mov 1bh,#22d

LCALL write

mov 1ah,hours

mov 1bh,#23d

LCALL write

axs_add1_nxt4:

ljmpaxs_data_nxt12

axs_data_nxt4:

cjnea,#6d,axs_data_nxt5

clroutput

jb

flag37,axs_add0_nxt5

setbflag37

mov 1ah,minutes

mov 1bh,#24d

LCALL write

mov 1ah,hours

mov 1bh,#25d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt5:

jb

flag49,axs_add1_nxt5

setbflag49

mov 1ah,minutes

mov 1bh,#26d

LCALL write

mov 1ah,hours

mov 1bh,#27d

LCALL write

axs_add1_nxt5:

ljmpaxs_data_nxt12

axs_data_nxt5:

cjnea,#7d,axs_data_nxt6

clroutput

jb

flag38,axs_add0_nxt6

setbflag38

mov 1ah,minutes

mov 1bh,#28d

LCALL write

mov 1ah,hours

mov 1bh,#29d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt6:

jb

flag50,axs_add1_nxt6

setbflag50

mov 1ah,minutes

mov 1bh,#30d

LCALL write

mov 1ah,hours

mov 1bh,#31d

LCALL write

axs_add1_nxt6:

ljmpaxs_data_nxt12

axs_data_nxt6:

cjnea,#8d,axs_data_nxt7

clroutput

jb

flag39,axs_add0_nxt7

setbflag39

mov 1ah,minutes

mov 1bh,#32d

LCALL write

mov 1ah,hours

mov 1bh,#33d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt7:

jb

flag51,axs_add1_nxt7

setbflag51

mov 1ah,minutes

mov 1bh,#34d

LCALL write

mov 1ah,hours

mov 1bh,#35d

LCALL write

axs_add1_nxt7:

ljmpaxs_data_nxt12

axs_data_nxt7:

cjnea,#9d,axs_data_nxt8

clroutput

jb

flag40,axs_add0_nxt8

setbflag40

mov 1ah,minutes

mov 1bh,#36d

LCALL write

mov 1ah,hours

mov 1bh,#37d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt8:

jb

flag52,axs_add1_nxt8

setbflag52

mov 1ah,minutes

mov 1bh,#38d

LCALL write

mov 1ah,hours

mov 1bh,#39d

LCALL write

axs_add1_nxt8:

ljmpaxs_data_nxt12

axs_data_nxt8:

cjnea,#10d,axs_data_nxt9

clroutput

jb

flag41,axs_add0_nxt9

setbflag41

mov 1ah,minutes

mov 1bh,#40d

LCALL write

mov 1ah,hours

mov 1bh,#41d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt9:

jb

flag53,axs_add1_nxt9

setbflag53

mov 1ah,minutes

mov 1bh,#42d

LCALL write

mov 1ah,hours

mov 1bh,#43d

LCALL write

axs_add1_nxt9:

ljmpaxs_data_nxt12

axs_data_nxt9:

cjnea,#11d,axs_data_nxt10

clroutput

jb

flag42,axs_add0_nxt10

setbflag42

mov 1ah,minutes

mov 1bh,#44d

LCALL write

mov 1ah,hours

mov 1bh,#45d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt10:

jb

flag54,axs_add1_nxt10

setbflag54

mov 1ah,minutes

mov 1bh,#46d

LCALL write

mov 1ah,hours

mov 1bh,#47d

LCALL write

axs_add1_nxt10:

ljmpaxs_data_nxt12

axs_data_nxt10:

cjnea,#12d,axs_data_nxt11

clroutput

jb

flag43,axs_add0_nxt11

setbflag43

mov 1ah,minutes

mov 1bh,#48d

LCALL write

mov 1ah,hours

mov 1bh,#49d

LCALL write

ljmpaxs_data_nxt12

axs_add0_nxt11:

jb

flag55,axs_add1_nxt11

setbflag55

mov 1ah,minutes

mov 1bh,#50d

LCALL write

mov 1ah,hours

mov 1bh,#51d

LCALL write

axs_add1_nxt11:

ljmpaxs_data_nxt12

axs_data_nxt11:

lcall DELAY11

lcall CLR_LCD

mov dptr,#MSG6

lcall LINE_1

axs_data_nxt12:

mov 1ah,24h

mov 1bh,#1d

LCALL write

mov 1ah,25h

mov 1bh,#2d

LCALL write

mov 1ah,26h

mov 1bh,#3d

LCALL write

lcall DELAY11

lcall DELAY11

lcall DELAY11

lcall DELAY11

lcall DELAY11

setboutput

lcall CLR_LCD

mov ie,#85h

mov tcon,#01h

pop acc

pop psw

reti

sir_int1:

push psw

push acc

setbflag0

pop acc

pop psw

reti

main:

lcall DELAY11

mov psw,#00h

mov sp,#070h

movtmod,#00h

mov tcon,#01h

mov scon,#00h

mov ie,#85h

mov ip,#00h

mov tl1,#00h

mov th1,#00h

mov p0,#0ffh

mov p1,#0ffh

mov p2,#0ffh

mov p3,#0ffh

setboutput

mov20h,#00h

mov21h,#01h

mov22h,#03h

mov23h,#00h

mov24h,#00h

mov25h,#00h

mov26h,#00h

movaxs_flag,#00h

movaxs_flag1,#00h

movaxs_in_minutes,#00h

movaxs_in_hours,#00h

movaxs_out_minutes,#00h

movaxs_out_hours,#00h

mov seconds,#00h

movminutes,#00h

movhours,#00h

movdays,#00h

movweekdays,#00h

mov months,#00h

mov years,#00h

clr lcd_rs

clr lcd_rw

clr lcd_en

MOVRTC_ADD,#0DH

MOVRTC_ADD_DATA,#83h

MOVRTC_ADD,#02H

lcall READBYTE

MOVseconds,RTC_ADD_DATA

MOVRTC_ADD,#03H

lcall READBYTE

MOVminutes,RTC_ADD_DATA

MOVRTC_ADD,#04H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#3fh

MOVhours,a

MOVRTC_ADD,#05H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#3fh

MOVdays,a

MOVRTC_ADD,#06H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#07h

MOVweekdays,a

MOVRTC_ADD,#07H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#1fh

MOVmonths,a

MOVRTC_ADD,#08H

lcall READBYTE

MOVyears,RTC_ADD_DATA

lcall WRITBYTE

lcall data_cheke

lcall INIT_LCD

lcall CLR_LCD

mov dptr,#MSG0

lcall LINE_1

mov dptr,#MSG1

lcall LINE_2

lcall DELAY11

lcall CLR_LCD

setbflag0

WAIT:

lcallkeyboard

lcalldisplay

jnbflag0,WAIT

clrflag0

MOVRTC_ADD,#02H

lcall READBYTE

MOVa,RTC_ADD_DATA

MOVseconds,a

jnzback

MOVRTC_ADD,#03H

lcall READBYTE

MOVa,RTC_ADD_DATA

MOVminutes,a

jnzback

MOVRTC_ADD,#04H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#3fh

MOVhours,a

jnzback

MOVRTC_ADD,#05H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#3fh

MOVdays,a

MOVRTC_ADD,#06H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#07h

MOVweekdays,a

MOVRTC_ADD,#07H

lcall READBYTE

MOVa,RTC_ADD_DATA

ANLa,#1fh

MOVmonths,a

MOVRTC_ADD,#08H

lcall READBYTE

MOVyears,RTC_ADD_DATA

lcalldata_chanj

back:

ljmpWAIT

display:

jnbflag26,goto_nxt

setbflag16

ret

goto_nxt:

mov dptr,#MSG2

mov LCD_DATA,#080h

lcall COMMAND_BYTE

mov a,hours

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag12,lpl_yh

movLCD_DATA,#20h

lpl_yh: lcall DATA_BYTE

mov LCD_DATA,#081h

lcall COMMAND_BYTE

mov a,hours

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag12,lph_yh

movLCD_DATA,#20h

lph_yh: lcall DATA_BYTE

mov LCD_DATA,#082h

lcall COMMAND_BYTE

mov a,#':'

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#083h

lcall COMMAND_BYTE

mov a,minutes

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag13,lpl_tl

movLCD_DATA,#20h

lpl_tl: lcall DATA_BYTE

mov LCD_DATA,#084h

lcall COMMAND_BYTE

mov a,minutes

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag13,lph_tl

movLCD_DATA,#20h

lph_tl: lcall DATA_BYTE

mov LCD_DATA,#085h

lcall COMMAND_BYTE

mov a,#':'

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#086h

lcall COMMAND_BYTE

mov a,seconds

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag14,lpl_th

movLCD_DATA,#20h

lpl_th: lcall DATA_BYTE

mov LCD_DATA,#087h

lcall COMMAND_BYTE

mov a,seconds

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag14,lph_th

movLCD_DATA,#20h

lph_th: lcall DATA_BYTE

mov LCD_DATA,#0c3h

lcall COMMAND_BYTE

mov a,days

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag9,lpl_dl

movLCD_DATA,#20h

lpl_dl: lcall DATA_BYTE

mov LCD_DATA,#0c4h

lcall COMMAND_BYTE

mov a,days

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag9,lph_dl

movLCD_DATA,#20h

lph_dl: lcall DATA_BYTE

mov LCD_DATA,#0c5h

lcall COMMAND_BYTE

mov a,#'/'

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0c6h

lcall COMMAND_BYTE

mov a,months

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag10,lpl_dh

movLCD_DATA,#20h

lpl_dh: lcall DATA_BYTE

mov LCD_DATA,#0c7h

lcall COMMAND_BYTE

mov a,months

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag10,lph_dh

movLCD_DATA,#20h

lph_dh: lcall DATA_BYTE

mov LCD_DATA,#0c8h

lcall COMMAND_BYTE

mov a,#'/'

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0c9h

lcall COMMAND_BYTE

mov a,#'2'

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0cah

lcall COMMAND_BYTE

mov a,#'0'

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0cbh

lcall COMMAND_BYTE

mov a,years

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag11,lpl_yl

movLCD_DATA,#20h

lpl_yl: lcall DATA_BYTE

mov LCD_DATA,#0cch

lcall COMMAND_BYTE

mov a,years

anl a,#0fh

add a,#30h

mov LCD_DATA,a

jnbflag11,lph_yl

movLCD_DATA,#20h

lph_yl: lcall DATA_BYTE

mov LCD_DATA,#08dh

lcall COMMAND_BYTE

mov b,weekdays

mova,#3d

mulab

adda,#0d

MOVC A,@A+DPTR

mov LCD_DATA,a

jnbflag15,lp1_w

movLCD_DATA,#20h

lp1_w: lcall DATA_BYTE

mov LCD_DATA,#08eh

lcall COMMAND_BYTE

mov b,weekdays

mova,#3d

mulab

adda,#1d

MOVC A,@A+DPTR

mov LCD_DATA,a

jnbflag15,lp2_w

movLCD_DATA,#20h

lp2_w: lcall DATA_BYTE

mov LCD_DATA,#08fh

lcall COMMAND_BYTE

mov b,weekdays

mova,#3d

mulab

adda,#2d

MOVC A,@A+DPTR

mov LCD_DATA,a

jnbflag15,lp3_w

movLCD_DATA,#20h

lp3_w: lcall DATA_BYTE

setbflag16

ret

display1:

mov LCD_DATA,#0c3h

lcall COMMAND_BYTE

mov a,axs_flag1

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#084h

lcall COMMAND_BYTE

mov a,axs_flag

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#085h

lcall COMMAND_BYTE

mov a,axs_flag

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

ret

display2:

mov LCD_DATA,#08bh

lcall COMMAND_BYTE

mov a,axs_in_hours

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#08ch

lcall COMMAND_BYTE

mov a,axs_in_hours

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#08eh

lcall COMMAND_BYTE

mov a,axs_in_minutes

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#08fh

lcall COMMAND_BYTE

mov a,axs_in_minutes

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0cbh

lcall COMMAND_BYTE

mov a,axs_out_hours

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0cch

lcall COMMAND_BYTE

mov a,axs_out_hours

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0ceh

lcall COMMAND_BYTE

mov a,axs_out_minutes

swap a

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

mov LCD_DATA,#0cfh

lcall COMMAND_BYTE

mov a,axs_out_minutes

anl a,#0fh

add a,#30h

mov LCD_DATA,a

lcall DATA_BYTE

ret

keyboard:

jb

flag16,g_key

ret

g_key:

jnbkey0,g_nxt0

ljmpnxt0

g_nxt0:

jnbkey0,g_nxt0

lcalldelay

jnbkey0,g_nxt0

jnbflag8,g_key

clrflag16

jnbflag17,nxt0_lp0

clrflag17

setbflag18

setbflag26

movie,#00h

mov dptr,#MSG3

lcall LINE_1

mov dptr,#MSG4

lcall LINE_2

movaxs_flag,#01h

movc,flag32

movaxs_flag1,#'P'

jc

axs_nxt0

movaxs_flag1,#'A'

axs_nxt0:

lcall display1

mov 1bh,#4d

lcall read

mov axs_in_minutes,19h

mov 1bh,#5d

lcall read

mov axs_in_hours,19h

mov 1bh,#6d

lcall read

mov axs_out_minutes,19h

mov 1bh,#7d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp0:

jnbflag18,nxt0_lp1

clrflag18

setbflag19

setbflag26

movie,#00h

movaxs_flag,#02h

movc,flag33

movaxs_flag1,#'P'

jc

axs_nxt1

movaxs_flag1,#'A'

axs_nxt1:

lcall display1

mov 1bh,#8d

lcall read

mov axs_in_minutes,19h

mov 1bh,#9d

lcall read

mov axs_in_hours,19h

mov 1bh,#10d

lcall read

mov axs_out_minutes,19h

mov 1bh,#11d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp1:

jnbflag19,nxt0_lp2

clrflag19

setbflag20

setbflag26

movie,#00h

movaxs_flag,#03h

movc,flag34

movaxs_flag1,#'P'

jc

axs_nxt2

movaxs_flag1,#'A'

axs_nxt2:

lcall display1

mov 1bh,#12d

lcall read

mov axs_in_minutes,19h

mov 1bh,#13d

lcall read

mov axs_in_hours,19h

mov 1bh,#14d

lcall read

mov axs_out_minutes,19h

mov 1bh,#15d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp2:

jnbflag20,nxt0_lp3

clrflag20

setbflag21

setbflag26

movie,#00h

movaxs_flag,#04h

movc,flag35

movaxs_flag1,#'P'

jc

axs_nxt3

movaxs_flag1,#'A'

axs_nxt3:

lcall display1

mov 1bh,#16d

lcall read

mov axs_in_minutes,19h

mov 1bh,#17d

lcall read

mov axs_in_hours,19h

mov 1bh,#18d

lcall read

mov axs_out_minutes,19h

mov 1bh,#19d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp3:

jnbflag21,nxt0_lp4

clrflag21

setbflag22

setbflag26

movie,#00h

movaxs_flag,#05h

movc,flag36

movaxs_flag1,#'P'

jc

axs_nxt4

movaxs_flag1,#'A'

axs_nxt4:

lcall display1

mov 1bh,#20d

lcall read

mov axs_in_minutes,19h

mov 1bh,#21d

lcall read

mov axs_in_hours,19h

mov 1bh,#22d

lcall read

mov axs_out_minutes,19h

mov 1bh,#23d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp4:

jnbflag22,nxt0_lp5

clrflag22

setbflag23

setbflag26

movie,#00h

movaxs_flag,#06h

movc,flag37

movaxs_flag1,#'P'

jc

axs_nxt5

movaxs_flag1,#'A'

axs_nxt5:

lcall display1

mov 1bh,#24d

lcall read

mov axs_in_minutes,19h

mov 1bh,#25d

lcall read

mov axs_in_hours,19h

mov 1bh,#26d

lcall read

mov axs_out_minutes,19h

mov 1bh,#27d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp5:

jnbflag23,nxt0_lp6

clrflag23

setbflag24

setbflag26

movie,#00h

movaxs_flag,#07h

movc,flag38

movaxs_flag1,#'P'

jc

axs_nxt6

movaxs_flag1,#'A'

axs_nxt6:

lcall display1

mov 1bh,#28d

lcall read

mov axs_in_minutes,19h

mov 1bh,#29d

lcall read

mov axs_in_hours,19h

mov 1bh,#30d

lcall read

mov axs_out_minutes,19h

mov 1bh,#31d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp6:

jnbflag24,nxt0_lp7

clrflag24

setbflag25

setbflag26

movie,#00h

movaxs_flag,#08h

movc,flag39

movaxs_flag1,#'P'

jc

axs_nxt7

movaxs_flag1,#'A'

axs_nxt7:

lcall display1

mov 1bh,#32d

lcall read

mov axs_in_minutes,19h

mov 1bh,#33d

lcall read

mov axs_in_hours,19h

mov 1bh,#34d

lcall read

mov axs_out_minutes,19h

mov 1bh,#35d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp7:

jnbflag25,nxt0_lp8

clrflag25

setbflag27

setbflag26

movie,#00h

movaxs_flag,#09h

movc,flag40

movaxs_flag1,#'P'

jc

axs_nxt8

movaxs_flag1,#'A'

axs_nxt8:

lcall display1

mov 1bh,#36d

lcall read

mov axs_in_minutes,19h

mov 1bh,#37d

lcall read

mov axs_in_hours,19h

mov 1bh,#38d

lcall read

mov axs_out_minutes,19h

mov 1bh,#39d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp8:

jnbflag27,nxt0_lp9

clrflag27

setbflag28

setbflag26

movie,#00h

movaxs_flag,#10h

movc,flag41

movaxs_flag1,#'P'

jc

axs_nxt9

movaxs_flag1,#'A'

axs_nxt9:

lcall display1

mov 1bh,#40d

lcall read

mov axs_in_minutes,19h

mov 1bh,#41d

lcall read

mov axs_in_hours,19h

mov 1bh,#42d

lcall read

mov axs_out_minutes,19h

mov 1bh,#43d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp9:

jnbflag28,nxt0_lp10

clrflag28

setbflag29

setbflag26

movie,#00h

movaxs_flag,#11h

movc,flag42

movaxs_flag1,#'P'

jc

axs_nxt10

movaxs_flag1,#'A'

axs_nxt10:

lcall display1

mov 1bh,#44d

lcall read

mov axs_in_minutes,19h

mov 1bh,#45d

lcall read

mov axs_in_hours,19h

mov 1bh,#46d

lcall read

mov axs_out_minutes,19h

mov 1bh,#47d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp10:

jnbflag29,nxt0_lp11

clrflag29

setbflag30

setbflag26

movie,#00h

movaxs_flag,#12h

movc,flag43

movaxs_flag1,#'P'

jc

axs_nxt11

movaxs_flag1,#'A'

axs_nxt11:

lcall display1

mov 1bh,#48d

lcall read

mov axs_in_minutes,19h

mov 1bh,#49d

lcall read

mov axs_in_hours,19h

mov 1bh,#50d

lcall read

mov axs_out_minutes,19h

mov 1bh,#51d

lcall read

mov axs_out_hours,19h

lcall display2

ljmpnxt0

nxt0_lp11:

jnbflag30,nxt0_lp13

clrflag30

setbflag17

clrflag26

movie,#85h

lcall CLR_LCD

ljmpnxt0

nxt0_lp13:

nxt0:

jnbflag26,nxt0_goto_nxt

ret

nxt0_goto_nxt:

jnbkey1,g_nxt1

ljmpnxt1

g_nxt1:

jnbkey1,g_nxt1

lcalldelay

jnbkey1,g_nxt1

clrflag16

jnbflag1,nxt1_lp0

clrflag1

setbflag2

setbflag9

setbflag10

setbflag11

setbflag12

clrflag13

setbflag14

setbflag15

movie,#00h

ljmpnxt1

nxt1_lp0:

jnbflag2,nxt1_lp1

clrflag2

setbflag3

setbflag9

setbflag10

setbflag11

clrflag12

setbflag13

setbflag14

setbflag15

movie,#00h

ljmpnxt1

nxt1_lp1:

jnbflag3,nxt1_lp2

jnbflag26,goto_nxt1

clrflag3

setbflag7

ljmpnxt1_lp5

goto_nxt1:

clrflag3

setbflag4

clrflag9

setbflag10

setbflag11

setbflag12

setbflag13

setbflag14

setbflag15

movie,#00h

ljmpnxt1

nxt1_lp2:

jnbflag4,nxt1_lp3

clrflag4

setbflag5

setbflag9

clrflag10

setbflag11

setbflag12

setbflag13

setbflag14

setbflag15

movie,#00h

ljmpnxt1

nxt1_lp3:

jnbflag5,nxt1_lp4

clrflag5

setbflag6

setbflag9

setbflag10

clrflag11

setbflag12

setbflag13

setbflag14

setbflag15

movie,#00h

ljmpnxt1

nxt1_lp4:

jnbflag6,nxt1_lp5

clrflag6

setbflag7

setbflag9

setbflag10

setbflag11

setbflag12

setbflag13

setbflag14

clrflag15

movie,#00h

sjmpnxt1

nxt1_lp5:

jnbflag7,nxt1_lp6

clrflag7

setbflag8

clrflag9

clrflag10

clrflag11

clrflag12

clrflag13

clrflag14

clrflag15

jnbflag17,lp1_lp6

movie,#85h

MOVRTC_ADD,#02H

MOVRTC_ADD_DATA,seconds

lcall WRITBYTE

MOVRTC_ADD,#03H

MOVRTC_ADD_DATA,minutes

lcall WRITBYTE

MOVRTC_ADD,#04H

MOVRTC_ADD_DATA,hours

lcall WRITBYTE

MOVRTC_ADD,#05H

MOVRTC_ADD_DATA,days

lcall WRITBYTE

MOVRTC_ADD,#06H

MOVRTC_ADD_DATA,weekdays

lcall WRITBYTE

MOVRTC_ADD,#07H

MOVRTC_ADD_DATA,months

lcall WRITBYTE

MOVRTC_ADD,#08H

MOVRTC_ADD_DATA,years

lcall WRITBYTE

lp1_lp6:sjmpnxt1

nxt1_lp6:

jnbflag8,nxt1

clrflag8

setbflag1

setbflag9

setbflag10

setbflag11

setbflag12

setbflag13

clrflag14

setbflag15

movie,#00h

nxt1:

jnbkey2,g_nxt2

ljmpnxt2

g_nxt2:

jnbkey2,g_nxt2

lcalldelay

jnbkey2,g_nxt2

clrflag16

jnbflag1,nxt2_lp0

mov a,seconds

adda,#01h

da

a

cjnea,#60h,nxt_lps

mova,#00h

nxt_lps:movseconds,a

nxt2_lp0:

jnbflag2,nxt2_lp1

mov a,minutes

adda,#01h

da

a

cjnea,#60h,nxt_lpm

mova,#00h

nxt_lpm:movminutes,a

nxt2_lp1:

jnbflag3,nxt2_lp2

mov a,hours

adda,#01h

da

a

cjnea,#24h,nxt_lph

mova,#00h

nxt_lph:movhours,a

nxt2_lp2:

jnbflag4,nxt2_lp3

mov a,months

cjnea,#01h,mon1

mov3bh,#32h

mon1:

cjnea,#02h,mon2

mov3bh,#30h

mon2:

cjnea,#03h,mon3

mov3bh,#32h

mon3:

cjnea,#04h,mon4

mov3bh,#31h

mon4:

cjnea,#05h,mon5

mov3bh,#32h

mon5:

cjnea,#06h,mon6

mov3bh,#31h

mon6:

cjnea,#07h,mon7

mov3bh,#32h

mon7:

cjnea,#08h,mon8

mov3bh,#32h

mon8:

cjnea,#09h,mon9

mov3bh,#31h

mon9:

cjnea,#10h,mon10

mov3bh,#32h

mon10:

cjnea,#11h,mon11

mov3bh,#31h

mon11:

cjnea,#12h,mon12

mov3bh,#32h

mon12:

mov a,days

adda,#01h

da

a

cjnea,3bh,nxt_lpd

mova,#01h

nxt_lpd:movdays,a

nxt2_lp3:

jnbflag5,nxt2_lp4

mov a,months

adda,#01h

da

a

cjnea,#13h,nxt_lpt

mova,#01h

nxt_lpt:movmonths,a

nxt2_lp4:

jnbflag6,nxt2_lp5

mov a,years

adda,#01h

da

a

cjnea,#99h,nxt_lp6

mova,#99h

nxt_lp6: movyears,a

nxt2_lp5:

jnbflag7,nxt2_lp6

mov a,weekdays

adda,#01h

da

a

cjnea,#07h,nxt_lp7

mova,#00h

nxt_lp7: movweekdays,a

nxt2_lp6:

nxt2:

jnbkey3,g_nxt3

ljmpnxt3

g_nxt3:

jnbkey3,g_nxt3

lcalldelay

jnbkey3,g_nxt3

clrflag16

jnbflag1,nxt3_lp0

mov a,seconds

adda,#99h

da

a

cjnea,#99h,nx_lps

mova,#59h

nx_lps:movseconds,a

nxt3_lp0:

jnbflag2,nxt3_lp1

mov a,minutes

adda,#99h

da

a

cjnea,#99h,nx_lpm

mova,#59h

nx_lpm:movminutes,a

nxt3_lp1:

jnbflag3,nxt3_lp2

mov a,hours

adda,#99h

da

a

cjnea,#99h,nx_lph

mova,#23h

nx_lph:movhours,a

nxt3_lp2:

jnbflag4,nxt3_lp3

mov a,months

cjnea,#01h,mo1

mov3bh,#32h

mo1:

cjnea,#02h,mo2

mov3bh,#30h

mo2:

cjnea,#03h,mo3

mov3bh,#32h

mo3:

cjnea,#04h,mo4

mov3bh,#31h

mo4:

cjnea,#05h,mo5

mov3bh,#32h

mo5:

cjnea,#06h,mo6

mov3bh,#31h

mo6:

cjnea,#07h,mo7

mov3bh,#32h

mo7:

cjnea,#08h,mo8

mov3bh,#32h

mo8:

cjnea,#09h,mo9

mov3bh,#31h

mo9:

cjnea,#10h,mo10

mov3bh,#32h

mo10:

cjnea,#11h,mo11

mov3bh,#31h

mo11:

cjnea,#12h,mo12

mov3bh,#32h

mo12:

mov a,days

adda,#99h

da

a

cjnea,#00h,nx_lpd

mova,3bh

adda,#99h

da

a

nx_lpd:movdays,a

nxt3_lp3:

jnbflag5,nxt3_lp4

mov a,months

adda,#99h

da

a

cjnea,#00h,nx_lpt

mova,#12h

nx_lpt:movmonths,a

nxt3_lp4:

jnbflag6,nxt3_lp5

mov a,years

adda,#99h

da

a

cjnea,#99h,nx_lp6

mova,#99h

nx_lp6: movyears,a

nxt3_lp5:

jnbflag7,nxt3_lp6

mov a,weekdays

adda,#99h

da

a

cjnea,#99h,nx_lp7

mova,#06h

nx_lp7: movweekdays,a

nxt3_lp6:

nxt3:

ret

data_cheke:

mov 1bh,#0d

lcall read

mov a,19h

cjnea,weekdays,data_chanj

ljmpdata_load

data_chanj:

mova,weekdays

mov 1ah,a

mov 1bh,#0d

LCALL write

movchanj,#52d

loop1:

mov 1ah,#0d

mov 1bh,chanj

LCALL write

djnzchanj,loop1

mov24h,#0d

mov25h,#0d

mov26h,#0d

ret

data_load:

mov 1bh,#1d

lcall read

mov 24h,19h

mov 1bh,#2d

lcall read

mov 25h,19h

mov 1bh,#3d

lcall read

mov 26h,19h

ret

LINE_1:

mov LCD_DATA,#080h

lcall COMMAND_BYTE

lcall DELAY1

lcall WRITE_MSG

ret

LINE_2:

mov LCD_DATA,#0c0h

lcall COMMAND_BYTE

lcall DELAY1

lcall WRITE_MSG

ret

INIT_LCD:

mov LCD_DATA,#038h

lcall COMMAND_BYTE

lcall DELAY1

mov LCD_DATA,#038h

lcall COMMAND_BYTE

lcall DELAY1

mov LCD_DATA,#038h

lcall COMMAND_BYTE

lcall DELAY1

mov LCD_DATA,#038h

lcall COMMAND_BYTE

lcall DELAY1

mov LCD_DATA,#008h

lcall COMMAND_BYTE

lcall DELAY1

mov LCD_DATA,#00ch

lcall COMMAND_BYTE

lcall DELAY1

mov LCD_DATA,#006h

lcall COMMAND_BYTE

lcall DELAY1

ret

CLR_LCD:

mov LCD_DATA,#001h

lcall COMMAND_BYTE

lcall DELAY1

ret

WRITE_MSG:

mov a,#00h

movc a,@a+dptr

cjne a,#'$',WRITE_CONT

ret

WRITE_CONT:

mov LCD_DATA,a

lcall DATA_BYTE

inc dptr

ljmp WRITE_MSG

COMMAND_BYTE:

clr lcd_rs

lcall DELAY

ljmp CMD10

DATA_BYTE:

setb lcd_rs

lcall DELAY

CMD10:

clr lcd_rw

lcall DELAY

setb lcd_en

lcall DELAY

clr lcd_en

lcall DELAY

ret

DELAY:

mov r0,#10d

DEL:

djnz r0,DEL

ret

DELAY1:

mov r0,#0d

mov r1,#20d

DELAY10:

djnz r0,DELAY10

djnz r1,DELAY10

ret

DELAY41:

mov r0,#0d

mov r1,#15d

DLP410:

djnz r0,DLP410

djnz r1,DLP410

ret

DELAY11:

mov r0,#0d

mov r1,#0d

mov r2,#4d

DLP11:

djnz r0,DLP11

djnz r1,DLP11

djnz r2,DLP11

ret

WRITBYTE:

lCALLRTC_START

MOVA,#WRITE_C

MOVR7,#08H

LCALLRTC_SHFTO

LCALLRTC_ACK

MOVA,RTC_ADD

MOVR7,#08H

LCALLRTC_SHFTO

LCALLRTC_ACK

MOVA,RTC_ADD_DATA

MOVR7,#08H

LCALLRTC_SHFTO

LCALLRTC_ACK

LCALLSTOP_BIT

LCALLACK_POL

RET

READBYTE:

lCALLRTC_START

MOVA,#WRITE_C

MOVR7,#08H

lCALLRTC_SHFTO

lCALLRTC_ACK

MOVA,RTC_ADD

MOVR7,#08H

lCALLRTC_SHFTO

lCALLRTC_ACK

lCALLRTC_START

MOVA,#READ_C

MOVR7,#08H

lCALLRTC_SHFTO

lCALLRTC_ACK

MOVR7,#08H

CLOCK8:

SETBp3.4

NOP

NOP

MOVC,p3.5

MOVA,R5

RLCA

MOVR5,A

CLRp3.4

NOP

NOP

NOP

NOP

DJNZR7,CLOCK8

MOVRTC_ADD_DATA,R5

LCALLNO_ACK

LCALLSTOP_BIT

RET

ACK_POL:

MOVR3,#40H

ACK_LOOP:

DJNZR3,DONE_YET

SJMPDN_ACKPOL

DONE_YET:

lCALLRTC_START

MOVA,#ACK_READ

MOVR7,#08H

lCALLRTC_SHFTO

lCALLRTC_ACK

JC ACK_LOOP

DN_ACKPOL:

lCALLSTOP_BIT

RET

RTC_SHFTO:CLRp3.4

NXTSHF:

RLCA

MOVp3.5,C

SETBp3.4

NOP

NOP

CLRp3.4

NOP

DJNZR7,NXTSHF

RET

RTC_START:

SETBp3.4

NOP

NOP

SETBp3.5

NOP

NOP

CLRp3.5

NOP

NOP

CLRp3.4

RET

STOP_BIT:

CLRp3.5

NOP

NOP

SETBp3.4

NOP

NOP

SETBp3.5

RET

RTC_ACK:

NOP

NOP

NOP

NOP

CLRp3.4

NOP

NOP

NOP

NOP

SETBp3.5

NOP

NOP

NOP

NOP

SETBp3.4

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

MOVC,p3.5

CLRp3.4

RET

MSTR_ACK:

CLRp3.4

NOP

NOP

CLRp3.5

NOP

NOP

NOP

NOP

SETBp3.4

NOP

NOP

CLRp3.4

NOP

NOP

SETBp3.5

RET

NO_ACK:

SETBp3.5

NOP

NOP

SETBp3.4

NOP

NOP

CLRp3.4

RET

read:

mov r6, #00h

djnz r6,$

djnz r6,$

PUSH B

MOV B, A

ACALL START

JC XR1

MOV A, #00H

ORL A, #0A0H

ACALL SHOUT

JC XR1

MOV A,1bh

ACALL SHOUT

JC XR1

MOV A, B

lCALL R_CRNT

lJMP XR2

XR1:

lCALL STOP

XR2:

MOV 19h, A

POP B

RET

START:SETB p3.7

SETB p3.6

JNB p3.7, X40

JNB p3.6, X40

NOP

NOP

CLR p3.7

NOP

NOP

NOP

NOP

CLR p3.6

CLR C

AJMP X41

X40:

SETB C

X41:

RET

STOP:

CLR p3.7

NOP

NOP

NOP

SETB p3.6

NOP

NOP

NOP

NOP

SETB p3.7

RET

SHOUT:PUSH B

MOV B, #8

X42:

RLC A

MOV p3.7, C

NOP

NOP

SETB p3.6

NOP

NOP

NOP

CLR p3.6

DJNZ B, X42

SETB p3.7

NOP

NOP

NOP

SETB p3.6

NOP

NOP

NOP

NOP

MOV C, p3.7

CLR p3.6

POP B

RET

SHIN:

SETB p3.7

PUSH B

MOV B, #8

X43:

NOP

NOP

NOP

SETB p3.6

NOP

NOP

NOP

MOV C, p3.7

RLC A

CLR p3.6

DJNZ B, X43

POP B

RET

ACK:

CLR p3.7

NOP

NOP

NOP

SETB p3.6

NOP

NOP

NOP

NOP

CLR p3.6

RET

NAK:

SETB p3.7

NOP

NOP

NOP

SETB p3.6

NOP

NOP

NOP

NOP

CLR p3.6

RET

write:

mov r6, #00h

djnz r6,$

djnz r6,$

lCALL START

JC XW2

MOV A, #00H

ORL A, #0A0H

lCALL SHOUT

JC XW1

MOV A,1bh

lCALL SHOUT

JC XW1

MOV A,1ah

lCALL SHOUT

JC XW1

CLR C

XW1:

lCALL STOP

XW2:

RET

R_CRNT:lCALL START

JC XRC2

MOV A, #00H

ORL A, #0A1H

lCALL SHOUT

JC XRC1

lCALL SHIN

lCALL NAK

CLR C

XRC1:

lCALL STOP

XRC2:

RET

MSG0: db ' SMART CARD $'

MSG1: db '12 AXS CARD READ$'

MSG2: db 'SUNMONTUEWEDTHUFRISAT$'

MSG3: db 'AXS 00 IN 00:00$'

MSG4: db ' < > OUT 00:00$'

MSG5: db ' ** WELCOME ** $'

MSG6: db ' CARD NOT VALID $'

end

_1269501873.unknown

_1288197614/CorelDRAW 11.lnk

_1245327448.unknown

_1266586478.unknown

_1268746377.unknown

_1266586427.unknown

_1228060273.unknown