can anyone help with my code for PWM on my 8051

Status
Not open for further replies.

bvan3

Newbie level 1
Joined
Mar 2, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
I want to control my PWM with my 8051 DIP switches and I need help

ORG 0000H
MAIN:
CLR P1.0
CLR P1.1
CLR P1.2
CLR P2.7
CLR P2.6
CHECKMOTOR:
JB P2.0, CONTROL
JNB P2.0, MOTOROFF
CONTROL:
SETB P1.0
JNB P2.7,CLOCKWISE
CLR P1.1
SETB P1.2
SJMP CHECKMOTOR
CLOCKWISE:
SETB P1.1
CLR P1.2
SJMP CHECKMOTOR
NORMAL:
JNB P2.6, FIFTYPERCENT
SETB P1.0
MOV R5,#25
ACALL DELAY
CLR P1.0
MOV R5,#75
ACALL DELAY
SJMP NORMAL
FIFTYPERCENT:
SETB P1.0
MOV R5,#50
ACALL DELAY
CLR P1.0
MOV R5,#50
ACALL DELAY
SJMP NORMAL
DELAY:
H1: MOV R2,#100
H2: MOV R3,#255
H3: DJNZ R3,H3
DJNZ R2,H2
DJNZ R5,H1
MOTOROFF:
SETB P1.0
RET
END
 

Can you explain more:
1. what is your output
2. input =???????
3. ckt = ?

regards,
mAVERICK
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…