K-PAX
Newbie level 4
hello! i´am using the 8051 microcontroller with 12MHZ crystal, and i want to generate a square wave with the frequency of 5KHZ which gives a 50% of duty cycle.
how can i control delay time thar i have to use?and how i can do to control it.
The last question that i have is why does i have to use CSEG AT ..... ???
---------- Post added at 17:41 ---------- Previous post was at 16:59 ----------
can i do it like that?
ORG 0
jmp start
START: JB P1.0,PULSE
CLR P1.7
JMP START
PULSE: SETB P1.7
JMP DELAY
DELAY: MOV R0,#46
TAKE: DJNZ R0,TAKE
CLR P1.7
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
JMP DELAY
END
how can i control delay time thar i have to use?and how i can do to control it.
The last question that i have is why does i have to use CSEG AT ..... ???
---------- Post added at 17:41 ---------- Previous post was at 16:59 ----------
can i do it like that?
ORG 0
jmp start
START: JB P1.0,PULSE
CLR P1.7
JMP START
PULSE: SETB P1.7
JMP DELAY
DELAY: MOV R0,#46
TAKE: DJNZ R0,TAKE
CLR P1.7
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
JMP DELAY
END