ET3491 Embedded Systems and IoT Design
[Link]:
Generation of Square waveform using 8051
Date:
Aim
To write an assembly language program to generation of square waveform
using 8051 microcontroller.
Software/Hardware Required:
8051 Microcontroller Kit
DAC Interface board
Algorithm
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
Flowchart
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
PROGRAM
Square wave generation using DAC
Memory Label Mnemonics Comments
address
4100 MOV DPTR,#0FFC8H Move DAC port address to DPTR
4103 START: MOV A,#00H Initialise count to 0 for low level
4105 MOVX @DPTR,A Send low value to DAC port
4106 L Call subroutine to introduce delay – off
CALL DELAY
time
4109 MOV A,#0FFH Move high value count to accumulator
410B MOVX @DPTR,A Send high value to DAC port
410C Call subroutine to introduce delay – on
LCALL DELAY
time
410F SJMP START Repeat cycles
4112 DELAY: MOV R1,#05H Initialise R1 to 5 for outer loop count
4114 L Initialise R2 as FFH for inner loop
LOOP: MOV R2,#0FFH
count
4116 HERE: DJNZ R2,HERE Decrement R2 till it becomes 0
4118 Decrement R1and jump to LOOP if not
DJNZ R1,LOOP
zero
411A RET Return from subroutine
Result
TPGIT/ECE Page No:
ET3491 Embedded Systems and IoT Design
TPGIT/ECE Page No: