Saturday, April 30, 2016

8051 Program – 2khz square wave

; square wave generation
; standard 8051, 12MHz XTAL
; 2KHz square wave on P1.0
; Timer 0, 16-bit mode
ORG 0H
PORT EQU P1
PIN EQU P1.0
START: MOV PORT,#00000000B
MOV TMOD,#00000001B
MAIN:
LCALL SQUAREWAVE
SJMP MAIN
SQUAREWAVE:
SETB PIN
ACALL DELAY
CLR PIN
ACALL DELAY
RET
DELAY:
MOV TH0,#0FCH
MOV TL0,#18H
SETB TR0
here: JNB TF0,here
CLR TR0
CLR TF0
RET
END



Related topics:
8051 Program - 1khz square wave   |   8051 Program - 10khz square wave   |   8051 Program - pwm   |   8051 Program - sine wave   |   8051 Program - triangular wave   |   8051 Program - sawtooth wave   |   8051 Program - stair wave   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment