Question of Microprcessor

From Inupt / Output Interfaces chapter in PU/ Microprocessor and Assembly Language Programming

Asked on 7 Feb, 2021

Like 0 Dislike 240 Views

Instruction to generate 5 KHz sqaure waveform in 8254 PIT

Add a comment

1 Answers

arjun adhikari on 7 Feb, 2021 Like 0 Dislike

Given: 

Mode of Operation= Mode 3: (Square Wave Generator)

Frequency of square wave= 1 KHz 


Assume:

Counter= Counter 1

Frequency of Clock be 2 MHz

Address of Counter 0= 80H

Address of Counter 1= 81H

Address of Counter 2= 82H

Address of Counter 3= 83H 


We know that:

Count = (Frequency of Clock)/(Frequency of Square Wave)

Count = (2 MHz)/(5 KHz) 

Count = (2000 KHz)/(5 KHz)
Count = 0400

Control Word = 01110111 = 77H 

Subroutine Program
SQUAREWAVE:
MVI A, 77H ;move value of control word in A
OUT 83H ;load control word in A into control register 
MVI A, 00 ;move lower byte of count into A
OUT 81H ; move lower byte of count in A into Counter 1 
MVI A, 04 ;move higher byte of count into A
OUT 81H ;move higher byte of count in A into Counter 1 
RET ;return from subroutine program

 

 

comments on the answer (1)

Like 0 Dislike In given section, frequency = 5KHz arjun adhikari on 8 Dec, 2021

Add a comment


Add your answer