kisstronics
Newbie level 3
Please help me
I need to generate 38khz square wave for IR transmission so I decided to use the 89c2051 I wrote the following ASM program for that but It is not working in real time. The Wave should be generate when P3.1 is High only. The code is as fallows
ORG 00H
GO:
tx EQU P3.3
MOV TMOD,#00010001B
SJMP MAIN
HIGH:
MOV TL1,#0CAH
MOV TH1,#0F9H
SETB TR1
HERE:
MOV TL0,#0F4H
MOV TH0,#0FFH
SETB TR0
CPL IR
JNB TF0,$
CLR TF0
JNB TF1,HERE
CLR TF1
CLR IR
RET
LOW:
MOV TL1,#0CAH
MOV TH1,#0F9H
SETB TR1
SETB IR
JNB TF1,$
CLR TF1
CLR IR
RET
MAIN:
CLR P3.1
CLR P3.3
HI:
JNB P3.1, HI
ACALL HIGH
ACALL LOW
SJMP HI
END
I need to generate 38khz square wave for IR transmission so I decided to use the 89c2051 I wrote the following ASM program for that but It is not working in real time. The Wave should be generate when P3.1 is High only. The code is as fallows
ORG 00H
GO:
tx EQU P3.3
MOV TMOD,#00010001B
SJMP MAIN
HIGH:
MOV TL1,#0CAH
MOV TH1,#0F9H
SETB TR1
HERE:
MOV TL0,#0F4H
MOV TH0,#0FFH
SETB TR0
CPL IR
JNB TF0,$
CLR TF0
JNB TF1,HERE
CLR TF1
CLR IR
RET
LOW:
MOV TL1,#0CAH
MOV TH1,#0F9H
SETB TR1
SETB IR
JNB TF1,$
CLR TF1
CLR IR
RET
MAIN:
CLR P3.1
CLR P3.3
HI:
JNB P3.1, HI
ACALL HIGH
ACALL LOW
SJMP HI
END