Latest

6/recent/ticker-posts

How can you design a square wave generator using 8155. Explain with appropriate diagram the different modes of operation, control logics and instructions for the timer.

 How can you design a square wave generator using 8155. Explain with appropriate diagram the different modes of operation, control logics and instructions for the timer.

Solution:

Square wave generator is an oscillator that gives the output without any input, means it must be an impulses input, which will be given within zero seconds.

To design a square wave generator using 8155, let us assume

a) Port address for-

    i) Control Word Register- 80 H.

    ii) Timer LSB - 84 H.

    iii) Timer MSB- 85 H.

b) Count value= 025 E H.

The steps to design a square wave generator are as follows:

STEP 1:    The LSB of the count 5 E H is loaded in timer register with the address 84 H.

STEP 2:    The MSB of the timer register is determined as follows:

M2      M1     T13        T12     T11    T10     T9     T8   

0          1         0         0           0        0         1        0 =42  H

Time mode 1                MSB of the count (i.e. 02 H)

for square

wave generation

This value i.e. 42 H is loaded in timer register with the address 85 H.

STEP 3:     To start the timer, D7 and D6 bit of control word should be 1.

        Now, the bit of control word register is set and is sent to address 80 H and start the timer.

So, the bit of control word is : 11000011= C3 H ( Assume that A and B are output ports ).

STEP 4: End of program.

SAMPLE PROGRAM FOR SQUARE WAVE GENERATOR:

MVI A, 5E H (LSB of count 025 E H is loaded into the accumulator.

OUT 84 H (Port address of LSB timer)

MVI A,42 H ( MSB of count)

OUT 85 H ( Port address of MSB time register).

MVI A, C3 H ( Value of control word ).

OUT 80 H ( Start the timer ).

HLT (End of program)

DIFFERENT MODES OF OPERATION:

MODE 0:    In this mode, the timer output remains high for half the count and goes low for the remaining count, thus providing a single square wave. The pulse width is determined by the count and the clock frequency.

M2=0

M1=0


MODE 1: In this mode, the initial timer count is automatically reloaded at the end of each count, thus providing a continuous square wave.

M2=0

M1=1


MODE 2: In this mode, a single clock pulse is provided at the end of the count.

M2=1

M1=0



MODE 3: This is similar to mode 2, except the initial count is reloaded to provide a continuous waveform.

M2=1

M1=1


CONTROL LOGICS AND INSTRUCTIONS FOR THE TIMER:

The timer of 8155 consists of two 8 bit registers, total of 14 bits are used for the counter and two bits are used for timer mode, and it requires a clock as an input. This 14 bit down counter provides output in 4 different  modes.

M2

M1

T13

T12

T11

T10

T9

T8

  
  MSB Loading Format

T7

T6

T5

T4

T3

T2

T1

T0

     LSB Loading Format

The above figure shows two registers for a 14 bit count, one for LSB (Low significant byte) and one for MSB (Most significant byte). The most significant bits M2 and M1 are used to specify the timer mode. To operate the timer, a 14 bit count and mode bits are loaded in the registers. An appropriate control word starts the counter, which decrements the count by two at each clock pulse. The timer output vary according to mode specified. The actual count at a given moment can be obtained by reading the status register.


Contributed by a student of National Institute of Technology, Silchar, India

Post a Comment

0 Comments