Discussion in "Project Doubts" started by    sankalp_s    Nov 29, 2014.
Thu Dec 18 2014, 04:24 AM
#11
Code is all ok.. just change EXT0 to EX0... By mistake I wrote the wrong bit name. EX0 is for external interrupt 0.
 sankalp_s like this.
Thu Dec 18 2014, 08:32 PM
#12
SIR THIS CODE IS NOT WORKING..

ORG 000H ; starting address
SJMP LABEL
ORG 13H
    JNB P3.3, $
    RETI
SJMP LABEL1

LABEL1:
SETB EX1 ; Enable external interrupt 1
SETB EA   ; Enable interrupts

L1 EQU	 P1.2 ;LED CONECTED TO THIS PORT	
L2 EQU	 P1.3 ;LED CONECTED TO THIS PORT
L3 EQU   P1.4 ;LED CONECTED TO THIS PORT
L4 EQU   P1.5 ;LED CONECTED TO THIS PORT
L5 EQU   P1.6 ;LED CONECTED TO THIS PORT
L6 EQU   P1.7 ;LED CONECTED TO THIS PORT


LABEL:	
MOV R3, #05 ;REPEtion of pattern 
D7:	CALL DESGN7
DJNZ R3,D7	
MOV R3, #05 ;REPEtion of pattern 
D8:	CALL DESGN8
DJNZ R3,D8	
MOV R3, #05 ;REPEtion of pattern 
D9:	CALL DESGN9
DJNZ R3,D9	
JMP LABEL

DESGN7:	CALL ALLON 
CALL DELAY
SETB L1
CALL DELAY
SETB L2
CALL DELAY
SETB L3
CALL DELAY
SETB L4
CALL DELAY
SETB L5
CALL DELAY
SETB L6
CALL DELAY
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET

DESGN8:	CALL ALLON
SETB L6
SETB L1
CALL DELAY
CALL ALLON	
SETB L5
SETB L2
CALL DELAY
CALL ALLON	
SETB L4
SETB L3
CALL DELAY
RET

DESGN9:	CALL ALLON 
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET	

CLEAR:	SETB L1
SETB L2
SETB L3
SETB L4
SETB L5
SETB L6
RET

ALLON:	CLR L1
CLR L2
CLR L3
CLR L4
CLR L5
CLR L6
RET

DELAY:	MOV R0,#0FFH
INLOP:	MOV R1,#0FFH
DJNZ R1,$
DJNZ R0,INLOP
RET
END

Thu Dec 18 2014, 08:36 PM
#13



i've tried this code but faced a syntax error on line of setb ext0...
( Symbol not defined: ext0)

sankalp_s


Which compilier are you using ?



sir one thing more can u give me the while loop code
example for my requirement ..

sankalp_s



ORG 03H
JNB P3.2, $
RETI

This is all the code you need to freeze the display.


can i use pin int1 for this operation?

sankalp_s


Yes, but the code changes to..
    ORG 13H
    JNB P3.3, $
    RETI

//and 
SETB EXT1 ; Enable external interrupt 1
SETB EA   ; Enable interrupts


An alternative method does not use an interrupt.
Monitor the key in the delay routine.
DELAY: MOV R0,#0FFH
INLOP: MOV R1,#0FFH
buttonTest:             ;button is the input pin 
JNB button, buttonTest  ;wait while pressed
DJNZ R1,buttonTest
DJNZ R0,INLOP
RET


ExperimenterUK





I'm using mcu8051ide for compiling..
and sorry sir the alternate code is also not working..
Thu Dec 18 2014, 08:40 PM
#14


SIR THIS CODE IS NOT WORKING..

ORG 000H ; starting address
SJMP LABEL
ORG 13H
    JNB P3.3, $
    RETI
SJMP LABEL1

LABEL1:
SETB EX1 ; Enable external interrupt 1
SETB EA   ; Enable interrupts

L1 EQU	 P1.2 ;LED CONECTED TO THIS PORT	
L2 EQU	 P1.3 ;LED CONECTED TO THIS PORT
L3 EQU   P1.4 ;LED CONECTED TO THIS PORT
L4 EQU   P1.5 ;LED CONECTED TO THIS PORT
L5 EQU   P1.6 ;LED CONECTED TO THIS PORT
L6 EQU   P1.7 ;LED CONECTED TO THIS PORT


LABEL:	
MOV R3, #05 ;REPEtion of pattern 
D7:	CALL DESGN7
DJNZ R3,D7	
MOV R3, #05 ;REPEtion of pattern 
D8:	CALL DESGN8
DJNZ R3,D8	
MOV R3, #05 ;REPEtion of pattern 
D9:	CALL DESGN9
DJNZ R3,D9	
JMP LABEL

DESGN7:	CALL ALLON 
CALL DELAY
SETB L1
CALL DELAY
SETB L2
CALL DELAY
SETB L3
CALL DELAY
SETB L4
CALL DELAY
SETB L5
CALL DELAY
SETB L6
CALL DELAY
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET

DESGN8:	CALL ALLON
SETB L6
SETB L1
CALL DELAY
CALL ALLON	
SETB L5
SETB L2
CALL DELAY
CALL ALLON	
SETB L4
SETB L3
CALL DELAY
RET

DESGN9:	CALL ALLON 
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET	

CLEAR:	SETB L1
SETB L2
SETB L3
SETB L4
SETB L5
SETB L6
RET

ALLON:	CLR L1
CLR L2
CLR L3
CLR L4
CLR L5
CLR L6
RET

DELAY:	MOV R0,#0FFH
INLOP:	MOV R1,#0FFH
DJNZ R1,$
DJNZ R0,INLOP
RET
END


sankalp_s




sir can you explain what is missing in this code?
what would value of R3 in this code.
Fri Dec 19 2014, 12:21 AM
#15
This version works.
Edit it to use either method.


ORG 000H ; starting address
SJMP LABEL
ORG 13H
    JNB P3.3, $
    RETI


L1 EQU	 P1.2 ;LED CONECTED TO THIS PORT	
L2 EQU	 P1.3 ;LED CONECTED TO THIS PORT
L3 EQU   P1.4 ;LED CONECTED TO THIS PORT
L4 EQU   P1.5 ;LED CONECTED TO THIS PORT
L5 EQU   P1.6 ;LED CONECTED TO THIS PORT
L6 EQU   P1.7 ;LED CONECTED TO THIS PORT


LABEL:	
;SETB EX1 ; Enable external interrupt 1
;SETB EA   ; Enable interrupts

MOV R3, #05 ;REPEtion of pattern 
D7:	CALL DESGN7
DJNZ R3,D7	
MOV R3, #05 ;REPEtion of pattern 
D8:	CALL DESGN8
DJNZ R3,D8	
MOV R3, #05 ;REPEtion of pattern 
D9:	CALL DESGN9
DJNZ R3,D9	
JMP LABEL

DESGN7:	CALL ALLON 
CALL DELAY
SETB L1
CALL DELAY
SETB L2
CALL DELAY
SETB L3
CALL DELAY
SETB L4
CALL DELAY
SETB L5
CALL DELAY
SETB L6
CALL DELAY
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET

DESGN8:	CALL ALLON
SETB L6
SETB L1
CALL DELAY
CALL ALLON	
SETB L5
SETB L2
CALL DELAY
CALL ALLON	
SETB L4
SETB L3
CALL DELAY
RET

DESGN9:	CALL ALLON 
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET	

CLEAR:	SETB L1
SETB L2
SETB L3
SETB L4
SETB L5
SETB L6
RET

ALLON:	CLR L1
CLR L2
CLR L3
CLR L4
CLR L5
CLR L6
RET

DELAY:	MOV R0,#0FFH
INLOP:	MOV R1,#0FFH
buttonTest:            
;JNB P3.3, buttonTest  ;enable this line wait while pressed
DJNZ R1,buttonTest

DJNZ R0,INLOP
RET
END




[ Edited Fri Dec 19 2014, 12:40 AM ]
 sankalp_s like this.
Fri Dec 19 2014, 06:04 PM
#16


This version works.
Edit it to use either method.


ORG 000H ; starting address
SJMP LABEL
ORG 13H
    JNB P3.3, $
    RETI


L1 EQU	 P1.2 ;LED CONECTED TO THIS PORT	
L2 EQU	 P1.3 ;LED CONECTED TO THIS PORT
L3 EQU   P1.4 ;LED CONECTED TO THIS PORT
L4 EQU   P1.5 ;LED CONECTED TO THIS PORT
L5 EQU   P1.6 ;LED CONECTED TO THIS PORT
L6 EQU   P1.7 ;LED CONECTED TO THIS PORT


LABEL:	
;SETB EX1 ; Enable external interrupt 1
;SETB EA   ; Enable interrupts

MOV R3, #05 ;REPEtion of pattern 
D7:	CALL DESGN7
DJNZ R3,D7	
MOV R3, #05 ;REPEtion of pattern 
D8:	CALL DESGN8
DJNZ R3,D8	
MOV R3, #05 ;REPEtion of pattern 
D9:	CALL DESGN9
DJNZ R3,D9	
JMP LABEL

DESGN7:	CALL ALLON 
CALL DELAY
SETB L1
CALL DELAY
SETB L2
CALL DELAY
SETB L3
CALL DELAY
SETB L4
CALL DELAY
SETB L5
CALL DELAY
SETB L6
CALL DELAY
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET

DESGN8:	CALL ALLON
SETB L6
SETB L1
CALL DELAY
CALL ALLON	
SETB L5
SETB L2
CALL DELAY
CALL ALLON	
SETB L4
SETB L3
CALL DELAY
RET

DESGN9:	CALL ALLON 
CALL DELAY	
SETB L6
CALL DELAY	
SETB L5
CALL DELAY	
SETB L4
CALL DELAY	
SETB L3
CALL DELAY	
SETB L2
CALL DELAY
SETB L1
CALL DELAY
RET	

CLEAR:	SETB L1
SETB L2
SETB L3
SETB L4
SETB L5
SETB L6
RET

ALLON:	CLR L1
CLR L2
CLR L3
CLR L4
CLR L5
CLR L6
RET

DELAY:	MOV R0,#0FFH
INLOP:	MOV R1,#0FFH
buttonTest:            
;JNB P3.3, buttonTest  ;enable this line wait while pressed
DJNZ R1,buttonTest

DJNZ R0,INLOP
RET
END



ExperimenterUK



Thank u so much sir for your quick response..
sir code which is posted last time by u is working.. but when interrupt occurs then main function do not work.. only led blow continuously.. but i want something else

I'm very sorry sir it was my mistake that i could no explain exact need.

ok i explain what i want to do.

please look this code


MOV R3, #05 ;REPEtion of pattern 
D7:	CALL DESGN7
DJNZ R3,D7	
MOV R3, #05 ;REPEtion of pattern 
D8:	CALL DESGN8
DJNZ R3,D8	
MOV R3, #05 ;REPEtion of pattern 
D9:	CALL DESGN9
DJNZ R3,D9


first design is D7 , there is line MOV R3, #05 it means D7 will repeat 5 time, then D8 will execute, & after that D9,,
suppose D7 is running, and when we press the switch then repetition number of D7 should be infinite means when is switch pressed then only D7 should will execute, and when switch goes its earlier condition means off condition then design will repeat only five time, after it D8 will execute n after D9 by the chip.
this interrupt should work for every design.

sorry for my mistake, i think this is enough explanation..


[ Edited Fri Dec 19 2014, 06:05 PM ]
Fri Dec 19 2014, 09:58 PM
#17
For what you want,it is easier to not use interrupts.
If the pattern gets much more complicated,
using an interrupt may be better.

Don't enable interrupts and change your code to this.

MOV R3, #05 ;REPEtion of pattern 
D7:	CALL DESGN7
JNB P3.3,D7 
DJNZ R3,D7	


MOV R3, #05 ;REPEtion of pattern 
D8:	CALL DESGN8
JNB P3.3,D8
DJNZ R3,D8	

MOV R3, #05 ;REPEtion of pattern 
D9:	CALL DESGN9
JNB P3.3,D9
DJNZ R3,D9
 ajay_bhargavsankalp_s like this.
Sat Dec 20 2014, 05:31 PM
#18


For what you want,it is easier to not use interrupts.
If the pattern gets much more complicated,
using an interrupt may be better.

Don't enable interrupts and change your code to this.

MOV R3, #05 ;REPEtion of pattern 
D7:	CALL DESGN7
JNB P3.3,D7 
DJNZ R3,D7	


MOV R3, #05 ;REPEtion of pattern 
D8:	CALL DESGN8
JNB P3.3,D8
DJNZ R3,D8	

MOV R3, #05 ;REPEtion of pattern 
D9:	CALL DESGN9
JNB P3.3,D9
DJNZ R3,D9

ExperimenterUK




Thanks a lot sir, its working,
great support, quick response,thanks admin sir & co admin sir..

i've some queries more about this project..
first one is,
if i using 2051 chip then how can i use ANALOG COMPARATOR for blinking speed control of design by the external controller like potentio meter. and what would be code for it?


[ Edited Sat Dec 20 2014, 05:40 PM ]
Sun Dec 21 2014, 10:16 PM
#19


Thanks a lot sir, its working,
great support,

sankalp_s


Thank you.


i've some queries more about this project..
first one is,
if i using 2051 chip then how can i use ANALOG COMPARATOR for blinking speed control of design by the external controller like potentio meter. and what would be code for it?

sankalp_s


The ANALOG COMPARATOR on the 2051 seems to be
just a comparator , that is , not programmable.
You will need extra hardware to use it.

I would suggest adding a 555 timer circuit that generates a
square wave controlled by a pot.
Then just measure the frequency or length of the square waves.



[ Edited Mon Dec 22 2014, 12:35 AM ]
Mon Dec 22 2014, 04:52 PM
#20



Thanks a lot sir, its working,
great support,

sankalp_s


Thank you.


i've some queries more about this project..
first one is,
if i using 2051 chip then how can i use ANALOG COMPARATOR for blinking speed control of design by the external controller like potentio meter. and what would be code for it?

sankalp_s


The ANALOG COMPARATOR on the 2051 seems to be



ExperimenterUK


but sir i have seen speed controlling in 2051 chip without 555 ic,
sir my second query is, there are three program in side the code:
for example in program 1st has three design, program 2nd has two design program 3rd has six design,
now i'm using any two pin for call these design. (ie.pin p3.2 & p3.3)
if no any pin is low then only program 1 will be run
if 3.2 then only program 2
& when 3.3 then only program 3
is this possible with JB & JNB instruction?
i've tried but only 1 program works,
could you please give me code for that.

Get Social

Information

Powered by e107 Forum System

Conversation

Mon Jan 16 2017, 03:15 PM
Rutuja
How can we read notepad file using random acess file
Fri Jan 06 2017, 06:18 AM
muhammad Umar
i need cd4047 library file for protious please help me i s
ExperimenterUK
Wed Jan 04 2017, 09:01 PM
@Emin what is your site user name ?
Tue Jan 03 2017, 11:16 PM
Emin
Emin: I'm already a member since 2012 and entered repeatedly during period. But now it is impossible and obtaining a new registration is also failed. The same error message specifying that two e-mails i entered are different!. In fact thaey are the same. Now, what will be happen, what is your solution? Thanks..
Tue Jan 03 2017, 11:15 PM
Emin
I'm already a member since 2012 and entered repeatedly during period. But now it is impossible and obtaining a new registration is also failed. The same error message specifying that two e-mails i entered are different!. In fact thaey are the same. Now, what will be happen, what is your solution? Thanks..
Sun Jan 01 2017, 03:14 PM
Manoranjana Chary
Write an embedded program of increment and decrement in LCD connected to two keys of int1 and int0. Can u please send me the code for this as fast as possible because i need to submit it in college kindly
ExperimenterUK
Sat Dec 31 2016, 06:28 PM
Happy New Year everyone
ExperimenterUK
Sat Dec 31 2016, 06:27 PM
Please post questions in the forum, the chat box is for chat
Thu Dec 29 2016, 07:47 AM
drashti ranolia
can anyone help me for the microcontroller 8051 programming code for street lights that glow on vehicle movement using IR sensors ?
Tue Dec 27 2016, 11:45 AM
Shubhangi
Do we have to write lookup table for d6t thermal sensor?

Downloads

Comments

sarfrosh92
Sun Jan 15 2017, 09:18 AM
Deepakvaishu
Wed Jan 11 2017, 10:25 AM
rana_jee773
Sat Dec 10 2016, 11:22 AM
[email protected]
Thu Dec 08 2016, 11:02 AM
Jonathan.kei
Mon Nov 21 2016, 04:30 PM
AVRuser1
Sun Nov 20 2016, 06:07 PM
JaguarPaw
Thu Nov 17 2016, 07:44 PM
PeterJohn
Mon Nov 14 2016, 05:54 PM

Online

Guests: 44, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37796
Newest member: sarfrosh92
Forum Activity
Deepakvaishu Avatar
Posted By Deepakvaishu
Mon Jan 16 2017, 08:31 AM
you are right ..I should not include '\' at t...
Deepakvaishu Avatar
Posted By Deepakvaishu
Mon Jan 16 2017, 06:07 AM
No ,its not the null character, its just the '...
sankalp_s Avatar
Posted By sankalp_s
Sun Jan 15 2017, 07:55 PM
There is a fault in your Proteus design.If you loo...
sarfrosh92 Avatar
Posted By sarfrosh92
Sun Jan 15 2017, 10:04 AM
The 8051 Microcontroller (3rd Edition) by I. Scott...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Jan 14 2017, 11:59 PM
The site editor may have removed the 0 from \0.Actually it should not be needed, sochar *phone_no[3 ]={"1234567890" ," 9087654321" ,"76676667676"}; //array of pointers should work.
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Jan 14 2017, 11:54 PM
There is a fault in your Proteus design.If you loo...
sankalp_s Avatar
Posted By sankalp_s
Fri Jan 13 2017, 06:52 PM
Hi phill sir.. testButton1: ...
Deepakvaishu Avatar
Posted By Deepakvaishu
Fri Jan 13 2017, 11:58 AM
suppose i have this arraychar *phone_no[3 ]={"1234...
ajay_bhargav Avatar
Posted By ajay_bhargav
Fri Jan 13 2017, 05:59 AM
You need to send AT command one by one to all the ...
Deepakvaishu Avatar
Posted By Deepakvaishu
Wed Jan 11 2017, 10:47 AM
How to send the same message to multiple contacts ...