Microcontroller › 8051 › NEED HELP IN SOURCE CODE TO SOLVE THE ERROR!!!
- This topic has 0 replies, 1 voice, and was last updated 11 years, 9 months ago by geet.
-
AuthorPosts
-
March 5, 2013 at 5:22 pm #2162geetParticipant
Hello i am making ‘rfid based attendance system using microcontroller AT89S52.When m compiling the below program that is showing some error.Can anyone resolve these error.The error are highlighted.Thanx.
1. #include <regX52.h>
2. RB0 EQU 00H ; Select Register Bank 0
3. RB1 EQU 08H ; Select Register Bank 1 …poke to PSW to use//RFID12.C(2): error C129: missing ‘;’ before ‘EQU’
4. RB2 EQU 10H ; Select Register Bank 1 …poke to PSW to use
5. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6. ; PORT DECLERATION
7. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8. SDA EQU P1.2 ;SDA=PIN5
9. SCL EQU P1.1 ;SCL=PIN6
10. DS1307W EQU 0D0H ; SLAVE ADDRESS 1101 000 + 0 TO WRITE
11. DS1307R EQU 0D1H ; SLAVE ADDRESS 1101 000 + 1 TO READ
12. KB_LSHIFT EQU 12H
13. KB_RSHIFT EQU 59H
14. KB_CTRL EQU 14H
15. KB_ALT EQU 11H
16. KB_CAPS EQU 58H
17. KB_SCROLL EQU 7EH
18. KB_NUML EQU 77H
19. KB_TAB EQU 0DH
20. KB_REL EQU 0F0H
21. KB_EXT EQU 0E0H
22. KB_PAUSE EQU 0E1H
23. CAPS EQU 01H
24. NUML EQU 02H
25. SCROLL EQU 04H
26. SHIFT EQU 08H
27. ACK EQU 10H
28. CTRL EQU 20H
29. ALT EQU 40H
30. RELEASE EQU 80H
31. PAUSED EQU 40H
32. EXTENDED EQU 80H
33. SDA1 EQU P2.3 ;SDA=PIN5
34. SCL1 EQU P2.2 ;SCL=PIN6
35. WTCMD EQU 10100000B ;WRITE DATA COMMAND Note 3
36. RDCMD EQU 10100001B ;READ DATA COMMAND Note 3
37. UP EQU P1.4
38. DOWN EQU P1.6
39. ENTER EQU P1.7
40. CANCEL EQU P1.5
41. SEND EQU P2.0
42. ; ***LCD CONTROL***
43. LCD_RS EQU P0.0 ;LCD REGISTER SELECT LINE
44. LCD_E EQU P0.1 ;LCD ENABLE LINE
45. LCD_DB4 EQU P0.2 ;PORT 1 IS USED FOR DATA
46. LCD_DB5 EQU P0.3 ;USED FOR DATA
47. LCD_DB6 EQU P0.4 ;FOR DATA
48. LCD_DB7 EQU P0.5 ;FOR DATA
49. ; ***CURSOR CONTROL INSTRUCTIONS***
50. OFFCUR EQU 0CH
51. BLINKCUR EQU 0DH
52. ; ***DISPLAY CONTROL INSTRUCTIONS***
53. CLRDSP EQU 01H
54. ONDSP EQU 0CH
55. ; ***SYSTEM INSTRUCTIONS***
56. CONFIG EQU 28H ; 4-BIT DATA,2 LINES,5X7 MATRIX LCD
57. ENTRYMODE EQU 6 ; INCREMENT CURSOR DON’T SHIFT DISPLAY //rfid12.c(73): error C305: unterminated string/char const
58. KEYB_CLOCK EQU P2.7
59. KEYB_DATA EQU P2.6
60. DSEG ; This is internal data memory
61. ORG 20H ; Bit adressable memory
62. FLAGS1: DS 1
63. RECEIVED BIT FLAGS1.0
64. AM BIT FLAGS1.1
65. MAS BIT FLAGS1.2
66. KEYBRD BIT FLAGS1.3
67. AMS BIT FLAGS1.4
68. COUNTER: DS 1
69. FLAGS: DS 1
70. LASTREAD BIT FLAGS.0
71. SQW BIT FLAGS.4
72. ACKS BIT FLAGS.5
73. BUS_FLT BIT FLAGS.6
74. _2W_BUSY BIT FLAGS.7
75. CANCEL1 BIT FLAGS.2
76. ALARM BIT FLAGS.3
77. CAPPS_ON: DS 1
78. CAAPS BIT CAPPS_ON
79. BITCNT: DS 1
80. BYTECNT: DS 1
81. BYTE: DS 10
82. BYTES: DS 10
83. SECS: DS 1 ; ‘ SECONDS STORAGE RAM //rfid12.c(109): error C305: unterminated string/char const
84. MINS: DS 1 ; ‘ MINUTES ‘ ‘ //rfid12.c(109): error C305: unterminated string/char const
85. HRS: DS 1 ; ‘ HOURS ‘ ‘ //rfid12.c(109): error C305: unterminated string/char const
86. DAY: DS 1 ; ‘ DAY ‘ ‘// rfid12.c(109): error C305: unterminated string/char const
87. DATE1: DS 1 ; ‘ DATE ‘ ‘//rfid12.c(110): error C305: unterminated string/char const
88. MONTH: DS 1 ; ‘ MONTH ‘ ‘ //rfid12.c(111): error C305: unterminated string/char const
89. YEAR: DS 1 ; ‘ YEAR ‘ ‘//rfid12.c(112): error C305: unterminated string/char const
90. TOTAL: DS 1 ;TOTAL COUNT
91. TEMP: DS 1
92. TEMPS: DS 1
93. KB_OK: DS 1
94. KB_DATA: DS 1
95. KB_STATS: DS 1
96. KB_SCAN: DS 1
97. KB_TEMP: DS 1 ; For the da*n pause key
98. KB_COUNT: DS 1
99. NAMES: DS 16
100. COUNTT: DS 1
101. STACK: DS 1
102. rfid12.c(127): error C305: unterminated string/char const
103. ; ***MACRO’S***
104. SCL_HIGH MACRO
105. SETB SCL ; SET SCL HIGH
106. JNB SCL,$ ; LOOP UNTIL STRONG 1 ON SCL
107. ENDM
108. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
109. CSEG ; Code begins here
110. ;
==========
==========
=========
111. ; Main routine. Program execution starts here.
112. ;
==========
==========
=========
i. ORG 00H ; Reset
ii. AJMP MAIN
iii. ORG 23H
iv. JMP SERIAL
113. ;
==========
==========
=========
114. MAIN:
115. MOV PSW,#RB0 ; Select register bank 0
a. MOV SP,#STACK
116. ; **********************************************************
117. ; INITILIZE RTC
118. ; **********************************************************
a. SETB SDA ; ENSURE SDA HIGH
119. SCL_HIGH ; ENSURE SCL HIGH
120. CLR ACKS ; CLEAR STATUS FLAGS
121. CLR BUS_FLT
122. CLR _2W_BUSY
a. CLR SQW
b. CALL OSC_CONTROL ;Initilize the RTC
123. ; **********************************************************
1. MOV TMOD,#20H
2. MOV TH1,#0FDH
3. MOV SCON,#50H
4. SETB ES
5. SETB EA
6. SETB TR1
7. MOV COUNTER,#01H
b. CLR RECEIVED
c. CLR KEYBRD
1. CALL RESETLCD4
2. CALL INITLCD4
3. CALL TITLES
124. ; MOV TOTAL,#00H
125. ; CALL WRITE_TOTAL
126. ; **********************************************************
127. ; CHECK FOR ENTER THE TIME
128. ; **********************************************************
a. LCALL SEND_START ; SEND 2WIRE START CONDITION
b. MOV A,#DS1307W ; SEND DS1307 WRITE COMMAND
c. LCALL SEND_BYTE
d. MOV A,#08H ; SET POINTER TO REG 08H ON DS1307
e. LCALL SEND_BYTE
f. LCALL SEND_STOP ; SEND STOP CONDITION
g. LCALL SEND_START ; SEND START CONDITION
h. MOV A,#DS1307R ; SEND DS1307 READ COMMAND
i. LCALL SEND_BYTE
j. LCALL READ_BYTE ; READ A BYTE OF DATA
k. MOV R1,A
l. LCALL SEND_STOP ; SEND 2WIRE STOP CONDITION
m. CJNE A,#0AAH,SET_RTC
n. AJMP TOP
129. ;**********************************************************
130. ; STORE RTC TIME
131. ;**********************************************************
132. KBNotOKS:
1. CALL DISP1
2. JB ENTER,$
3. NOP
4. JNB ENTER,$
5. AJMP FXC4
133. ;************************************************************************
134. SET_RTC:
1. MOV TEMP,#00H
2. JB KEYBRD,LAOPS
135. FXC4: CALL InitKeyb ;Inizialize Keyboard
a. MOV a, KB_OK
b. JZ KBNotOKS
c. SETB KEYBRD
136. LAOPS: LCALL LOAPA
137. ;************************************************************************
138. ;************************************************************************
139. ; MOV R1,#BYTE
140. ; MOV R4,#10H ;MASTER ADDRESS
141. ; CALL STORE_EEPROM
142. ; MOV TOTAL,#00H
143. ; CALL WRITE_TOTAL
144. ; MOV COUNTT,#00H
145. ; CALL WRITE_COUNTT
146. ;************************************************************************
147. TOOPS: SETB SEND
148. TOP: CALL RTCLOCK
1. MOV R0,#04H
149. RX3: MOV R1,#0FFH
150. RX1: MOV R2,#0FFH
151. RX2: JB RECEIVED,TOPS
1. DJNZ R2,RX2
2. DJNZ R1,RX1
3. DJNZ R0,RX3
4. AJMP TOP
152. ;************************************************************************
153. TOPS: MOV COUNTER,#01H
1. CLR RECEIVED
2. CLR ES
3. MOV R1,#BYTES ;CHECK FOR MASTER CARD
4. MOV R4,#10H ;MASTER ADDRESS
5. MOV R6,#10 ;NUMBER OF BYTES
6. CALL READ_EEPROM
7. CLR MAS
8. CALL COMPARE
9. JNB MAS,OTHER1
10. CALL DISPLAY
11. CALL DELAYS
12. CALL DELAYS
154. REP1: MOV TEMP,#01H
1. CALL DISPLAY1 ;Press enter to add tag
2. SETB UP
3. SETB DOWN
4. SETB ENTER
5. SETB CANCEL
155. UJI1: JNB CANCEL, VBN1
1. JNB UP,VBN2
2. JNB DOWN,VBN3
3. JNB ENTER,VBN4
4. AJMP UJI1
156. OTHER1: AJMP OTHER
157. VBN1: JNB CANCEL,$
1. SETB ES
2. CLR RECEIVED
3. AJMP TOP
158. VBN2: JNB UP,$
1. CALL DISPLAY1
2. MOV TEMP,#01H
3. AJMP UJI1
159. VBN3: JNB DOWN,$
1. CALL DISPLAY2
2. MOV TEMP,#02H
3. AJMP UJI1
160. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
161. GHO1: CJNE R5,#02H,GHO2 ;Delete Tag
1. JNB ENTER,$
2. JMP DELETE_PGM
162. GHO2: JNB ENTER,$
1. AJMP UJI1
163. KBNotOK:
1. CALL DISP1
2. JB ENTER,$
3. NOP
4. JNB ENTER,$
5. AJMP FDC4
164. REAP1: CALL DELAY
1. JNB CANCEL,$
2. AJMP REP1
165. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
166. VBN4: MOV R5,TEMP
1. CJNE R5,#01H,GHO1 ;Add Tag
167. VBC1: CLR RECEIVED
1. CALL DISPLAY3 ;Show TAG
2. SETB ES
168. FVG1: JNB CANCEL,REAP1
1. JNB RECEIVED,FVG1
2. CLR ES
3. JB KEYBRD,LOOP1
169. FDC4: CALL InitKeyb ;Inizialize Keyboard
a. MOV a, KB_OK
b. JZ KBNotOK
c. SETB KEYBRD
170. LOOP1: CALL DISPLAY4 ;plz enter name
1. MOV TEMP,#00H
2. CALL CLEAR_RAM
171. EDC: CALL LOOP
a. INC TEMP
b. MOV R2,TEMP
c. CJNE R2,#01H,EDC1
d. MOV R1,#NAMES
e. MOV @R1,KB_DATA
172. EDC1: CJNE R2,#02H,EDC2
a. MOV R1,#NAMES+1
b. MOV @R1,KB_DATA
173. EDC2: CJNE R2,#03H,EDC3
a. MOV R1,#NAMES+2
b. MOV @R1,KB_DATA
174. EDC3: CJNE R2,#04H,EDC4
a. MOV R1,#NAMES+3
b. MOV @R1,KB_DATA
175. EDC4: CJNE R2,#05H,EDC5
a. MOV R1,#NAMES+4
b. MOV @R1,KB_DATA
176. EDC5: CJNE R2,#06H,EDC6
a. MOV R1,#NAMES+5
b. MOV @R1,KB_DATA
177. EDC6: CJNE R2,#07H,EDC7
a. MOV R1,#NAMES+6
b. MOV @R1,KB_DATA
178. EDC7: CJNE R2,#08H,EDC8
a. MOV R1,#NAMES+7
b. MOV @R1,KB_DATA
179. EDC8: CJNE R2,#09H,EDC9
a. MOV R1,#NAMES+8
b. MOV @R1,KB_DATA
180. EDC9: CJNE R2,#10,EDC10
a. MOV R1,#NAMES+9
b. MOV @R1,KB_DATA
181. EDC10: CJNE R2,#11,EDC11
a. MOV R1,#NAMES+10
b. MOV @R1,KB_DATA
182. EDC11: CJNE R2,#12,EDC12
a. MOV R1,#NAMES+11
b. MOV @R1,KB_DATA
183. EDC12: CJNE R2,#13,EDC13
a. MOV R1,#NAMES+12
b. MOV @R1,KB_DATA
184. EDC13: CJNE R2,#14,EDC14
a. MOV R1,#NAMES+13
b. MOV @R1,KB_DATA
185. EDC14: CJNE R2,#15,EDC15
a. MOV R1,#NAMES+14
b. MOV @R1,KB_DATA
186. EDC15: CJNE R2,#16,EDC16
a. MOV R1,#NAMES+15
b. MOV @R1,KB_DATA
187. EDC16: CJNE R2,#17,EDC
a. CALL DELAYS
b. CALL PRESS_ENTER
c. SETB ENTER
d. SETB CANCEL
188. HHJ: JNB CANCEL,LOOP1S
a. JB ENTER,HHJ
b. CALL READ_TOTAL
c. INC TOTAL
d. MOV A,TOTAL
1. CJNE A,#01H,JNM1
2. MOV R1,#BYTE ;store tag ID
3. MOV R4,#20H ;Starting Address
4. MOV R6,#10 ;STORE 10 BYTES
5. CALL STORE_EEPROM
6. CALL MDELAY
7. MOV R1,#NAMES ;store Name
8. MOV R4,#30H ;Starting Address
9. MOV R6,#16 ;STORE 16 BYTES
10. CALL STORE_EEPROM
11. AJMP JNM
189. LOOP1S: AJMP LOOP1
190. JNM1: CJNE A,#02H,JNM2
1. MOV R1,#BYTE ;store tag ID
2. MOV R4,#40H ;Starting Address
3. MOV R6,#10 ;STORE 10 BYTES
4. CALL STORE_EEPROM
5. CALL MDELAY
6. MOV R1,#NAMES ;store Name
7. MOV R4,#50H ;Starting Address
8. MOV R6,#16 ;STORE 16 BYTES
9. CALL STORE_EEPROM
10. AJMP JNM
191. JNM2: CJNE A,#03H,JNM3
1. MOV R1,#BYTE ;store tag ID
2. MOV R4,#60H ;Starting Address
3. MOV R6,#10 ;STORE 10 BYTES
4. CALL STORE_EEPROM
5. CALL MDELAY
6. MOV R1,#NAMES ;store Name
7. MOV R4,#70H ;Starting Address
8. MOV R6,#16 ;STORE 16 BYTES
9. CALL STORE_EEPROM
10. AJMP JNM
192. JNM3: CJNE A,#04H,JNM4
1. MOV R1,#BYTE ;store tag ID
2. MOV R4,#80H ;Starting Address
3. MOV R6,#10 ;STORE 10 BYTES
4. CALL STORE_EEPROM
5. CALL MDELAY
6. MOV R1,#NAMES ;store Name
7. MOV R4,#90H ;Starting Address
8. MOV R6,#16 ;STORE 16 BYTES
9. CALL STORE_EEPROM
10. AJMP JNM
193. JNM4: CJNE A,#05H,JNM5
1. MOV R1,#BYTE ;store tag ID
2. MOV R4,#0A0H ;Starting Address
3. MOV R6,#10 ;STORE 10 BYTES
4. CALL STORE_EEPROM
5. CALL MDELAY
6. MOV R1,#NAMES ;store Name
7. MOV R4,#0B0H ;Starting Address
8. MOV R6,#16 ;STORE 16 BYTES
9. CALL STORE_EEPROM
10. AJMP JNM
194. JNM5: CJNE A,#06H,JNM6
1. MOV R1,#BYTE ;store tag ID
2. MOV R4,#0C0H ;Starting Address
3. MOV R6,#10 ;STORE 10 BYTES
4. CALL STORE_EEPROM
5. CALL MDELAY
6. MOV R1,#NAMES ;store Name
7. MOV R4,#0D0H ;Starting Address
8. MOV R6,#16 ;STORE 16 BYTES
9. CALL STORE_EEPROM
10. AJMP JNM
195. JNM6: CJNE A,#07H,JNM
1. MOV R1,#BYTE ;store tag ID
2. MOV R4,#0E0H ;Starting Address
3. MOV R6,#10 ;STORE 10 BYTES
4. CALL STORE_EEPROM
5. CALL MDELAY
6. MOV R1,#NAMES ;store Name
7. MOV R4,#0F0H ;Starting Address
8. MOV R6,#16 ;STORE 16 BYTES
9. CALL STORE_EEPROM
10. AJMP JNM
196. JNM: CALL ID_SAVED ;Tag stored sucessfully
1. CALL WRITE_TOTAL ;WRITE TOTAL ID IN MEMORY
2. CALL DELAYS
3. JNB ENTER,$
4. AJMP REP1
197. Loop: CALL Check_Keyb
1. JNB ENTER,GHBH
2. JNB CANCEL,DCFV1
b. JNC Loop
c. MOV R4,KB_DATA
198. CALL WRLCDDATA
199. RET
200. GHBH: JNB ENTER,$
1. MOV TEMP,#16
2. RET
201. DCFV1: JNB CANCEL,$
1. AJMP LOOP1
202. ;********************************************
203. OTHER:
1. CALL READ_TOTAL
2. MOV R2,TOTAL
3. CALL CLEAR_RAM
4. ;check first card
5. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
6. MOV R4,#20H ;MASTER ADDRESS
7. MOV R6,#10 ;NUMBER OF BYTES
8. CALL READ_EEPROM
9. CLR MAS
10. CALL COMPARE
11. JNB MAS,GAN1
12. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
13. MOV R4,#30H ;MASTER ADDRESS
14. MOV R6,#16 ;NUMBER OF BYTES
15. CALL READ_EEPROM
16. CALL NAMES1
17. CALL DISP_NAME
18. AJMP GAN2
204. GAN1:
1. ;check 2 card
2. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
3. MOV R4,#40H ;MASTER ADDRESS
4. MOV R6,#10 ;NUMBER OF BYTES
5. CALL READ_EEPROM
6. CLR MAS
7. CALL COMPARE
8. JNB MAS,GAN3
9. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
10. MOV R4,#50H ;MASTER ADDRESS
11. MOV R6,#16 ;NUMBER OF BYTES
12. CALL READ_EEPROM
13. CALL NAMES1
14. CALL DISP_NAME
15. AJMP GAN2
205. GAN3:
1. ;check 3 card
2. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
3. MOV R4,#60H ;MASTER ADDRESS
4. MOV R6,#10 ;NUMBER OF BYTES
5. CALL READ_EEPROM
6. CLR MAS
7. CALL COMPARE
8. JNB MAS,GAN4
9. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
10. MOV R4,#70H ;MASTER ADDRESS
11. MOV R6,#16 ;NUMBER OF BYTES
12. CALL READ_EEPROM
13. CALL NAMES1
14. CALL DISP_NAME
15. AJMP GAN2
206. GAN4:
1. ;check 2 card
2. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
3. MOV R4,#80H ;MASTER ADDRESS
4. MOV R6,#10 ;NUMBER OF BYTES
5. CALL READ_EEPROM
6. CLR MAS
7. CALL COMPARE
8. JNB MAS,GAN5
9. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
10. MOV R4,#90H ;MASTER ADDRESS
11. MOV R6,#16 ;NUMBER OF BYTES
12. CALL READ_EEPROM
13. CALL NAMES1
14. CALL DISP_NAME
15. AJMP GAN2
207. GAN5:
1. ;check 2 card
2. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
3. MOV R4,#0A0H ;MASTER ADDRESS
4. MOV R6,#10 ;NUMBER OF BYTES
5. CALL READ_EEPROM
6. CLR MAS
7. CALL COMPARE
8. JNB MAS,GAN6
9. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
10. MOV R4,#0B0H ;MASTER ADDRESS
11. MOV R6,#16 ;NUMBER OF BYTES
12. CALL READ_EEPROM
13. CALL NAMES1
14. CALL DISP_NAME
15. AJMP GAN2
208. GAN6: ;check 2 card
1. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
2. MOV R4,#0C0H ;MASTER ADDRESS
3. MOV R6,#10 ;NUMBER OF BYTES
4. CALL READ_EEPROM
5. CLR MAS
6. CALL COMPARE
7. JNB MAS,GAN7
8. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
9. MOV R4,#0D0H ;MASTER ADDRESS
10. MOV R6,#16 ;NUMBER OF BYTES
11. CALL READ_EEPROM
12. CALL NAMES1
13. CALL DISP_NAME
14. AJMP GAN2
209. GAN7: ;check 2 card
1. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
2. MOV R4,#0E0H ;MASTER ADDRESS
3. MOV R6,#10 ;NUMBER OF BYTES
4. CALL READ_EEPROM
5. CLR MAS
6. CALL COMPARE
7. JNB MAS,GAN8
8. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
9. MOV R4,#0F0H ;MASTER ADDRESS
10. MOV R6,#16 ;NUMBER OF BYTES
11. CALL READ_EEPROM
12. CALL NAMES1
13. CALL DISP_NAME
14. AJMP GAN2
210. GAN8: ;check 2 card
1. MOV R1,#BYTES ;GET DATA IN BYTES(RAM)
2. MOV R4,#30H ;MASTER ADDRESS
3. MOV R6,#10 ;NUMBER OF BYTES
4. CALL READ_EEPROM
5. CLR MAS
6. CALL COMPARE
7. JNB MAS,GAN9
8. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
9. MOV R4,#40H ;MASTER ADDRESS
10. MOV R6,#16 ;NUMBER OF BYTES
11. CALL READ_EEPROM
12. CALL NAMES1
13. CALL DISP_NAME
14. AJMP GAN2
211. GAN9:
1. CALL CARD_ERROR
2. SETB ES
3. CALL DELAYS
4. CALL DELAYS
5. AJMP TOP
212. GAN2: CALL TRANSMIT_DATA
1. SETB ES
2. CALL DELAYS
3. CALL DELAYS
4. AJMP TOP
213. NAMES1:
i. JNB AM,ASX1 ;jmp if PM
ii. CALL NAME1
iii. RET
214. ASX1: CALL NAME3
i. RET
215. ;##########################################################
216. ; DISPLAY ROUTINES
217. ;##########################################################
218. TITLES:
a. MOV DPTR,#MSAG
b. CALL LCD_MSG
c. RET
219. MSAG:
a. DB 1H,81H,’RFID Based’,0C0H,’Attendance Sys’,00H
220. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
221. TITLE1:
a. MOV DPTR,#MSAG1
b. CALL LCD_MSG
c. RET
222. MSAG1:
a. DB 1H,81H,’RFID Data:’,0C0H,00H
223. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224. DISPLAY:
a. MOV DPTR,#MSAG2
b. CALL LCD_MSG
c. RET
225. MSAG2:
a. DB 1H,80H,’Master Card’,0C0H,’Detected…’,00H
226. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227. DISPLAY1:
a. MOV DPTR,#MSAG3
b. CALL LCD_MSG
c. RET
228. MSAG3:
a. DB 1H,80H,’Press Enter…’,0C0H,’*** ADD TAG ***’,00H
229. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230. DISPLAY2:
a. MOV DPTR,#MSAG4
b. CALL LCD_MSG
c. RET
231. MSAG4:
a. DB 1H,80H,’Press Enter…’,0C1H,’** EDIT TAG **’,00H
232. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233. DISPLAY3:
a. MOV DPTR,#MSAG5
b. CALL LCD_MSG
c. RET
234. MSAG5:
a. DB 1H,80H,’Please show the’,0C3H,’** TAG **’,00H
235. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236. DISPLAY4:
a. MOV DPTR,#MSAG6
b. CALL LCD_MSG
c. RET
237. MSAG6:
a. DB 1H,0FH,80H,’Plz enter Name’,0C0H,00H
238. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
239. DISPLAY5:
a. MOV DPTR,#MSAG7
b. CALL LCD_MSG
c. RET
240. MSAG7:
a. DB 1H,80H,’Press enter EDIT’,0C0H,00H
241. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
242. DISP1:
a. MOV DPTR,#MSG1
b. CALL LCD_MSG
c. RET
243. MSG1:
a. DB 1H,84H,’Keyboard’,0C3H,’* Not Ok *’, 00H
244. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245. DATE_DISP:
a. MOV DPTR,#MSG2
b. CALL LCD_MSG
c. RET
246. MSG2:
a. DB 1H,80H,’Enter Date’,0C0H,'(01-31):’,00H
247. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248. MON_DISP:
a. MOV DPTR,#MSG3
b. CALL LCD_MSG
c. RET
249. MSG3:
a. DB 1H,80H,’Enter Month’,0C0H,'(01-12):’,00H
250. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
251. YR_DISP:
a. MOV DPTR,#MSG4
b. CALL LCD_MSG
c. RET
252. MSG4:
a. DB 1H,80H,’Enter Year’,0C0H,'(00-99):’,00H
253. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254. HR_DISP:
a. MOV DPTR,#MSG5
b. CALL LCD_MSG
c. RET
255. MSG5:
a. DB 1H,80H,’Enter Hour’,0C0H,'(01-12):’,00H
256. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
257. MIN_DISP:
a. MOV DPTR,#MSG6
b. CALL LCD_MSG
c. RET
258. MSG6:
a. DB 1H,80H,’Enter Minutes’,0C0H,'(00-59):’,00H
259. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260. DAY_DISP:
a. MOV DPTR,#MSG7
b. CALL LCD_MSG
c. RET
261. MSG7:
a. DB 1H,80H,’Enter Day’,0C0H,'(0-7):’,00H
262. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263. AMS_DISP:
a. MOV DPTR,#MSG8
b. CALL LCD_MSG
c. RET
264. MSG8:
a. DB 1H,80H,’Enter AM/PM’,0C0H,’AM=0,PM=1:’,00H
265. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
266. AM_DISP:
a. MOV DPTR,#MSG9
b. CALL LCD_MSG
c. RET
267. MSG9:
a. DB 1H,80H,’Enter AM/PM’,0C0H,’AM=0,PM=1: AM’,00H
268. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269. PM_DISP:
a. MOV DPTR,#MSG10
b. CALL LCD_MSG
c. RET
270. MSG10:
a. DB 1H,80H,’Enter AM/PM’,0C0H,’AM=0,PM=1: PM’,00H
271. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272. PRESS_ENTER:
a. MOV DPTR,#MSG11
b. CALL LCD_MSG
c. RET
273. MSG11:
a. DB 1H,82H,’Press Enter’,0C4H,’to Save’,00H
274. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
275. ID_SAVED:
a. MOV DPTR,#MSG12
b. CALL LCD_MSG
c. RET
276. MSG12:
a. DB 1H,83H,’TAG Saved’,0C2H,’Sucessfully’,00H
277. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278. NAME1:
a. MOV DPTR,#MSG13
b. CALL LCD_MSG
c. RET
279. MSG13:
a. DB 1H,80H,’* Good Morning *’,0C0H,00H
280. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281. NAME3:
a. MOV DPTR,#MSG132
b. CALL LCD_MSG
c. RET
282. MSG132:
a. DB 1H,80H,’* Good Evening *’,0C0H,00H
283. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
284. CARD_ERROR:
a. MOV DPTR,#MSG14
b. CALL LCD_MSG
c. RET
285. MSG14:
a. DB 1H,84H,’Card Not’,0C3H,’Programmed’,00H
286. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
287. NO_CARD:
a. MOV DPTR,#MSG15
b. CALL LCD_MSG
c. RET
288. MSG15:
a. DB 1H,84H,’No card’,0C3H,’Programmed’,00H
289. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290. SENDING_DATA:
a. MOV DPTR,#MSG16
b. CALL LCD_MSG
c. RET
291. MSG16:
a. DB 1H,80H,’Sending Data…’,00H
292. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293. TIME_OUT:
a. MOV DPTR,#MSG17
b. CALL LCD_MSG
c. RET
294. MSG17:
a. DB 1H,82H,’** Sorry **’,0C4H,’Time out’,00H
295. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296. SHOW_MASTER:
a. MOV DPTR,#MSG18
b. CALL LCD_MSG
c. RET
297. MSG18:
a. DB 1H,80H,’Show Master Card’,0C0H,’to Send data PC’,00H
298. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299. SEND_COMPLETED:
a. MOV DPTR,#MSG19
b. CALL LCD_MSG
c. RET
300. MSG19:
a. DB 1H,80H,’Datas tranmitted’,0C3H,’Sucessfully’,00H
301. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302. WANTTO_DELETE:
a. MOV DPTR,#MSG20
b. CALL LCD_MSG
c. RET
303. MSG20:
a. DB 1H,80H,’Want to Delete’,0C3H,’All Records’,00H
304. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
305. DATA_DELETED:
a. MOV DPTR,#MSG21
b. CALL LCD_MSG
c. RET
306. MSG21:
a. DB 1H,80H,’* Data Deleted *’,0C3H,’Sucessfully’,00H
307. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308. CARD_NOTPROG:
a. MOV DPTR,#MSG22
b. CALL LCD_MSG
c. RET
309. MSG22:
a. DB 1H,80H,’* Master Card *’,0C5H,’Error’,00H
310. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
312. ; COMPARE WITH MASTER CARD
313. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
314. COMPARE:
1. MOV A,BYTES
2. CJNE A,BYTE,FGG
3. MOV A,BYTES+1
4. CJNE A,BYTE+1,FGG
5. MOV A,BYTES+2
6. CJNE A,BYTE+2,FGG
7. MOV A,BYTES+3
8. CJNE A,BYTE+3,FGG
9. MOV A,BYTES+4
10. CJNE A,BYTE+4,FGG
11. MOV A,BYTES+5
12. CJNE A,BYTE+5,FGG
13. MOV A,BYTES+6
14. CJNE A,BYTE+6,FGG
15. MOV A,BYTES+7
16. CJNE A,BYTE+7,FGG
17. MOV A,BYTES+8
18. CJNE A,BYTE+8,FGG
19. MOV A,BYTES+9
20. CJNE A,BYTE+9,FGG
21. SETB MAS
315. FGG: RET
316. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317. DELAY:
i. MOV R1,#0FFH
318. RE1: MOV R2,#0FFH
319. RE: NOP
i. DJNZ R2,RE
ii. DJNZ R1,RE1
iii. RET
320. ;**********************************************************
321. DELAYS: ;One second delay routine
a. MOV R0,#05H
322. RS3: MOV R1,#0FFH
323. RA1: MOV R2,#0FFH
324. RS2: NOP
i. DJNZ R2,RS2
ii. DJNZ R1,RA1
iii. DJNZ R0,RS3
325. RET
326. ;
==========
==========
=========
327. SERIAL:
i. PUSH PSW ; save current registerset
ii. MOV PSW,#RB1
328. PUSH ACC
i. JB TI,TRANS
ii. MOV A,SBUF
iii. CJNE A,#0AH,DOWNW
iv. MOV COUNTER,#01H
v. AJMP DDWN
329. DOWNW:CJNE A,#0DH,DOWN2
i. MOV COUNTER,#01H
ii. AJMP DDWN
330. DOWN2:
i. MOV R1,COUNTER
ii. CJNE R1,#01H,YH1
iii. MOV BYTE,A
iv. AJMP DOWN1
331. YH1: CJNE R1,#02H,YH2
i. MOV BYTE+1,A
ii. AJMP DOWN1
332. YH2: CJNE R1,#03H,YH3
i. MOV BYTE+2,A
ii. AJMP DOWN1
333. YH3: CJNE R1,#04H,YH4
i. MOV BYTE+3,A
ii. AJMP DOWN1
334. YH4: CJNE R1,#05H,YH5
i. MOV BYTE+4,A
ii. AJMP DOWN1
335. YH5: CJNE R1,#06H,YH6
i. MOV BYTE+5,A
ii. AJMP DOWN1
336. YH6: CJNE R1,#07H,YH7
i. MOV BYTE+6,A
ii. AJMP DOWN1
337. YH7: CJNE R1,#08H,YH8
i. MOV BYTE+7,A
ii. AJMP DOWN1
338. YH8: CJNE R1,#09H,YH9
i. MOV BYTE+8,A
ii. AJMP DOWN1
339. YH9: CJNE R1,#0AH,DOWN1
i. MOV BYTE+9,A
ii. SETB RECEIVED
iii. AJMP DOWN1
340. DOWN1:INC COUNTER
341. DDWN: CLR RI
i. POP ACC
b. POP PSW
i. RETI
342. TRANS: CLR TI
i. POP ACC
b. POP PSW
i. RETI
343. ;**********************************************************
344. ; INITIALIZE THE LCD 4-BIT MODE
345. ;**********************************************************
346. INITLCD4:
347. CLR LCD_RS ; LCD REGISTER SELECT LINE
348. CLR LCD_E ; ENABLE LINE
349. MOV R4, #CONFIG; FUNCTION SET – DATA BITS,
i. ; LINES, FONTS
350. CALL WRLCDCOM4
351. MOV R4, #ONDSP ; DISPLAY ON
352. CALL WRLCDCOM4
353. MOV R4, #ENTRYMODE ; SET ENTRY MODE
354. CALL WRLCDCOM4 ; INCREMENT CURSOR RIGHT, NO SHIFT
355. MOV R4, #CLRDSP; CLEAR DISPLAY, HOME CURSOR
356. CALL WRLCDCOM4
357. RET
358. ; **********************************************************
359. ; SOFTWARE VERSION OF THE POWER ON RESET
360. ; **********************************************************
361. RESETLCD4:
362. CLR LCD_RS ; LCD REGISTER SELECT LINE
363. CLR LCD_E ; ENABLE LINE
364. CLR LCD_DB7 ; SET BIT PATTERN FOR…
365. CLR LCD_DB6 ; … POWER-ON-RESET
366. SETB LCD_DB5
367. SETB LCD_DB4
368. SETB LCD_E ; START ENABLE PULSE
369. CLR LCD_E ; END ENABLE PULSE
370. MOV A, #4 ; DELAY 4 MILLISECONDS
371. CALL MDELAY
372. SETB LCD_E ; START ENABLE PULSE
373. CLR LCD_E ; END ENABLE PULSE
374. MOV A, #1 ; DELAY 1 MILLISECOND
375. CALL MDELAY
376. SETB LCD_E ; START ENABLE PULSE
377. CLR LCD_E ; END ENABLE PULSE
378. MOV A, #1 ; DELAY 1 MILLISECOND
379. CALL MDELAY
380. CLR LCD_DB4 ; SPECIFY 4-BIT OPERATION
381. SETB LCD_E ; START ENABLE PULSE
382. CLR LCD_E ; END ENABLE PULSE
383. MOV A, #1 ; DELAY 1 MILLISECOND
384. CALL MDELAY
385. MOV R4, #CONFIG; FUNCTION SET
386. CALL WRLCDCOM4
387. MOV R4, #08H ; DISPLAY OFF
388. CALL WRLCDCOM4
389. MOV R4, #1 ; CLEAR DISPLAY, HOME CURSOR
390. CALL WRLCDCOM4
391. MOV R4,#ENTRYMODE ; SET ENTRY MODE
392. ACALL WRLCDCOM4
a. JMP INITLCD4
393. ; **********************************************************
394. ; SUB WRITES A COMMAND WORD TO THE LCD
395. ; COMMAND MUST BE PLACED IN R4 BY CALLING PROGRAM
396. ; **********************************************************
397. WRLCDCOM4:
398. CLR LCD_E
399. CLR LCD_RS ; SELECT SEND COMMAND
400. PUSH ACC ; SAVE ACCUMULATOR
401. MOV A, R4 ; PUT DATA BYTE IN ACC
402. MOV C, ACC.4 ; LOAD HIGH NIBBLE ON DATA BUS
403. MOV LCD_DB4, C ; ONE BIT AT A TIME USING…
404. MOV C, ACC.5 ; BIT MOVE OPERATOINS
405. MOV LCD_DB5, C
406. MOV C, ACC.6
407. MOV LCD_DB6, C
408. MOV C, ACC.7
409. MOV LCD_DB7, C
410. SETB LCD_E ; PULSE THE ENABLE LINE
411. CLR LCD_E
412. MOV C, ACC.0 ; SIMILARLY, LOAD LOW NIBBLE
413. MOV LCD_DB4, C
414. MOV C, ACC.1
415. MOV LCD_DB5, C
416. MOV C, ACC.2
417. MOV LCD_DB6, C
418. MOV C, ACC.3
419. MOV LCD_DB7, C
420. CLR LCD_E
421. SETB LCD_E ; PULSE THE ENABLE LINE
422. CLR LCD_E
423. CALL MADELAY
424. POP ACC
425. RET
426. ; **********************************************************
427. ; SUB TO WRITE A DATA WORD TO THE LCD
428. ; DATA MUST BE PLACED IN R4 BY CALLING PROGRAM
429. ; **********************************************************
430. WRLCDDATA:
431. CLR LCD_E
432. SETB LCD_RS ; SELECT SEND DATA
433. PUSH ACC ; SAVE ACCUMULATOR
434. MOV A, R4 ; PUT DATA BYTE IN ACC
435. MOV C, ACC.4 ; LOAD HIGH NIBBLE ON DATA BUS
436. MOV LCD_DB4, C ; ONE BIT AT A TIME USING…
437. MOV C, ACC.5 ; BIT MOVE OPERATOINS
438. MOV LCD_DB5, C
439. MOV C, ACC.6
440. MOV LCD_DB6, C
441. MOV C, ACC.7
442. MOV LCD_DB7, C
443. SETB LCD_E ; PULSE THE ENABLE LINE
444. CLR LCD_E
445. MOV C, ACC.0 ; SIMILARLY, LOAD LOW NIBBLE
446. MOV LCD_DB4, C
447. MOV C, ACC.1
448. MOV LCD_DB5, C
449. MOV C, ACC.2
450. MOV LCD_DB6, C
451. MOV C, ACC.3
452. MOV LCD_DB7, C
453. CLR LCD_E
454. SETB LCD_E ; PULSE THE ENABLE LINE
455. CLR LCD_E
456. NOP
457. NOP
458. POP ACC
459. RET
460. ; **********************************************************
461. ; SUB TAKES THE STRING IMMEDIATELY FOLLOWING THE CALL AND
462. ; DISPLAYS ON THE LCD. STRING MUST BE TERMINATED WITH A
463. ; NULL (0).
464. ; **********************************************************
465. LCD_MSG:
a. CLR A ; Clear Index
b. MOVC A,@A+DPTR ; Get byte pointed by Dptr
c. INC DPTR ; Point to the next byte
d. JZ LCD_Msg9 ; Return if found the zero (end of stringz)
466. CJNE A,#001H,Lcd_Msg1 ; Check if is a Clear Command
a. MOV R4,A
b. CALL WRLCDCOM4 ;If yes, write it as command to LCD
c. JMP LCD_MSG ;Go get next byte from stringz
467. Lcd_Msg1: CJNE A,#0FFH,FLL ;Check for displaying full character
a. MOV R4,A
b. CALL WRLCDDATA
c. JMP LCD_MSG
468. FLL: CJNE A,#080h,$+3 ; Data or Address? If => 80h then is address.
a. JC Lcd_Msg_Data ; Carry will be set if A < 80h (Data)
b. MOV R4,A
c. CALL WRLCDCOM4 ; Carry not set if A=>80, it is address
d. JMP Lcd_Msg ; Go get next byte from stringz
469. Lcd_Msg_Data: ;
a. MOV R4,A
b. CALL WRLCDDATA ; It was data, write it to Lcd
c. JMP Lcd_Msg ; Go get next byte from stringz
470. Lcd_Msg9:
a. RET ; Return to Caller
471. ; **********************************************************
472. ; 1 MILLISECOND DELAY ROUTINE
473. ; **********************************************************
474. MDELAY:
475. PUSH ACC
476. MOV A,#0A6H
477. MD_OLP:
478. INC A
479. NOP
480. NOP
481. NOP
482. NOP
483. NOP
484. NOP
485. NOP
486. NOP
487. JNZ MD_OLP
488. NOP
489. POP ACC
490. RET
491. MADELAY:
492. PUSH ACC
493. MOV A,#036H
494. MAD_OLP:
495. INC A
496. NOP
497. NOP
498. NOP
499. NOP
500. NOP
501. NOP
502. NOP
503. NOP
504. JNZ MAD_OLP
505. NOP
506. POP ACC
507. RET
508. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
509. ; **********************************************************
510. ; SUB SETS THE DS1307 OSCILLATOR
511. ; **********************************************************
512. OSC_CONTROL:
513. ACALL SEND_START ; GENERATE START CONDITION
514. MOV A,#DS1307W ; 1101 0000 ADDRESS + WRITE-BIT
515. ACALL SEND_BYTE ; SEND BYTE TO 1307
516. MOV A,#00H ; ADDRESS BYTE TO REGISTER 00H
517. ACALL SEND_BYTE ; SECONDS REGISTER, ALWAYS LEAVE
518. SETB LASTREAD ; REG 00H-BIT #7 = 0 (LOW)
519. ACALL SEND_STOP ; IF REG 00H-BIT #7 = 1 CLOCK
520. ACALL SEND_START ; OSCILLATOR IS OFF.
521. MOV A,#DS1307R ; 1101 0001 ADDRESS + READ-BIT
522. ACALL SEND_BYTE ;
523. ACALL READ_BYTE ; READ A BYTE FROM THE 1307
524. CLR ACC.7 ; CLEAR REG 00H-BIT #7 TO ENABLE
525. OSC_SET: ; OSCILLATOR.
526. PUSH ACC ; SAVE ON STACK
527. ACALL SEND_STOP ;
528. ACALL SEND_START ;
529. MOV A,#DS1307W ; SETUP TO WRITE
530. ACALL SEND_BYTE ;
531. MOV A,#00H ; REGISTER 00H ADDRESS
532. ACALL SEND_BYTE ;
533. POP ACC ; GET DATA TO START OSCILLATOR
534. ACALL SEND_BYTE ; SEND IT
535. ACALL SEND_STOP
536. RET
537. ; **********************************************************
538. ; THIS SUB CONTROLS THE SQW OUTPUT 1HZ
539. ; **********************************************************
540. SQW_CONTROL_1HZ:
a. LCALL SEND_START ; SEND START CONDITION
b. MOV A,#DS1307W ; SET POINTER TO REG 07H ON
a. ; DS1307
c. LCALL SEND_BYTE
d. MOV A,#07H
e. LCALL SEND_BYTE
f. MOV A,#90H ; SQW/OUT ON AT 1HZ
g. JNB SQW,SQW_SET ; JUMP IF SQW BIT IS ACTIVE
h. MOV A,#80H ; TURN SQW/OUT OFF – OFF HIGH
541. SQW_SET:
a. LCALL SEND_BYTE
b. LCALL SEND_STOP
c. RET
d. ; **********************************************************
542. ; THIS SUB READS ONE BYTE OF DATA FROM THE DS1307
543. ; **********************************************************
544. READ_BYTE:
545. MOV BITCNT,#08H; SET COUNTER FOR 8-BITS DATA
546. MOV A,#00H
547. SETB SDA ; SET SDA HIGH TO ENSURE LINE
i. ; FREE
548. READ_BITS:
549. SCL_HIGH ; TRANSITION SCL LOW-TO-HIGH
550. MOV C,SDA ; MOVE DATA BIT INTO CARRY
551. RLC A ; ROTATE CARRY-BIT INTO ACC.0
552. CLR SCL ; TRANSITION SCL HIGH-TO-LOW
553. DJNZ BITCNT,READ_BITS
i. ; LOOP FOR 8-BITS
554. JB LASTREAD,ACKN
i. ; CHECK TO SEE IF THIS IS
ii. ; THE LAST READ
555. CLR SDA ; IF NOT LAST READ SEND ACK-BIT
556. ACKN:
557. SCL_HIGH ; PULSE SCL TO TRANSMIT ACKNOWLEDGE
558. CLR SCL ; OR NOT ACKNOWLEDGE BIT
559. RET
560. ; **********************************************************
561. ; SUB SENDS START CONDITION
562. ; **********************************************************
563. SEND_START:
564. SETB _2W_BUSY ; INDICATE THAT 2-WIRE
565. CLR ACKS ; OPERATION IS IN PROGRESS
566. CLR BUS_FLT ; CLEAR STATUS FLAGS
567. JNB SCL,FAULT
568. JNB SDA,FAULT
569. SETB SDA ; BEGIN START CODITION
570. SCL_HIGH
571. CLR SDA
572. ACALL DEELAY
573. CLR SCL
574. RET
575. FAULT:
576. SETB BUS_FLT
577. RET
578. ; **********************************************************
579. ; SUB SENDS STOP CONDITION
580. ; **********************************************************
581. SEND_STOP:
582. CLR SDA
583. SCL_HIGH
584. SETB SDA
585. CLR _2W_BUSY
586. RET
587. ; **********************************************************
588. ; SUB DELAYS THE BUS
589. ; **********************************************************
590. DEELAY:
591. NOP ; DELAY FOR BUS TIMING
592. RET
593. ; **********************************************************
594. ; THIS SUB SENDS 1 BYTE OF DATA TO THE DS1307
595. ; CALL THIS FOR EACH REGISTER SECONDS TO YEAR
596. ; ACC MUST CONTAIN DATA TO BE SENT TO CLOCK
597. ; **********************************************************
598. SEND_BYTE:
599. MOV BITCNT,#08H; SET COUNTER FOR 8-BITS
600. SB_LOOP:
601. JNB ACC.7,NOTONE; CHECK TO SEE IF BIT-7 OF
602. SETB SDA ; ACC IS A 1, AND SET SDA HIGH
603. JMP ONE
604. NOTONE:
605. CLR SDA ; CLR SDA LOW
606. ONE:
607. SCL_HIGH ; TRANSITION SCL LOW-TO-HIGH
608. RL A ; ROTATE ACC LEFT 1-BIT
609. CLR SCL ; TRANSITION SCL LOW-TO-HIGH
610. DJNZ BITCNT,SB_LOOP; LOOP FOR 8-BITS
611. SETB SDA ; SET SDA HIGH TO LOOK FOR
612. SCL_HIGH ; ACKNOWLEDGE PULSE
613. CLR ACKS
614. JNB SDA,SB_EX ; CHECK FOR ACK OR NOT ACK
615. SETB ACKS ; SET ACKNOWLEDGE FLAG FOR
i. ; NOT ACK
616. SB_EX:
617. CALL DEELAY ; DELAY FOR AN OPERATION
618. CLR SCL ; TRANSITION SCL HIGH-TO-LOW
619. CALL DEELAY ; DELAY FOR AN OPERATION
620. RET
621. ; **********************************************************
622. ; SUB READS THE CLOCK AND WRITES IT TO THE SCRATCHPAD MEMORY
623. ; ON RETURN FROM HERE DATE & TIME DATA WILL BE STORED IN THE
624. ; DATE & TIME REGISTERS FROM 24H (SECS) TO 2AH (YEAR)
625. ; ALARM SETTINGS IN REGISTERS 2CH(HRS) AND 2DH(MINUTES).
626. ; **********************************************************
627. READ_CLOCK:
628. MOV R1,#SECS ; SECONDS STORAGE LOCATION
629. MOV BYTECNT,#00H
630. CLR LASTREAD
631. CALL SEND_START
632. MOV A,#DS1307W
633. CALL SEND_BYTE
634. MOV A,#00H
635. CALL SEND_BYTE
636. CALL SEND_STOP
637. CALL SEND_START
638. MOV A,#DS1307R
639. CALL SEND_BYTE
640. READ_LOOP:
641. MOV A,BYTECNT
642. CJNE A,#09H,NOT_LAST
643. SETB LASTREAD
644. NOT_LAST:
645. CALL READ_BYTE
646. MOV @R1,A
647. MOV A,BYTECNT
648. CJNE A,#00H,NOT_FIRST
649. MOV A,@R1
650. CLR ACC.7 ; ENSURE OSC BIT=0 (ENABLED)
651. MOV @R1,A
652. NOT_FIRST:
653. INC R1
654. INC BYTECNT
655. MOV A,BYTECNT
656. CJNE A,#0AH,READ_LOOP
657. CALL SEND_STOP
658. RET
659. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
660. ; DISPLAY CLOCK ON LCD
661. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
662. RTCLOCK:
i. CALL READ_CLOCK
663. MOV R4,#01H
664. CALL WRLCDCOM4
665. CALL MDELAY
666. MOV R4,#81H
667. CALL WRLCDCOM4
668. CALL MDELAY
669. MOV R3,DATE1
670. CALL SPLIT_DATA
671. MOV R4,#’-‘
672. CALL WRLCDDATA
673. CALL MDELAY
674. MOV R3,MONTH
675. CALL SPLIT_DATA
676. MOV R4,#’-‘
677. CALL WRLCDDATA
678. CALL MDELAY
679. MOV R4,#’2′
680. CALL WRLCDDATA
681. CALL MDELAY
682. MOV R4,#’0′
683. CALL WRLCDDATA
684. CALL MDELAY
685. MOV R3,YEAR
686. CALL SPLIT_DATA
687. MOV A,DAY
688. CJNE A,#01H,TGY1
689. CALL SUN
690. JMP TGY
691. TGY1: CJNE A,#02H,TGY2
692. CALL MON
693. JMP TGY
694. TGY2: CJNE A,#03H,TGY3
695. CALL TUE
696. JMP TGY
697. TGY3: CJNE A,#04H,TGY4
698. CALL WED
699. JMP TGY
700. TGY4: CJNE A,#05H,TGY5
701. CALL THU
702. JMP TGY
703. TGY5: CJNE A,#06H,TGY6
704. CALL FRI
705. JMP TGY
706. TGY6: CJNE A,#07H,TGY
707. CALL SAT
708. JMP TGY
709. TGY: MOV R4,#0C3H
710. CALL WRLCDCOM4
711. CALL MDELAY
712. MOV A,HRS
713. JNB ACC.5,DCF3
714. CLR AM
715. AJMP DCF2
716. DCF3: SETB AM
717. DCF2: ANL A,#00011111B
i. MOV R3,A
718. CALL SPLIT_DATA
719. MOV R4,#’:’
720. CALL WRLCDDATA
721. CALL MDELAY
722. MOV R3,MINS
723. CALL SPLIT_DATA
724. MOV R4,#’:’
725. CALL WRLCDDATA
726. CALL MDELAY
727. MOV R3,SECS
728. CALL SPLIT_DATA
729. MOV R4,#’ ‘
730. CALL WRLCDDATA
731. CALL MDELAY
732. JNB AM,DCF0
733. MOV R4,#’A’
734. CALL WRLCDDATA
735. CALL MDELAY
736. JMP DCF4
737. DCF0: MOV R4,#’P’
738. CALL WRLCDDATA
739. CALL MDELAY
740. DCF4: MOV R4,#’M’
741. CALL WRLCDDATA
742. CALL MDELAY
743. RET
744. ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
745. SPLIT_DATA:
1. MOV A,R3
2. ANL A,#0F0H
3. SWAP A
4. ADD A,#30H
5. MOV R4,A
6. CALL WRLCDDATA
7. CALL MDELAY
8. MOV A,R3
9. ANL A,#0FH
10. ADD A,#30H
11. MOV R4,A
12. CALL WRLCDDATA
13. CALL MDELAY
14. RET
746. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
747. SUN:
a. MOV DPTR,#MAG1
b. CALL LCD_MSG
c. RET
748. MAG1:
a. DB ‘ SUN’,00H
749. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
750. MON:
a. MOV DPTR,#MAG2
b. CALL LCD_MSG
c. RET
751. MAG2:
a. DB ‘ MON’,00H
752. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
753. TUE:
a. MOV DPTR,#MAG3
b. CALL LCD_MSG
c. RET
754. MAG3:
a. DB ‘ TUE’,00H
755. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
756. WED:
a. MOV DPTR,#MAG4
b. CALL LCD_MSG
c. RET
757. MAG4:
a. DB ‘ WED’,00H
758. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
759. THU:
a. MOV DPTR,#MAG5
b. CALL LCD_MSG
c. RET
760. MAG5:
a. DB ‘ THU’,00H
761. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
762. FRI:
a. MOV DPTR,#MAG6
b. CALL LCD_MSG
c. RET
763. MAG6:
a. DB ‘ FRI’,00H
764. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
765. SAT:
a. MOV DPTR,#MAG7
b. CALL LCD_MSG
c. RET
766. MAG7:
a. DB ‘ SAT’,00H
767. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
768. ;***********************************************************************
769. ; THIS ROUTINE SENDS OUT CONTENTS OF THE ACCUMULATOR
770. ; to the EEPROM and includes START condition. Refer to the data sheets
771. ; for discussion of START and STOP conditions.
772. ;***********************************************************************
773. OUTS: MOV R2,#8 ;LOOP COUNT — EQUAL TO BIT COUNT
774. SETB SDA1 ;INSURE DATA IS HI
775. SETB SCL1 ;INSURE CLOCK IS HI
776. NOP ;NOTE 1
777. NOP
778. NOP
779. CLR SDA1 ;START CONDITION — DATA = 0
780. NOP ;NOTE 1
781. NOP
782. NOP
783. CLR SCL1 ;CLOCK = 0
784. OTSLP: RLC A ;SHIFT BIT
785. JNC BITLS
786. SETB SDA1 ;DATA = 1
787. JMP OTSL1 ;CONTINUE
788. BITLS: CLR SDA1 ;DATA = 0
789. OTSL1: SETB SCL1 ;CLOCK HI
790. NOP ;NOTE 1
791. NOP
792. NOP
793. CLR SCL1 ;CLOCK LOW
794. DJNZ R2,OTSLP ;DECREMENT COUNTER
795. SETB SDA1 ;TURN PIN INTO INPUT
796. NOP ;NOTE 1
797. SETB SCL1 ;CLOCK ACK
798. NOP ;NOTE 1
799. NOP
800. NOP
801. CLR SCL1
802. RET
803. ;**********************************************************************
804. ; THIS ROUTINE SENDS OUT CONTENTS OF ACCUMLATOR TO EEPROM
805. ; without sending a START condition.
806. ;**********************************************************************
807. OUT: MOV R2,#8 ;LOOP COUNT — EQUAL TO BIT COUNT
808. OTLP: RLC A ;SHIFT BIT
809. JNC BITL
810. SETB SDA1 ;DATA = 1
811. JMP OTL1 ;CONTINUE
812. BITL: CLR SDA1 ;DATA = 0
813. OTL1: SETB SCL1 ;CLOCK HI
814. NOP ;NOTE 1
815. NOP
816. NOP
817. CLR SCL1 ;CLOCK LOW
818. DJNZ R2,OTLP ;DECREMENT COUNTER
819. SETB SDA1 ;TURN PIN INTO INPUT
820. NOP ;NOTE 1
821. SETB SCL1 ;CLOCK ACK
822. NOP ;NOTE 1
823. NOP
824. NOP
825. CLR SCL1
826. RET
827. STOP: CLR SDA1 ;STOP CONDITION SET DATA LOW
828. NOP ;NOTE 1
829. NOP
830. NOP
831. SETB SCL1 ;SET CLOCK HI
832. NOP ;NOTE 1
833. NOP
834. NOP
835. SETB SDA1 ;SET DATA HIGH
836. RET
837. ;*******************************************************************
838. ; THIS ROUTINE READS A BYTE OF DATA FROM EEPROM
839. ; From EEPROM current address pointer.
840. ; Returns the data byte in R1
841. ;*******************************************************************
842. CREAD: MOV A,#RDCMD ;LOAD READ COMMAND
843. CALL OUTS ;SEND IT
844. CALL IN ;READ DATA
845. MOV R1,A ;STORE DATA
846. CALL STOP ;SEND STOP CONDITION
847. RET
848. ;**********************************************************************
849. ; THIS ROUTINE READS IN A BYTE FROM THE EEPROM
850. ; and stores it in the accumulator
851. ;**********************************************************************
852. IN: MOV R2,#8 ;LOOP COUNT
853. SETB SDA1 ;SET DATA BIT HIGH FOR INPUT
854. INLP: CLR SCL1 ;CLOCK LOW
855. NOP ;NOTE 1
856. NOP
857. NOP
858. NOP
859. SETB SCL1 ;CLOCK HIGH
860. CLR C ;CLEAR CARRY
861. JNB SDA1,INL1 ;JUMP IF DATA = 0
862. CPL C ;SET CARRY IF DATA = 1
863. INL1: RLC A ;ROTATE DATA INTO ACCUMULATOR
864. DJNZ R2,INLP ;DECREMENT COUNTER
865. CLR SCL1 ;CLOCK LOW
866. RET
867. ;*********************************************************************
868. ; This routine test for WRITE DONE condition
869. ; by testing for an ACK.
870. ; This routine can be run as soon as a STOP condition
871. ; has been generated after the last data byte has been sent
872. ; to the EEPROM. The routine loops until an ACK is received from
873. ; the EEPROM. No ACK will be received until the EEPROM is done with
874. ; the write operation.
875. ;*********************************************************************
876. ACKTST: MOV A,#WTCMD ;LOAD WRITE COMMAND TO SEND ADDRESS
877. MOV R2,#8 ;LOOP COUNT — EQUAL TO BIT COUNT
878. CLR SDA1 ;START CONDITION — DATA = 0
879. NOP ;NOTE 1
880. NOP
881. NOP
882. CLR SCL1 ;CLOCK = 0
883. AKTLP: RLC A ;SHIFT BIT
884. JNC AKTLS
885. SETB SDA1 ;DATA = 1
886. JMP AKTL1 ;CONTINUE
887. AKTLS: CLR SDA1 ;DATA = 0
888. AKTL1: SETB SCL1 ;CLOCK HI
889. NOP ;NOTE 1
890. NOP
891. NOP
892. CLR SCL1 ;CLOCK LOW
893. DJNZ R2,AKTLP ;DECREMENT COUNTER
894. SETB SDA1 ;TURN PIN INTO INPUT
895. NOP ;NOTE 1
896. SETB SCL1 ;CLOCK ACK
897. NOP ;NOTE 1
898. NOP
899. NOP
900. JNB SDA1,EXIT ;EXIT IF ACK (WRITE DONE)
901. JMP ACKTST ;START OVER
902. EXIT: CLR SCL1 ;CLOCK LOW
903. CLR SDA1 ;DATA LOW
904. NOP ;NOTE 1
905. NOP
906. NOP
907. SETB SCL1 ;CLOCK HIGH
908. NOP
909. NOP
910. SETB SDA1 ;STOP CONDITION
911. RET
912. ;*********************************************************************
913. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
914. ; STORE ID IN EEPROM
915. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
916. STORE_EEPROM:
1. MOV A,#WTCMD ;LOAD WRITE COMMAND
2. CALL OUTS ;SEND IT
3. MOV A,R4 ;GET LOW BYTE ADDRESS
4. CALL OUT ;SEND IT
917. BTLP: MOV A,@R1 ;GET DATA
1. CALL OUT ;SEND IT
2. INC R1 ;INCREMENT DATA POINTER
3. DJNZ R6,BTLP ;LOOP TILL DONE
4. CALL STOP ;SEND STOP CONDITION
5. RET
918. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
919. ; READ DATAS FROM EEPROM
920. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
921. READ_EEPROM:
1. MOV A,#WTCMD ;LOAD WRITE COMMAND TO SEND ADDRESS
2. CALL OUTS ;SEND IT
3. MOV A,R4 ;GET LOW BYTE ADDRESS
4. CALL OUT ;SEND IT
5. MOV A,#RDCMD ;LOAD READ COMMAND
6. CALL OUTS ;SEND IT
922. BRDLP: CALL IN ;READ DATA
1. MOV @R1,a ;STORE DATA
2. INC R1 ;INCREMENT DATA POINTER
3. DJNZ R6,AKLP ;DECREMENT LOOP COUNTER
4. CALL STOP ;IF DONE, ISSUE STOP CONDITION
5. RET ;DONE, EXIT ROUTINE
923. AKLP: CLR SDA1 ;NOT DONE, ISSUE ACK
1. SETB SCL1
2. NOP ;NOTE 1
3. NOP
4. NOP
5. NOP ;NOTE 2
6. NOP
7. CLR SCL1
8. JMP BRDLP ;CONTINUE WITH READS
924. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
925. ; STORE TOTAL COUNT IN EEPROM
926. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
927. WRITE_TOTAL:
1. MOV A,#WTCMD ;LOAD WRITE COMMAND
b. CALL OUTS ;SEND IT
c. MOV A,#05H ;GET BYTE ADDRESS
d. CALL OUT ;SEND IT
e. MOV A,TOTAL ;GET DATA
f. CALL OUT ;SEND IT
g. CALL STOP ;SEND STOP CONDITION
h. CALL MDELAY
i. RET
928. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
929. ; READ TOTAL COUNT FROM EEPROM
930. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
931. READ_TOTAL:
1. MOV A,#WTCMD ;LOAD WRITE COMMAND TO SEND ADDRESS
b. CALL OUTS ;SEND IT
c. MOV A,#05H ;GET LOW BYTE ADDRESS
d. CALL OUT ;SEND IT
e. CALL CREAD ;GET DATA BYTE
f. MOV TOTAL,R1
g. CALL MDELAY
h. RET
932. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
933. ;
934. ; Keyboard Routines:
935. ;
936. ;*************************************
937. ; WaitKB: Wait for keypress
938. ;*************************************
939. WaitKB:
940. call Check_Keyb
941. jnc WaitKB
942. ret
943. ;*************************************
944. ; InitKeyb: c=1 if ACK OK
945. ;*************************************
946. CheckACK:
947. mov a, KB_STATS
948. mov c, acc.4
949. clr acc.4
950. mov KB_STATS, a
951. ret
952. ;*************************************
953. ; InitKeyb:
954. ;*************************************
955. InitKeyb:
956. mov KB_TEMP, #0
957. mov KB_OK, #0
958. mov r1, #0FFH
959. call Write_Keyb
960. call Check_Keyb
961. call CheckACK
962. jnc InitKeyb
963. mov r1, #0F4H ; Enable
964. call Write_Keyb
965. call Check_Keyb
966. call CheckACK
967. jnc KeybErr
968. mov r1, #0F3H ; Set Typematic
969. call Write_Keyb
970. call Check_Keyb
971. call CheckACK
972. jnc KeybErr
973. mov r1, #00H ; Typematic = 250 ms / 30 cps
974. call Write_Keyb
975. call Check_Keyb
976. call CheckACK
977. jnc KeybErr
978. mov KB_OK, #1
979. mov KB_STATS, #2 ; Num Lock ON
980. ;*************************************
981. ; Keyb_Leds: Set KB_STATS as leds
982. ;*************************************
983. Keyb_Leds:
984. mov r1, #0EDH ; Set Leds
985. call Write_Keyb
986. call Check_Keyb
987. call CheckACK
988. jnc KeybErr
989. mov r1, KB_STATS
990. call Write_Keyb
991. call Check_Keyb
992. call CheckACK
993. KeybErr:
994. ret
995. ;*************************************
996. ; Zero2One: Wait for 0 to 1 on kb
997. ; clock line, read the kb data line
998. ; and shift right the bit to acc.7
999. ;*************************************
1000. Zero2One:
1001. jnb KEYB_CLOCK, $
1002. jb KEYB_CLOCK, $
1003. mov c, KEYB_DATA
1004. rrc a
1005. ret
1006. ;*************************************
1007. ; Check_Keyb: Check to see if any key
1008. ; are pressed or release, returns
1009. ; ASCII codes on KB_DATA, or 1 for
1010. ; special keys, 2 for same special
1011. ; with shift. Return also the scan
1012. ; code on KB_SCAN.
1013. ; Special Keys are basicaly all non
1014. ; printable keys. See the table below
1015. ; all 1 and 2 returned are special keys
1016. ;*************************************
1017. Check_Keyb:
1018. setb KEYB_DATA
1019. setb KEYB_CLOCK ; CLOCK & DATA high = Idle Pos
1020. mov r0, #50
1021. CheckAgain:
1022. jnb KEYB_CLOCK, KeyHit
1023. djnz r0, CheckAgain ; check r0 times
1024. sjmp KeyEnd
1025. KeyHit:
1026. jnb KEYB_DATA, KeyHit2 ; Start bit must be 0
1027. KeyEnd:
1028. clr KEYB_CLOCK ; disable keyb
1029. clr c ; c=0 = no keypress
1030. ret
1031. KeyHit2:
1032. mov r0, #8 ; 8 bits
1033. clr a
1034. KeyHit3:
1035. call Zero2One
1036. djnz r0, KeyHit3
1037. mov r1, a
1038. clr a
1039. call Zero2One ; Parity bit
1040. call Zero2One ; Stop bit
1041. ; acc.7 = stop, acc.6 = parity
1042. clr KEYB_CLOCK
1043. mov a, KB_TEMP
1044. jz NoIgnore
1045. dec KB_TEMP ; Igonre pause scans
1046. sjmp ChkKbEndNC
1047. NoIgnore:
1048. mov KB_SCAN, r1
1049. cjne r1, #0FAH, NoKbACK
1050. orl KB_STATS, #ACK
1051. sjmp ChkKbEndNC
1052. NoKbACK:
1053. cjne r1, #KB_PAUSE, NoKbPause
1054. mov KB_TEMP, #7 ; Ignore next 7 scans
1055. mov a, KB_OK
1056. cpl acc.6
1057. mov KB_OK, a
1058. sjmp ChkKbEndNC
1059. NoKbPause:
1060. cjne r1, #KB_EXT, NoKbExt
1061. orl KB_OK, #EXTENDED
1062. sjmp ChkKbEndNC
1063. NoKbExt:
1064. cjne r1, #KB_REL, NoRelease
1065. orl KB_STATS, #RELEASE
1066. sjmp ChkKbEndNC
1067. NoRelease:
1068. ; Test Num lock, if pressed toggle led
1069. cjne r1, #KB_NUML, NoNumLock
1070. mov a, KB_STATS
1071. jnb acc.7, ChkKbEndNC
1072. cpl acc.1
1073. clr acc.7
1074. mov KB_STATS, a
1075. call Keyb_Leds
1076. sjmp ChkKbEndNC
1077. NoNumLock:
1078. ; Test Caps lock, if pressed toggle led
1079. cjne r1, #KB_CAPS, NoCapsLock
1080. mov a, KB_STATS
1081. jnb acc.7, ChkKbEndNC
1082. cpl acc.2
1083. clr acc.7
1084. mov KB_STATS, a
1085. call Keyb_Leds
1086. sjmp ChkKbEndNC
1087. NoCapsLock:
1088. ; Test Scroll lock, if pressed toggle led
1089. cjne r1, #KB_SCROLL, NoScrollLock
1090. mov a, KB_STATS
1091. jnb acc.7, ChkKbEndNC
1092. cpl acc.0
1093. clr acc.7
1094. mov KB_STATS, a
1095. call Keyb_Leds
1096. ChkKbEndNC:
1097. clr c
1098. ret
1099. NoScrollLock:
1100. ; Test L & R shifts, set bit if pressed, clear on release
1101. cjne r1, #KB_LSHIFT, NoShift1
1102. ShiftOK:
1103. mov a, KB_STATS
1104. jbc acc.7, ShiftRel
1105. setb acc.3 ; not releasing, so Set SHIFT bit
1106. sjmp ShiftEnd
1107. ShiftRel:
1108. clr acc.3 ; releasing, so Clear SHIFT bit
1109. ShiftEnd:
1110. mov KB_STATS, a
1111. sjmp ChkKbEndNC
1112. NoShift1:
1113. cjne r1, #KB_RSHIFT, NoShift
1114. sjmp ShiftOK
1115. NoShift:
1116. cjne r1, #KB_CTRL, NoCtrl
1117. mov a, KB_STATS
1118. jbc acc.7, CtrlRel
1119. setb acc.5 ; not releasing, so Set CTRL bit
1120. sjmp CtrlEnd
1121. CtrlRel:
1122. clr acc.5 ; releasing, so Clear SHIFT bit
1123. CtrlEnd:
1124. mov KB_STATS, a
1125. sjmp ChkKbEndNC
1126. NoCtrl:
1127. cjne r1, #KB_ALT, NoAlt
1128. mov a, KB_STATS
1129. jbc acc.7, AltRel
1130. setb acc.6 ; not releasing, so Set ALT bit
1131. sjmp AltEnd
1132. AltRel:
1133. clr acc.6 ; releasing, so Clear ALT bit
1134. AltEnd:
1135. mov KB_STATS, a
1136. sjmp ChkKbEndNC
1137. NoAlt:
1138. mov a, KB_STATS ; Releasing key test
1139. jnb acc.7, NoRel2
1140. clr acc.7 ; if releasing > clear
1141. mov KB_STATS, a ; rel bit on KB_STATS
1142. clr c ; and do nothing
1143. ret
1144. NoRel2:
1145. mov a, KB_OK ; Extended key test
1146. jnb acc.7, KbChars
1147. clr acc.7 ; if Extended > clear
1148. mov KB_OK, a ; EXT bit on KB_OK
1149. clr c ; and do nothing
1150. ret
1151. KbChars:mov dptr, #KbScanCodes
1152. mov a, KB_STATS
1153. jnb acc.2, TestShift
1154. jb acc.3, KbChkOK
1155. mov a, r1
1156. movc a, @a+dptr
1157. mov r0, a
1158. subb a, #97
1159. jc KbChkOK
1160. mov a, r0
1161. subb a, #123
1162. jnc KbChkOK
1163. mov dptr, #KbScanCodes2 ; if (a to z) & Caps > table 2
1164. sjmp KbChkOK
1165. TestShift:
1166. jnb acc.3, KbChkOK
1167. mov dptr, #KbScanCodes2 ; with shift table 2
1168. KbChkOK:
1169. mov a, r1
1170. movc a, @a+dptr
1171. mov KB_DATA, a
1172. setb c
1173. ret
1174. ;*************************************
1175. ; Zero2One2: Wait for high to low in
1176. ; kb clock line
1177. ;*************************************
1178. Zero2One2:
1179. jnb KEYB_CLOCK, $
1180. jb KEYB_CLOCK, $
1181. ret
1182. ;*************************************
1183. ; Write_Keyb: Send r1 to the kb
1184. ;*************************************
1185. Write_Keyb:
1186. mov r0, #8 ; 8 bits to receive
1187. clr KEYB_CLOCK ; break the Keyboard
1188. mov r7, #00H ; some delay (safety reasons)
1189. _WKwait:djnz r7, _WKwait
1190. clr KEYB_DATA ; request to send
1191. setb KEYB_CLOCK ; enable the Keyboard
1192. acall Zero2One2 ; Start Bit
1193. mov a, r1 ; Data Bits
1194. TxData:
1195. rrc a
1196. mov KEYB_DATA, c
1197. call Zero2One2
1198. djnz r0, TxData
1199. mov a, r1 ; calculate parity bit
1200. mov c, psw.0 ; this is Even parity
1201. cpl c ; and Keyboard needs Odd parity
1202. mov KEYB_DATA, c ; send parity bit
1203. call Zero2One2
1204. setb KEYB_DATA ; send stop bit
1205. call Zero2One2
1206. call Zero2One2
1207. mov c, KEYB_DATA ; get ACK bit
1208. clr KEYB_CLOCK ; stop the keyboard
1209. ret
1210. LAOP:
1211. LOAPA: INC TEMP
1. MOV R1,TEMP
2. CJNE R1,#01H,IOP1 ;GET DATE
ii. CALL DATE_DISP
iii. CALL LOOPS
iv. MOV A,KB_DATA
v. CLR C
vi. SUBB A,#30H
vii. SWAP A
viii. MOV DATE1,A
1212. CALL LOOPS
i. MOV A,KB_DATA
ii. CLR C
iii. SUBB A,#30H
iv. ORL A,DATE1
v. MOV DATE1,A
1213. CALL DELAY
i. AJMP LAOP
1214. IOP1: CJNE R1,#02H,IOP2 ;GET MONTH
i. CALL MON_DISP
ii. CALL LOOPS
iii. MOV A,KB_DATA
iv. CLR C
v. SUBB A,#30H
vi. SWAP A
vii. MOV MONTH,A
1215. CALL LOOPS
i. MOV A,KB_DATA
ii. CLR C
iii. SUBB A,#30H
iv. ORL A,MONTH
v. MOV MONTH,A
vi. CALL DELAY
vii. AJMP LAOP
1216. IOP2: CJNE R1,#03H,IOP3 ;GET YEAR
i. CALL YR_DISP
ii. CALL LOOPS
iii. MOV A,KB_DATA
iv. CLR C
v. SUBB A,#30H
vi. SWAP A
vii. MOV YEAR,A
1217. CALL LOOPS
i. MOV A,KB_DATA
ii. CLR C
iii. SUBB A,#30H
iv. ORL A,YEAR
v. MOV YEAR,A
vi. CALL DELAY
vii. AJMP LAOP
1218. IOP3: CJNE R1,#04H,IOP4 ;GET DAY
i. CALL DAY_DISP
ii. CALL LOOPS
iii. MOV A,KB_DATA
iv. CLR C
v. SUBB A,#30H
vi. MOV DAY,A
vii. CALL DELAY
viii. AJMP LAOP
1219. IOP4: CJNE R1,#05H,IOP5 ;GET HOUR
i. CALL HR_DISP
ii. CALL LOOPS
iii. MOV A,KB_DATA
iv. CLR C
v. SUBB A,#30H
vi. SWAP A
vii. MOV HRS,A
1220. CALL LOOPS
i. MOV A,KB_DATA
ii. CLR C
iii. SUBB A,#30H
iv. ORL A,HRS
v. MOV HRS,A
vi. CALL DELAY
vii. AJMP LAOP
1221. IOP5: CJNE R1,#06H,IOP6 ;GET MIN
i. CALL MIN_DISP
ii. CALL LOOPS
iii. MOV A,KB_DATA
iv. CLR C
v. SUBB A,#30H
vi. SWAP A
vii. MOV MINS,A
viii. MOV R4,KB_DATA
1222. CALL WRLCDDATA
1223. CALL LOOPS
i. MOV A,KB_DATA
ii. CLR C
iii. SUBB A,#30H
iv. ORL A,MINS
v. MOV MINS,A
vi. CALL DELAY
vii. AJMP LAOP
1224. IOP6: CJNE R1,#07H,STORE_RTC ;GET AM/PM
i. CALL AMS_DISP
ii. CALL LOOPS
iii. MOV A,KB_DATA
iv. CLR C
v. SUBB A,#30H
vi. CJNE A,#00H,GBBN1
vii. SETB AMS
viii. CALL AM_DISP
ix. AJMP GBBN2
1225. GBBN1: CLR AMS
1. CALL PM_DISP
1226. GBBN2: CALL DELAY
1. AJMP LAOP
1227. LOOPS: CALL Check_Keyb
a. JNC LOOPS
b. MOV R4,KB_DATA
1228. CALL WRLCDDATA
a. RET
1229. ;(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
1230. ; STORE THE TIME TO RTC CHIP
1231. ;(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
1232. STORE_RTC:
a. LCALL SEND_START ; SEND 2WIRE START CONDITION
b. MOV A,#DS1307W ; LOAD DS1307 WRITE COMMAND
c. LCALL SEND_BYTE ; SEND WRITE COMMAND
d. MOV A,#08H ; SET DS1307 DATA POINTER TO BEGINNING
e. LCALL SEND_BYTE ; OF USER RAM 08H
f. MOV A,#0AAH ; WRITE BYTE TO ENTIRE RAM SPACE
g. LCALL SEND_BYTE
h. LCALL SEND_STOP ; SEND 2WIRE STOP CONTION
i. LCALL SEND_START ; SEND 2WIRE START CONDITION
j. MOV A,#DS1307W ; LOAD DS1307 WRITE COMMAND
k. LCALL SEND_BYTE ; SEND WRITE COMMAND
l. MOV A,#01H ; SET DS1307 DATA POINTER TO BEGINNING
m. LCALL SEND_BYTE ; OF 00H
n. MOV A,MINS ; Send min
o. LCALL SEND_BYTE
p. MOV A,HRS ;send hr
q. SETB ACC.6 ;12 HR MODE
r. JNB AMS,YUH
s. CLR ACC.5 ;AM/PM 1=PM,0=AM
t. AJMP YUH1
1233. YUH: SETB ACC.5
1234. YUH1: LCALL SEND_BYTE
a. MOV A,DAY ; Send Day
b. LCALL SEND_BYTE
c. MOV A,DATE1 ; Send date
d. LCALL SEND_BYTE
e. MOV A,MONTH ; Send month
f. LCALL SEND_BYTE
g. MOV A,YEAR ; Send yr
h. LCALL SEND_BYTE
i. LCALL SEND_STOP ; SEND 2WIRE STOP CONTION
j. RET
1235. ;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1236. DISP_NAME:
1. MOV R4,NAMES
2. CJNE R4,#0FFH,FV1
3. RET
1237. FV1: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+1
3. CJNE R4,#0FFH,FV2
4. RET
1238. FV2: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+2
3. CJNE R4,#0FFH,FV3
4. RET
1239. FV3: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+3
3. CJNE R4,#0FFH,FV4
4. RET
1240. FV4: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+4
3. CJNE R4,#0FFH,FV5
4. RET
1241. FV5: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+5
3. CJNE R4,#0FFH,FV6
4. RET
1242. FV6: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+6
3. CJNE R4,#0FFH,FV7
4. RET
1243. FV7: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+7
3. CJNE R4,#0FFH,FV8
4. RET
1244. FV8: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+8
3. CJNE R4,#0FFH,FV9
4. RET
1245. FV9: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+9
3. CJNE R4,#0FFH,FV10
4. RET
1246. FV10: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+10
3. CJNE R4,#0FFH,FV11
4. RET
1247. FV11: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+11
3. CJNE R4,#0FFH,FV12
4. RET
1248. FV12: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+12
3. CJNE R4,#0FFH,FV13
4. RET
1249. FV13: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+13
3. CJNE R4,#0FFH,FV14
4. RET
1250. FV14: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+14
3. CJNE R4,#0FFH,FV15
4. RET
1251. FV15: CALL WRLCDDATA
1. CALL MDELAY
2. MOV R4,NAMES+15
3. CJNE R4,#0FFH,FV16
4. RET
1252. FV16:
1. CALL WRLCDDATA
2. CALL MDELAY
3. RET
1253. ;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1254. ;
1255. ;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1256. CLEAR_RAM:
i. MOV NAMES,#0FFH
ii. MOV NAMES+1,#0FFH
iii. MOV NAMES+2,#0FFH
iv. MOV NAMES+3,#0FFH
v. MOV NAMES+4,#0FFH
vi. MOV NAMES+5,#0FFH
vii. MOV NAMES+6,#0FFH
viii. MOV NAMES+7,#0FFH
ix. MOV NAMES+8,#0FFH
x. MOV NAMES+9,#0FFH
xi. MOV NAMES+10,#0FFH
xii. MOV NAMES+11,#0FFH
xiii. MOV NAMES+12,#0FFH
xiv. MOV NAMES+13,#0FFH
xv. MOV NAMES+14,#0FFH
xvi. MOV NAMES+15,#0FFH
xvii. RET
1257. ;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1258. DELETE_PGM:
1. CALL READ_TOTAL
2. MOV TEMPS,TOTAL
3. SETB UP
4. SETB DOWN
5. SETB CANCEL
6. SETB ENTER
7. MOV R5,TEMPS
8. CJNE R5,#00H,EDT0
9. CALL NO_CARD
10. CALL DELAYS
11. JMP REP1
1259. EDT0: MOV R5,TEMPS
1. CJNE R5,#01H,EDT1
2. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
3. MOV R4,#30H ;MASTER ADDRESS
4. MOV R6,#16 ;NUMBER OF BYTES
5. AJMP EDIT
1260. EDT1: CJNE R5,#02H,EDT2
1. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
2. MOV R4,#50H ;MASTER ADDRESS
3. MOV R6,#16 ;NUMBER OF BYTES
4. AJMP EDIT
1261. EDT2: CJNE R5,#03H,EDT3
1. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
2. MOV R4,#70H ;MASTER ADDRESS
3. MOV R6,#16 ;NUMBER OF BYTES
4. AJMP EDIT
1262. EDT3: CJNE R5,#04H,EDT4
1. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
2. MOV R4,#90H ;MASTER ADDRESS
3. MOV R6,#16 ;NUMBER OF BYTES
4. AJMP EDIT
1263. EDT4: CJNE R5,#05H,EDT5
1. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
2. MOV R4,#0B0H ;MASTER ADDRESS
3. MOV R6,#16 ;NUMBER OF BYTES
4. AJMP EDIT
1264. EDT5: CJNE R5,#06H,EDT6
1. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
2. MOV R4,#0D0H ;MASTER ADDRESS
3. MOV R6,#16 ;NUMBER OF BYTES
4. AJMP EDIT
1265. EDT6: CJNE R5,#07H,EDIT
1. MOV R1,#NAMES ;GET DATA IN BYTES(RAM)
2. MOV R4,#0F0H ;MASTER ADDRESS
3. MOV R6,#16 ;NUMBER OF BYTES
4. AJMP EDIT
1266. EDIT: CALL READ_EEPROM
1. CALL DISPLAY5
2. CALL DISP_NAME
1267. EDIT7: JNB UP,GBN2
1. JNB CANCEL,VFR3
2. JNB DOWN,GBN1
3. JNB ENTER,EDIT_NAME
4. AJMP EDIT7
1268. VFR3: CALL DELAY
1. JNB CANCEL,$
2. JMP REP1
1269. GBN2: JNB UP,$
1. MOV A,TEMPS
2. CJNE A,#01H,VFR2
3. MOV TEMPS,TOTAL
4. JMP EDT0
1270. VFR2: DEC TEMPS
1. JMP EDT0
1271. GBN1: JNB DOWN,$
1. MOV A,TEMPS
2. XRL A,TOTAL
3. JNZ VFR1
4. MOV TEMPS,#01H
5. JMP EDT0
1272. VFR1: INC TEMPS
1. JMP EDT0
1273. KBNotOKAS2: JMP KBNotOKAS
1274. EDIT_NAME: JNB ENTER,$
i. AJMP EDIT_NAM
1275. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1276. EDIT_NAM:
1. JB KEYBRD,LAOP1
1277. FDAC4: CALL InitKeyb ;Inizialize Keyboard
a. MOV a, KB_OK
b. JZ KBNotOKAS2
c. SETB KEYBRD
1278. LAOP1: CALL DISPLAY4 ;plz enter NEW name
1. MOV TEMP,#00H
2. CALL CLEAR_RAM
1279. EADC: CALL LOOPZ
a. INC TEMP
b. MOV R2,TEMP
c. CJNE R2,#01H,EADC1
d. MOV R1,#NAMES
e. MOV @R1,KB_DATA
1280. EADC1: CJNE R2,#02H,EADC2
a. MOV R1,#NAMES+1
b. MOV @R1,KB_DATA
1281. EADC2: CJNE R2,#03H,EADC3
a. MOV R1,#NAMES+2
b. MOV @R1,KB_DATA
1282. EADC3: CJNE R2,#04H,EADC4
a. MOV R1,#NAMES+3
b. MOV @R1,KB_DATA
1283. EADC4: CJNE R2,#05H,EADC5
a. MOV R1,#NAMES+4
b. MOV @R1,KB_DATA
1284. EADC5: CJNE R2,#06H,EADC6
a. MOV R1,#NAMES+5
b. MOV @R1,KB_DATA
1285. EADC6: CJNE R2,#07H,EADC7
a. MOV R1,#NAMES+6
b. MOV @R1,KB_DATA
1286. EADC7: CJNE R2,#08H,EADC8
a. MOV R1,#NAMES+7
b. MOV @R1,KB_DATA
1287. EADC8: CJNE R2,#09H,EADC9
a. MOV R1,#NAMES+8
b. MOV @R1,KB_DATA
1288. EADC9: CJNE R2,#10,EADC10
a. MOV R1,#NAMES+9
b. MOV @R1,KB_DATA
1289. EADC10: CJNE R2,#11,EADC11
a. MOV R1,#NAMES+10
b. MOV @R1,KB_DATA
1290. EADC11: CJNE R2,#12,EADC12
a. MOV R1,#NAMES+11
b. MOV @R1,KB_DATA
1291. EADC12: CJNE R2,#13,EADC13
a. MOV R1,#NAMES+12
b. MOV @R1,KB_DATA
1292. EADC13: CJNE R2,#14,EADC14
a. MOV R1,#NAMES+13
b. MOV @R1,KB_DATA
1293. EADC14: CJNE R2,#15,EADC15
a. MOV R1,#NAMES+14
b. MOV @R1,KB_DATA
1294. EADC15: CJNE R2,#16,EADC16
a. MOV R1,#NAMES+15
b. MOV @R1,KB_DATA
1295. EADC16: CJNE R2,#17,EADC
a. CALL DELAYS
b. CALL PRESS_ENTER
c. SETB ENTER
d. SETB CANCEL
1296. HHJS: JNB CANCEL,LAOPZ1
a. JB ENTER,HHJS
b. MOV A,TEMPS
1. CJNE A,#01H,JANM1
2. MOV R1,#NAMES ;store Name
3. MOV R4,#30H ;Starting Address
4. MOV R6,#16 ;STORE 16 BYTES
5. CALL STORE_EEPROM
6. AJMP JANM
1297. LAOPZ1:
a. JMP LAOP1
1298. JANM1: CJNE A,#02H,JANM2
1. MOV R1,#NAMES ;store Name
2. MOV R4,#50H ;Starting Address
3. MOV R6,#16 ;STORE 16 BYTES
4. CALL STORE_EEPROM
5. AJMP JANM
1299. JANM2: CJNE A,#03H,JANM3
1. MOV R1,#NAMES ;store Name
2. MOV R4,#70H ;Starting Address
3. MOV R6,#16 ;STORE 16 BYTES
4. CALL STORE_EEPROM
5. AJMP JANM
1300. JANM3: CJNE A,#04H,JANM4
1. MOV R1,#NAMES ;store Name
2. MOV R4,#90H ;Starting Address
3. MOV R6,#16 ;STORE 16 BYTES
4. CALL STORE_EEPROM
5. AJMP JANM
1301. JANM4: CJNE A,#05H,JANM5
1. MOV R1,#NAMES ;store Name
2. MOV R4,#0B0H ;Starting Address
3. MOV R6,#16 ;STORE 16 BYTES
4. CALL STORE_EEPROM
5. AJMP JANM
1302. JANM5: CJNE A,#06H,JANM6
1. MOV R1,#NAMES ;store Name
2. MOV R4,#0D0H ;Starting Address
3. MOV R6,#16 ;STORE 16 BYTES
4. CALL STORE_EEPROM
5. AJMP JANM
1303. JANM6: CJNE A,#07H,JANM
1. MOV R1,#NAMES ;store Name
2. MOV R4,#0F0H ;Starting Address
3. MOV R6,#16 ;STORE 16 BYTES
4. CALL STORE_EEPROM
5. AJMP JANM
1304. JANM: CALL ID_SAVED ;Tag stored sucessfully
1. CALL DELAYS
2. JNB ENTER,$
3. JMP DELETE_PGM
1305. LoopZ: CALL Check_Keyb
1. JNB ENTER,GAHBH
2. JNB CANCEL,DCFAV1
b. JNC LoopZ
c. MOV R4,KB_DATA
1306. CALL WRLCDDATA
1307. RET
1308. GAHBH: JNB ENTER,$
1. MOV TEMP,#16
2. RET
1309. DCFAV1: JNB CANCEL,$
1. JMP DELETE_PGM
1310. KBNotOKAS:
1. CALL DISP1
2. JB ENTER,$
3. NOP
4. JNB ENTER,$
5. JMP FDAC4
1311. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1312. TRANSMIT_DATA:
1. MOV SBUF,#’@’
2. CALL MDELAY
3. MOV R3,DATE1
4. CALL SPLIT_DATAS
5. MOV R3,MONTH
6. CALL SPLIT_DATAS
7. MOV R3,YEAR
8. CALL SPLIT_DATAS
9. MOV R3,DAY
10. CALL SPLIT_DATAS
11. MOV A,HRS
12. ANL A,#00011111B
13. MOV R3,A
14. CALL SPLIT_DATAS
15. MOV R3,MINS
16. CALL SPLIT_DATAS
17. MOV R3,SECS
18. CALL SPLIT_DATAS
19. JNB AM,DFV2
20. MOV SBUF,#’A’
21. AJMP DFV1
1313. DFV2: MOV SBUF,#’P’
1314. DFV1: CALL MDELAY
1. MOV SBUF,#’#’
2. CALL MDELAY
3. MOV R3,NAMES
4. CALL MDELAYX
5. MOV R3,NAMES+1
6. CALL MDELAYX
7. MOV R3,NAMES+2
8. CALL MDELAYX
9. MOV R3,NAMES+3
10. CALL MDELAYX
11. MOV R3,NAMES+4
12. CALL MDELAYX
13. MOV R3,NAMES+5
14. CALL MDELAYX
15. MOV R3,NAMES+6
16. CALL MDELAYX
17. MOV R3,NAMES+7
18. CALL MDELAYX
19. MOV R3,NAMES+8
20. CALL MDELAYX
21. MOV R3,NAMES+9
22. CALL MDELAYX
23. MOV R3,NAMES+10
24. CALL MDELAYX
25. MOV R3,NAMES+11
26. CALL MDELAYX
27. MOV R3,NAMES+12
28. CALL MDELAYX
29. MOV R3,NAMES+13
30. CALL MDELAYX
31. MOV R3,NAMES+14
32. CALL MDELAYX
33. MOV R3,NAMES+15
34. CALL MDELAYX
35. MOV R3,#0CCH
36. CALL MDELAYX
37. MOV SBUF,#’$’
38. CALL MDELAY
39. RET
1315. SPLIT_DATAS:
1. MOV A,R3
2. ANL A,#0F0H
3. SWAP A
4. ADD A,#30H
5. MOV SBUF,A
6. CALL MDELAY
7. MOV A,R3
8. ANL A,#0FH
9. ADD A,#30H
10. MOV SBUF,A
11. CALL MDELAY
12. RET
1316. MDELAYX:
1. CJNE R3,#0FFH,WSE
2. RET
1317. WSE: MOV SBUF,R3
1. CALL MDELAY
2. RET
1318. ; last 262 addr of code mem with scan codes tables
1319. ;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1320. ; last 262 addr of code mem with scan codes tables
1321. org 1E00H
1322. KbScanCodes:
1323. ; Keyboard Scancodes
1324. ; ?, F9, ?, F5, F4, F1, F2, F12, ?, F10, F8, F6, F4, TAB, ~
1325. db 0, 1 , 0, 1 , 1 , 1 , 1 , 1 , 0, 1 , 1 , 1 , 1 , 1 , ‘~’
1326. ; ?, ?,Lalt,Lshf, ?,Lctr, Q , ! , ?, ?, ?, Z , S , A , W , @
1327. db 0, 0, 0 , 0 , 0, 0 , ‘q’, ‘1’, 0, 0, 0, ‘z’, ‘s’, ‘a’, ‘w’, ‘2’
1328. ; ?, ?, C , X , D , E , $ , # , ?, ?, ” “, V , F , T , R
1329. db 0, 0, ‘c’, ‘x’, ‘d’, ‘e’, ‘4’, ‘3’, 0, 0, ‘ ‘, ‘v’, ‘f’, ‘t’, ‘r’
1330. ; % , ?, ?, N , B , H , G , Y , ^ , ?, ?, ?, M , J , U , &
1331. db ‘5’, 0, 0, ‘n’, ‘b’, ‘h’, ‘g’, ‘y’, ‘6’, 0, 0, 0, ‘m’, ‘j’, ‘u’, ‘7’
1332. ; * , ?, ?, < , K , I , O , ) , ( , ?, ?, > , ? , L , : , P
1333. db ‘8’, 0, 0, ‘,’, ‘k’, ‘i’, ‘o’, ‘0’, ‘9’, 0, 0, ‘.’, ‘/’, ‘l’, ‘;’, ‘p’//ERROR rfid12.c(2629): error C305: unterminated string/char const
1334. ; _ , ?, ?, ?, ” , ?, { , + , ?, ?,Caps,Rshf,Entr, } , ?, |
1335. db ‘-‘, 0, 0, 0, 39 , 0, ”, 0, 92
1336. ; ?, ?, ?, ?, ?, ?, ?, ?,BkSp, ?, ?, 1 , ?, 4 , 7 , ?, ?, ?, 0
1337. db 0, 0, 0, 0, 0, 0, 0, 0, 1 , 0, 0, ‘1’, 0, ‘4’, ‘7’, 0, 0, 0, ‘0’
1338. ; . , 2 , 5 , 6 , 8 , ESC,Numl, F11, + , 3 , – , * , 9 ,Scrl
1339. db ‘.’, ‘2’, ‘5’, ‘6’, ‘8’, 1 , 0 , 1 , ‘+’, ‘3’, ‘-‘, ‘*’, ‘9’, 0
1340. ; ?, ?, ?, ?, F7
1341. db 0, 0, 0, 0, 1
1342. KbScanCodes2:
1343. ; Keyboard Scancodes with shift
1344. ; ?, F9, ?, F5, F4, F1, F2, F12, ?, F10, F8, F6, F4, TAB, ~
1345. db 0, 2 , 0, 2 , 2 , 2 , 2 , 2 , 0, 2 , 2 , 2 , 2 , 2 , ‘`’
1346. ; ?, ?,Lalt,Lshf, ?,Lctr, Q , ! , ?, ?, ?, Z , S , A , W , @
1347. db 0, 0, 0 , 0 , 0, 0 , ‘Q’, ‘!’, 0, 0, 0, ‘Z’, ‘S’, ‘A’, ‘W’, ‘@’
1348. ; ?, ?, C , X , D , E , $ , # , ?, ?, ” “, V , F , T , R
1349. db 0, 0, ‘C’, ‘X’, ‘D’, ‘E’, ‘$’, ‘#’, 0, 0, ‘ ‘, ‘V’, ‘F’, ‘T’, ‘R’
1350. ; % , ?, ?, N , B , H , G , Y , ^ , ?, ?, ?, M , J , U , &
1351. db ‘%’, 0, 0, ‘N’, ‘B’, ‘H’, ‘G’, ‘Y’, ‘^’, 0, 0, 0, ‘M’, ‘J’, ‘U’, ‘&’
1352. ; * , ?, ?, < , K , I , O , ) , ( , ?, ?, > , ? , L , : , P
1353. db ‘*’, 0, 0, ‘<‘, ‘K’, ‘I’, ‘O’, ‘)’, ‘(‘, 0, 0, ‘>’, ‘?’, ‘L’, ‘:’, ‘P’
1354. ; _ , ?, ?, ?, ” , ?, { , + , ?, ?,Caps,Rshf,Entr, } , ?, |
1355. db ‘_’, 0, 0, 0, ‘”‘, 0, ‘{‘, ‘+’, 0, 0, 0 , 0 , 2 , ‘}’, 0, ‘|’
1356. ; ?, ?, ?, ?, ?, ?, ?, ?,BkSp, ?, ?, 1 , ?, 4 , 7 , ?, ?, ?, 0
1357. db 0, 0, 0, 0, 0, 0, 0, 0, 2 , 0, 0, ‘1’, 0, ‘4’, ‘7’, 0, 0, 0, ‘0’
1358. ; . , 2 , 5 , 6 , 8 , ESC,Numl, F11, + , 3 , – , * , 9 ,Scrl
1359. db ‘.’, ‘2’, ‘5’, ‘6’, ‘8’, 2 , 0 , 2 , ‘+’, ‘3’, ‘-‘, ‘*’, ‘9’, 0
1360. ; ?, ?, ?, ?, F7
1361. db 0, 0, 0, 0, 2
1362. END
-
AuthorPosts
- You must be logged in to reply to this topic.