Skip to content

# 8085 program for pulse waveform

• Difficulty Level : Basic
• Last Updated : 06 Jun, 2018

Problem – Write a program to generate continuous square wave. Use D0 bit to output the square wave. The required waveform is:

Explanation –
The alternate pattern of 0/1 bits can be provided by loading the accumulator with AAH(10101010) and rotating the pattern once through each loop. Bit D0 of the output port is used to proved logic 0 and 1. Therefore, all other bits can be masked by ANDing the accumulator with 01H.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

Example –

```Accumulator   : 1 0 1 0 1 0 1 0
And with 01H  : 0 0 0 0 0 0 0 1
Output        : 0 0 0 0 0 0 0 0
So output => 0

After RLC :

Accumulator   : 0 1 0 1 0 1 0 1
And with 01H  : 0 0 0 0 0 0 0 1
Output        : 0 0 0 0 0 0 0 1
So output => 1
```

Program –

AddressLabelMnemonicsComments
2000HMVI D, AAHLoad bit pattern AAH
2002HROTATEMOV A, DLoad bit pattern in A
2003HRLCChange data to AAH to 55H and vica versa
2004HMOV D, ASave A
2005HANI 01HMask bits D7 to D1
2007HOUTPORT 1Output the D0 bit
2009HJMP ROTATEJump to ROTATE to change logic level

Program Description –

1. Register D is loaded with AAH(10101010).
2. Bit pattern is moved to accumulator.
3. Bit pattern is rotated left and saved again in register D. This save is necessary as accumutor is used again in the program.
4. Mask all bits but 0th bit.
5. Output A at port 1.
My Personal Notes arrow_drop_up