Discussion in "New Ideas regarding projects" started by    ugoo5000    Jul 29, 2016.
Fri Jul 29 2016, 05:18 pm
#1
i am working on a project to generate a continuous pulse of 1 second on p1.2 when p3.0 is depress to ground. but is not working ,pls i need help
below is my code

org 00h
mov p1,#11111111b
mov p3,#11111111b
start:
mov p1,#11111111b
mov p3,#11111111b

start1:
jnb p3.0,count
jmp start1


count:
setb p1.2
clr p1.2
call delay
setb p1.2
jmp start1



delay: ;DELAY OF ONE SECOND
MOV TMOD,#01H
MOV TH0,#3CH
MOV TL0,#0B0H
MOV R7,#00H
SETB TR0
DEL:JNB TF0,DEL
MOV TH0,#3CH
MOV TL0,#0B0H
CLR TF0
INC R7
CJNE R7,#14H,DEL
ret

end
Fri Jul 29 2016, 05:20 pm
#2
below is the proteus file
Sat Jul 30 2016, 01:01 am
#3
Hi
Your Proteus file did not upload, be sure to zip it before attaching.

Your code is okay.
Are you able to program your 8051 to do a simple LED flash ?.
Sat Jul 30 2016, 01:19 am
#4
i want the the counter to be counting in secs with the real time clock but is a second late to compare with real time clock, i mean the proteus time, stimulate it and see


[ Edited Sat Jul 30 2016, 01:22 am ]
Sat Jul 30 2016, 05:04 am
#5
Your code does not count at all, it produces a one-shot, low pulse for each button press.
Can you zip and post your Proteus project.
Sat Jul 30 2016, 12:00 pm
#6
proteus file
Attachment
Sat Jul 30 2016, 12:10 pm
#7
when i press a button in p3.0,the counter will start to count but my problem is that the counter is not counting in real time in second with real clock the ,how can i make the clock delay to produce pulses in a second? is like the upper and the lower pulse in my signal is delayed a second making a complete cycle 2seconds,i tried to divide the pulse by 500ms so that i can get the total pulse to be 1sec but i cant generate a delay for 500ms, pls can you help me out


[ Edited Sat Jul 30 2016, 12:11 pm ]
Sat Jul 30 2016, 01:01 pm
#8
is working now
org 00h
mov p1,#11111111b
mov p3,#11111111b

start1:
jnb p3.0,count
jmp start1


count:
setb p1.2
call delay
clr p1.2
call delay
jmp start1



delay: ;DELAY OF 500ms
MOV TMOD,#01H; delay for 50ms
MOV TH0,#3CH
MOV TL0,#0B0H
MOV R7,#00H
SETB TR0
DEL:JNB TF0,DEL
MOV TH0,#3CH
MOV TL0,#0B0H
CLR TF0
INC R7
CJNE R7,#10d,DEL; 10*50ms=500ms
RET
end
Mon Aug 01 2016, 10:56 am
#9


is working now

ugoo5000


Great, thanks for letting us know.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

EdwardFew
Mon Mar 18 2024, 01:14 pm
EmeryPah
Mon Mar 18 2024, 11:51 am
RobertMax
Sun Mar 17 2024, 10:22 pm
DanielJar
Fri Mar 15 2024, 06:52 pm
Tuzaimecor
Fri Mar 15 2024, 02:32 am
PromotionFoode
Thu Mar 14 2024, 08:11 pm
EdwardGeawn
Sun Mar 10 2024, 12:24 pm
ZacharyShado
Sat Mar 09 2024, 10:04 am