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

Thu May 25 2017, 05:25 AM
Monir Hossain
Can i change the 7-Segment are common pin ? And how to?
Mon May 08 2017, 12:45 PM
ivan muvunyi
please can you send me wiring diagram for automatic control of 3 phase induction motor for production of maize flour
Wed May 03 2017, 08:39 PM
imran qureshi
hello friend
Sun Apr 30 2017, 05:49 AM
Lijin G Varghese
Can u send me the circuit diagram for Program to interface GSM Module with 8051 microcontroller (AT89C51) using PC and LCD
Fri Apr 28 2017, 03:47 PM
SANDEEP T S
I need pcb wizard 3.5 version kindly send valid link of yours
ExperimenterUK
Mon Apr 17 2017, 11:56 PM
Sorry..We had a problem with registration.Confirmation emails were not sent.Please re-register
Thu Apr 13 2017, 07:29 PM
Piyush Aughad
I want circuit & program for radar detection using Microcontroller 8051
Tue Apr 11 2017, 03:27 AM
Shabbir Ahmed
Hi Ajay ....hope you and your family all will be fine are you working on andriod aplications if yes then plz reply me
Sun Apr 09 2017, 06:33 PM
ATHULYA NAIR
Dear Sir, I need to know what are the complexity for programming in 8051 Microcontroller for three phase inverter?
Sun Apr 09 2017, 06:32 PM
ATHULYA NAIR
Dear Sir,

Downloads

Comments

Gaurav9527
Tue May 23 2017, 10:24 AM
rapushh
Tue May 23 2017, 10:22 AM
lubnakhan
Sat May 20 2017, 10:23 AM
Utsavi
Wed May 17 2017, 10:35 AM
Samimash
Tue May 16 2017, 01:15 PM
gangusa
Mon May 15 2017, 04:34 AM
raghuzala
Sun May 14 2017, 02:32 PM
Prakashlimbachiya
Sat May 13 2017, 07:34 AM

Online

Guests: 71, Members: 0 ...

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

Members: 37829
Newest member: Gaurav9527
Forum Activity
yogesh puri Avatar
Posted By yogesh puri
Thu May 25 2017, 10:33 PM
dear sirif i simulate the above program in keil it...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed May 24 2017, 09:42 PM
If you run the display in 4 bit mode and share pin...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed May 24 2017, 09:27 PM
Please post your code and Proteus file.
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed May 24 2017, 09:23 PM
i am unable to simulate following code in protous...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 05:01 AM
Duplicate post of http://www.8051projects.net/t651...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 05:00 AM
All I can say looking at the post is "insufficient...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 04:58 AM
(the 3 motorsteppers need to move independently, b...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 24 2017, 04:55 AM
I am never sure with Proteus keypad. They always h...
yogesh puri Avatar
Posted By yogesh puri
Tue May 23 2017, 10:36 PM
i am unable to simulate following code in protous....
yogesh puri Avatar
Posted By yogesh puri
Tue May 23 2017, 10:34 PM
i am unable to simulate following code in protous...