Description:
This number guessing game is quite simple. In this game the player thinks of any number between 1 and 99. Then he scans the eight groups of numbers given in the eight boxes in the table. Each group corresponds to a specific switch on an 8-way DIP switch. And the corresponding switch is switch on and the Number will be displayed in the seven segments Display.
The circuit comprises 8 push-to-on switch (S1-S8). Suppose you want to display 47. For this, 4 is to be displayed in tens position and 7 in units position. In order to generate 4 (binary 111) on the display , switches S6, S7, and S8 are to be turned on. The number 47 is placed in groups 6, 7, 8, and 2. So
when you spot 47 in these groups, switch on the same combination of switches. On depressing switch S9, 47 appears on the display. Other numbers can be generated using the same procedure.
Circuit Diagram
Flow Chart
Block Diagram
Program
0001 0000 PORTA EQU 0CH
0002 0000 PORTB EQU 0DH
0003 0000 REG EQU 0FH
0004 0000 .ORG 4100H
0005 4100
0006 4100 3E 94 MVI A,94H
0007 4102 D3 0F OUT REG
0008 4104 3E 01 MVI A,01H
0009 4106 0E 03 MVI C,03H
0010 4108 CD 05 00 CALL 0005 ;Clear Display
0011 410B 4F MOV C,A ;Generate Some Delay
0012 410C 06 02 MVI B,02H
0013 410E 11 0F 00 LOOP1: LXI D,0FH
0014 4111 1B LOOP: DCX D
0015 4112 7B MOV A,E
0016 4113 B2 ORA D
0017 4114 C2 11 41 JNZ LOOP
0018 4117 05 DCR B
0019 4118 C2 0E 41 JNZ LOOP1
0020 411B 4F MOV C,A
0021 411C 06 02 MVI B,02H
0022 411E 11 0F 00 LOOP2: LXI D,0FH
0023 4121 1B LOOP3: DCX D
0024 4122 7B MOV A,E
0025 4123 B2 ORA D
0026 4124 C2 21 41 JNZ LOOP3
0027 4127 05 DCR B
0028 4128 C2 1E 41 JNZ LOOP2
0029 412B DB 0C IN PORTA ;Read Switches
0030 412D 47 MOV B,A
0031 412E E6 0F ANI 0FH ;seperate first Digit
0032 4130 32 50 60 STA 6050H
0033 4133 78 MOV A,B
0034 4134 07 RLC
0035 4135 07 RLC
0036 4136 07 RLC
0037 4137 07 RLC
0038 4138 E6 0F ANI 0FH ;Seperate Second Digit
0039 413A 32 51 60 STA 6051H
0040 413D 21 50 60 LXI H,6050H
0041 4140 3E 03 MVI A,03H
0042 4142 0E 08 MVI C,08H
0043 4144 CD 05 00 CALL 0005H ;Display the Numbers on Data Field
0044 4147 4F MOV C,A ;Generate Some Delay
0045 4148 06 02 MVI B,02H
0046 414A 11 0F 00 LOOP4: LXI D,0FH
0047 414D 1B LOOP5: DCX D
0048 414E 7B MOV A,E
0049 414F B2 ORA D
0050 4150 C2 4D 41 JNZ LOOP5
0051 4153 05 DCR B
0052 4154 C2 4A 41 JNZ LOOP4
0053 4157 4F MOV C,A ;Generate Some Delay
0054 4158 06 02 MVI B,02H
0055 415A 11 0F 00 LOOP6: LXI D,0FH
0056 415D 1B LOOP7: DCX D
0057 415E 7B MOV A,E
0058 415F B2 ORA D
0059 4160 C2 5D 41 JNZ LOOP7
0060 4163 05 DCR B
0061 4164 C2 5A 41 JNZ LOOP6
0062 4167 76 HLT
0063 4168 .END
Number of errors = 0
Please check the Power supply pins & Port number before you connect the Hardware to the Trainer Kit
This number guessing game is quite simple. In this game the player thinks of any number between 1 and 99. Then he scans the eight groups of numbers given in the eight boxes in the table. Each group corresponds to a specific switch on an 8-way DIP switch. And the corresponding switch is switch on and the Number will be displayed in the seven segments Display.
The circuit comprises 8 push-to-on switch (S1-S8). Suppose you want to display 47. For this, 4 is to be displayed in tens position and 7 in units position. In order to generate 4 (binary 111) on the display , switches S6, S7, and S8 are to be turned on. The number 47 is placed in groups 6, 7, 8, and 2. So
when you spot 47 in these groups, switch on the same combination of switches. On depressing switch S9, 47 appears on the display. Other numbers can be generated using the same procedure.
Circuit Diagram
Flow Chart
Block Diagram
Program
0001 0000 PORTA EQU 0CH
0002 0000 PORTB EQU 0DH
0003 0000 REG EQU 0FH
0004 0000 .ORG 4100H
0005 4100
0006 4100 3E 94 MVI A,94H
0007 4102 D3 0F OUT REG
0008 4104 3E 01 MVI A,01H
0009 4106 0E 03 MVI C,03H
0010 4108 CD 05 00 CALL 0005 ;Clear Display
0011 410B 4F MOV C,A ;Generate Some Delay
0012 410C 06 02 MVI B,02H
0013 410E 11 0F 00 LOOP1: LXI D,0FH
0014 4111 1B LOOP: DCX D
0015 4112 7B MOV A,E
0016 4113 B2 ORA D
0017 4114 C2 11 41 JNZ LOOP
0018 4117 05 DCR B
0019 4118 C2 0E 41 JNZ LOOP1
0020 411B 4F MOV C,A
0021 411C 06 02 MVI B,02H
0022 411E 11 0F 00 LOOP2: LXI D,0FH
0023 4121 1B LOOP3: DCX D
0024 4122 7B MOV A,E
0025 4123 B2 ORA D
0026 4124 C2 21 41 JNZ LOOP3
0027 4127 05 DCR B
0028 4128 C2 1E 41 JNZ LOOP2
0029 412B DB 0C IN PORTA ;Read Switches
0030 412D 47 MOV B,A
0031 412E E6 0F ANI 0FH ;seperate first Digit
0032 4130 32 50 60 STA 6050H
0033 4133 78 MOV A,B
0034 4134 07 RLC
0035 4135 07 RLC
0036 4136 07 RLC
0037 4137 07 RLC
0038 4138 E6 0F ANI 0FH ;Seperate Second Digit
0039 413A 32 51 60 STA 6051H
0040 413D 21 50 60 LXI H,6050H
0041 4140 3E 03 MVI A,03H
0042 4142 0E 08 MVI C,08H
0043 4144 CD 05 00 CALL 0005H ;Display the Numbers on Data Field
0044 4147 4F MOV C,A ;Generate Some Delay
0045 4148 06 02 MVI B,02H
0046 414A 11 0F 00 LOOP4: LXI D,0FH
0047 414D 1B LOOP5: DCX D
0048 414E 7B MOV A,E
0049 414F B2 ORA D
0050 4150 C2 4D 41 JNZ LOOP5
0051 4153 05 DCR B
0052 4154 C2 4A 41 JNZ LOOP4
0053 4157 4F MOV C,A ;Generate Some Delay
0054 4158 06 02 MVI B,02H
0055 415A 11 0F 00 LOOP6: LXI D,0FH
0056 415D 1B LOOP7: DCX D
0057 415E 7B MOV A,E
0058 415F B2 ORA D
0059 4160 C2 5D 41 JNZ LOOP7
0060 4163 05 DCR B
0061 4164 C2 5A 41 JNZ LOOP6
0062 4167 76 HLT
0063 4168 .END
Number of errors = 0
Please check the Power supply pins & Port number before you connect the Hardware to the Trainer Kit
I guess I have selected a mind blowing and interesting blog exciteglobalreview
ReplyDeletewhich software you have used to simulate the above code and circuit
ReplyDelete