EC-316
MICROPROCESSORS LAB
8085 PROJECT
CHESS CLOCK
Submitted By:
1) Name: Gurpreet Singh Saluja
Roll No: 60/EC/13
2)Name: Gaurav Kashyap
Roll No: 57/EC/13
ACKNOWLEDGEMENT
We would like to express our immense gratitude to our guide, Prof. D.V. Gadre sir for his incomparable and immeasurable guidance throughout the course of this project titled as “CHESS CLOCK”.
We would also thank our parents and friends who have constantly supported us throughout the project.
INDEX
SR NO. / DESCRIPTION1. / PROJECT DESCRIPTION
2. / EXAMPLE
3. / FLOWCHART OF CODE
4. / CODE
5. / WORKING PROJECT PICTURES
6. / BOARD LAYOUT
7. / SCHEMATIC
8. / CONCLUSION
9. / BIBLIOGRAPHY
PROJECT DESCRIPTION
Let us consider two players A and B playing time bound chess game having initially 50 seconds in hand. The time which the other player takes to make a move gets added to their time in hand (the extra time after 1 round of moves gets added to the player’s time).
Chess clock will display a timer initially set at 50seconds. It will start decreasing for player A when the game starts. When player A finishes his move, he is required to press the provided button so that time for player A stops decreasing and time for player B start decreasing.
Now we are considering that if timer strikes 100 seconds, player B time is up and if timer strikes 0:00, player A time is up.
So, as soon as player A presses the button, the time in the timer will start increasing which in turn means time for player B starts decreasing. So, here the time taken by player A automatically gets added to the time in hand for player B and vice-versa.
Move / Time taken by player A / Time taken by player B / Net time profit wrt A / Timer display1 / 5 / 10 / 5 / 00:50 -> 00:45 [button pressed]
00:45 -> 00:55 [button pressed]
2 / 25 / 10 / -15 / 00:55 -> 00:30 [button pressed]
0:30->0:40 [button pressed]
Example
FLOW CHART OF CODE
CODE
.ORG 00000H
LXI SP,0FFFFH
MVI A,082H ;port A-o/p port B-i/p port C-o/p
OUT 083H ; 03H- Control Register
MVI A,00EH ; EN=0..PC7
OUT 00AH
MVI A,00CH ; R/W=0..PC6
OUT 00CH
MVI A,038H ;Function set
OUT 080H ;PORT A connected to lcd
CALL CMDDEL
MVI A,00FH ; display,cursor,blink-ON
OUT 080H
CALL CMDDEL
MVI A,006H ; Display shift to the right
OUT 080H
CALL CMDDEL
MVI A,001H ;Clear Display
OUT 080H
CALL CMDDEL
MVI A,043H ;C
OUT 080H
CALL DATA
MVI A,048H ;H
OUT 080H
CALL DATA
MVI A,045H ;E
OUT 080H
CALL DATA
MVI A,053H ;S
OUT 080H
CALL DATA
MVI A,053H ;S
OUT 080H
CALL DATA
MVI A,080H ;SPACE
OUT 080H
CALL DATA
MVI A,043H ;C
OUT 080H
CALL DATA
MVI A,04CH ;L
OUT 080H
CALL DATA
MVI A,04FH ;O
OUT 080H
CALL DATA
MVI A,043H ;C
OUT 080H
CALL DATA
MVI A,04BH ;K
OUT 080H
CALL DATA
X11:IN 81H
ANI 01H
CPI 01H
JNZ X11
X12:IN 81H
ANI 01H
CPI 00H
JNZ X12
MVI A,01H
OUT 080H
CALL CMDDEL
MVI D,32H ;50
MOV A,D
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,03AH
OUT 080H
CALL DATA
POP PSW
CALL CONV1
OUT 080H
CALL DATA
X1:MVI E,010H
X7:CALL DELAY100
PUSH PSW
MVI A,02H
OUT 82H
POP PSW
IN 81H
ANI 01H
CPI 01H
JZ X4
DCR E
JNZ X7
MVI A,01H
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,3AH
OUT 080H
CALL DATA
POP PSW
OUT 080H
CALL CMDDEL1
PUSH PSW
MVI A,02H
OUT 82H
POP PSW
DCR D
MOV A,D
CPI 00H
JZ END1
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,3AH
OUT 080H
CALL DATA
POP PSW
CALL CONV1
OUT 080H
CALL DATA
JMP X1
X2:HLT
X3:MVI E,010H
X8:CALL DELAY100
PUSH PSW
MVI A,01H
OUT 82H
POP PSW
IN 81H
ANI 02H
CPI 02H
JZ X5
DCR E
JNZ X8
MVI A,01H
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,3AH
OUT 080H
CALL DATA
POP PSW
OUT 080H
CALL CMDDEL2
PUSH PSW
MVI A,01H
OUT 82H
POP PSW
INR D
MOV A,D
CPI 64H
JZ END2
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,030H
OUT 080H
CALL DATA
POP PSW
PUSH PSW
MVI A,3AH
OUT 080H
CALL DATA
POP PSW
CALL CONV1
OUT 080H
CALL DATA
JMP X3
X4:CALL DELAY10
IN 81H
ANI 01H
CPI 00H
JNZ X4
PUSH PSW
MVI A,01H
OUT 82H
POP PSW
JMP X3
X5:CALL DELAY10
IN 81H
ANI 02H
CPI 00H
JNZ X5
PUSH PSW
MVI A,02H
OUT 82H
POP PSW
JMP X1
DATA:MVI A,0A0H ; EN=1 R/W=0 RS=1
OUT 082H ; PORT C
MVI A,080H ;EN=0 R/W=0 RS=1
OUT 082H
RET
CMDDEL:MVI A,020H ;EN=1 R/W=0 RS=0
OUT 082H ;PORT C
MVI A,000H ;EN=0 R/W=0 RS=0
OUT 082H
MVI B,0FFH ;1.8ms Delay
LOOPL:DCR B
JNZ LOOPL
RET
CMDDEL1:MVI A,020H ;EN=1 R/W=0 RS=0
OUT 082H ;PORT C
MVI A,000H ;EN=0 R/W=0 RS=0
OUT 082H
MVI B,0FFH ;1.8ms Delay
LOOPL1:DCR B
PUSH PSW
MVI A,02H
OUT 82H
POP PSW
JNZ LOOPL1
RET
CMDDEL2:MVI A,020H ;EN=1 R/W=0 RS=0
OUT 082H ;PORT C
MVI A,000H ;EN=0 R/W=0 RS=0
OUT 082H
MVI B,0FFH ;1.8ms Delay
LOOPL2:DCR B
PUSH PSW
MVI A,01H
OUT 82H
POP PSW
JNZ LOOPL2
RET
DELAY10: PUSH D
PUSH PSW
LXI D,002FFH ; gives about 13ms
LOOP22:DCX D
MOV A,E
ORA D
JNZ LOOP22
POP PSW
POP D
RET
DELAY100: PUSH D
PUSH PSW
LXI D,0170CH ; gives about 100ms
LOOP23:DCX D
MOV A,E
ORA D
JNZ LOOP23
POP PSW
POP D
RET
END2:MVI A,01H ; clear display
OUT 80H
CALL CMDDEL
MVI A,050H ; P
OUT 80H
CALL DATA
MVI A,031H ; 1
OUT 80H
CALL DATA
MVI A,020H ; " "
OUT 80H
CALL DATA
MVI A,057H ; W
OUT 80H
CALL DATA
MVI A,049H ; I
OUT 80H
CALL DATA
MVI A,04EH ; N
OUT 80H
CALL DATA
MVI A,053H ; S
OUT 80H
CALL DATA
HLT
; P2 wins
END1:MVI A,01H ; clear display
OUT 80H
CALL CMDDEL
MVI A,050H ; P
OUT 80H
CALL DATA
MVI A,032H ; 2
OUT 80H
CALL DATA
MVI A,020H ; " "
OUT 80H
CALL DATA
MVI A,057H ; W
OUT 80H
CALL DATA
MVI A,049H ; I
OUT 80H
CALL DATA
MVI A,04EH ; N
OUT 80H
CALL DATA
MVI A,053H ; S
OUT 80H
CALL DATA
HLT
CONV1:PUSH B
PUSH D; Binary to bcd converter ; for upper row
MVI C,00H
MVI D,00H
MVI B,0AH
LOOP30:CMP B
JC LESS1
SUB B
INR C
JMP LOOP30
LESS1: MOV B,A ; if less than 10, A holds BCD and if A > 10, A holds unit digit
MOV A,C ; if A < 10, C = 0 and if A > 10, C is quotient
ADI 030H ; generate ascii
MOV D,A
MOV A,D
OUT 80H
CALL DATA
MOV A,B
ADI 030H ; generate ascii
MOV D,A
MOV A,D
OUT 80H
CALL DATA
POP D
POP B
RET
SCHEMATIC
CONCLUSION
- The whole endeavor has been a great and fun learning experience.
- It gives us a better understanding to correlate theoretical concepts to real life implementation using microprocessor.
- We also experienced the importance of time management and team spirit.
- The project gave us a good knowledge of microprocessor, assembly language programming and PCB fabrication.
- The link of the video demonstrating our project is:
BIBLIOGRAPHY
- Microprocessor Architecture, Programming and Applications with the 8085 by Ramesh Gaonkar.
- Quick Start Guide by CEDT, NSIT for EEPROM Programmer.
- Intel IC datasheets