Problem – Write a program to generate continuous square wave. Use D0 bit to output the square wave. The required waveform is:
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.
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
|2000H||MVI D, AAH||Load bit pattern AAH|
|2002H||ROTATE||MOV A, D||Load bit pattern in A|
|2003H||RLC||Change data to AAH to 55H and vica versa|
|2004H||MOV D, A||Save A|
|2005H||ANI 01H||Mask bits D7 to D1|
|2007H||OUTPORT 1||Output the D0 bit|
|2009H||JMP ROTATE||Jump to ROTATE to change logic level|
Program Description –
- Register D is loaded with AAH(10101010).
- Bit pattern is moved to accumulator.
- Bit pattern is rotated left and saved again in register D. This save is necessary as accumutor is used again in the program.
- Mask all bits but 0th bit.
- Output A at port 1.
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.
- 8085 program for Linear search | Set 2
- 8085 program to convert a BCD number to binary
- 8085 program to find the element that appears once
- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to search a number in an array of n numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to add two 8 bit numbers
- 8085 program to multiply two 8 bit numbers
- 8085 program to convert an 8 bit number into Grey number
- 8085 program to find the factorial of a number
- 8085 program to count the number of ones in contents of register B
- 8085 program to add two 16 bit numbers
- 8085 program to exchange a block of bytes in memory
- 8085 program to find square root of a number
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to convert 8 bit BCD number into ASCII Code
- 8085 program to find 1’s and 2’s complement of 16-bit number
- 8085 program to swap two 8-bit numbers
- 8085 program to add three 16 bit numbers stored in registers
- 8085 program to access and exchange the content of Flag register with register B
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.