Beruflich Dokumente
Kultur Dokumente
Solution : There are 6 distinct states and hence it is a mod-6 counter which requires three JK
flip-flops.
000
101 001
111 100
110
J2=Q0 K2=Q1’Q0
Q1Q0 Q1Q0
00 01 11 10 00 01 11 10
0 0 0 - - - - - -
1 1 0 - - - - 1 0
J1=Q2Q0’ K1=Q0
00 01 11 10 00 01 11 10
1 - - - - 1 - -
0 - - 1 - 1 - -
J0=Q2’+Q1 K0=Q1’
Fig: K-map
2.DESIGN AND IMPLEMENTATION OF 3 BIT SYNCHRONOUS UP/DOWN
COUNTER
AIM:
To design and implement 3 bit synchronous up/down counter.
PROCEDURE
Output: Ones--------04
Zeros--------04
4.Write an ALP to find the GCD of two 16 bit unsigned integers.
DATA SEGMENT
NUM1 DW 000AH
NUM2 DW 0004H
GCD DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START: MOV AX, DATA ; Load the Data to AX.
MOV DS, AX ; Move the Data AX to DS.
MOV AX, NUM1 ; Move the first number to AX.
MOV BX, NUM2 ; Move the second number to BX.
UP: CMP AX, BX ; compare the two numbers.
JE EXIT ; If equal, go to EXIT label.
JB EXCG ; If first number is below than second,
; go to EXCG label.
UP1: MOV DX, 0H ; Initialize the DX.
DIV BX ; Divide the first number by second
; number.
CMP DX, 0 ; Compare remainder is zero or not.
JE EXIT ; If zero, jump to EXIT label.
MOV AX, DX ; If non-zero, move remainder to AX.
JMP UP ; Jump to UP label.
EXCG: XCHG AX, BX ; Exchange the remainder and quotient.
JMP UP1 ; Jump to UP1.
EXIT: MOV GCD,BX ; Store the result in GCD.
MOV AH, 4CH
INT 21H
CODE ENDS
END START
Input: 0A,04
Output: 02
DIGITAL ELECTRONICS AND MICROPROCESSOR LAB
ASSIGNMENT QUESTIONS