Discussion in "Project Doubts" started by    sankalp_s    Nov 29, 2014.
Sat Nov 29 2014, 07:59 PM
#1
hello ajay sir,
i've recently joined this forum, I've downloaded code for led chaser,
i want to infinite repetition of current running pattern through external interrupt(INT0)
when switch is on, but when switch is off then pattern should be run as previous defined time.

the code is:-

ORG 000H ; starting address
SJMP LABEL





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
Tue Dec 02 2014, 04:55 AM
#2
This program is already an infinte loop.
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

Are you looking for a particular design to be taken into loop? then you can put that design in interrupt routine itself, and keep going till the pin is high. There will be significant changes in the code. You need to understand it and then make changes.
 sankalp_s like this.
Wed Dec 03 2014, 10:15 AM
#3
Thank u very much sir, for ur response.

Actually i want to lock that pattern which is currently executing .
and when it return from interrupt then pattern should execute in their sequence.

sir please help me for the code..could u write the code?

thank u sir.

Fri Dec 05 2014, 05:08 PM
#4
We can't really understand what you want.

Do you want to freeze the display when the button is pressed. ?
Can you describe what you want in a different way.
Sun Dec 07 2014, 08:17 AM
#5
yes sir exactly as you said..
i want to freeze the display when switch is presses & when switch is not pressed then all pattern should execute in their sequence..
Wed Dec 10 2014, 04:35 AM
#6
so in ISR put a while loop till the switch is low and then as soon as it is high exit from there... processor will continue what it was doing earlier.. e.g.
    ORG 03H
    JNB P3.2, $
    RETI

So when you make INT0 low (switch pressed) it will jump to ISR and make your cpu wait till the switch is pressed.


[ Edited Wed Dec 10 2014, 04:36 AM ]
Fri Dec 12 2014, 06:29 PM
#7
Thank u sir for your response.
sir can u explain more about this or put the code in that code please.. it will be very helpful sir.

actually i've tried bit failed .. so please help me about exact code n where it would be put.

thank you.


[ Edited Fri Dec 12 2014, 07:04 PM ]
Tue Dec 16 2014, 04:55 AM
#8
ORG 000H ; starting address
SJMP LABEL1

    ORG 03H
    JNB P3.2, $
    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

LABEL1:
SETB EXT0 ; Enable external interrupt
SETB EA ; Enable interrupts

LABEL:
MOV R3, #05 ;REPEtion of pattern
D7: CALL DESGN7
; ... rest of the code ...
Wed Dec 17 2014, 04:11 PM
#9


ORG 000H ; starting address
SJMP LABEL1

    ORG 03H
    JNB P3.2, $
    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

LABEL1:
SETB EXT0 ; Enable external interrupt
SETB EA ; Enable interrupts

LABEL:
MOV R3, #05 ;REPEtion of pattern
D7: CALL DESGN7
; ... rest of the code ...

ajay_bhargav




Thank u sir.
i've tried this code but faced a syntax error on line of setb ext0.....( Symbol not defined: ext0)
sir one thing more can u give me the while loop code example for my requirement .. can i use pin int1 for this operation?

Wed Dec 17 2014, 11:21 PM
#10


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

Get Social

Information

Powered by e107 Forum System

Conversation

Mon Mar 27 2017, 04:09 AM
priyanja awate
my project is greenhouse monitering and controlling using 8051 .can u give me the program of this project
ExperimenterUK
Sat Mar 25 2017, 09:56 PM
@Noreen I suggest you log in and post a full description of what you need in our PIC forum
Sat Mar 25 2017, 03:10 PM
Noreen
Hello I worked on a project related to Wireless Electricity theft detection using GSM during my bachelors. I used Nokia 6230 for sending sms using AT commands. I chose to work with SMS text mode. The microcontroller I used was PIC16F877A and its software coding done through PIC Basic Pro. Unfortunately, I lost my account password and do not have coding for generation sms using AT commands. I need that coding. Can some one help me to provide complete Pic Basic Pro code. In which step by step guidance is given so that I can understand easily. Regards,
Wed Mar 22 2017, 09:13 PM
ajay kumar
help me nokia lcd light
Wed Feb 22 2017, 06:14 AM
ChollyMo
Indeed, on the LCD tutorial, many missing Tables and figures !!
Wed Feb 22 2017, 06:06 AM
ChollyMo
I don't see any Table 3. I'm using Chrome.
Fri Feb 03 2017, 05:56 AM
irfan shaikh
hi, i want interface WS2811 pixel led using NUVOTON N79E352, but i dont know how to code it. can anyone help me or provide me sample coding for interfacing WS2811 PIXEL LED. THNX
Thu Jan 19 2017, 08:42 PM
abhays
Hi...i have made a circuit for interfacing PT100 with LM358 whose temperature is shown on the LCD...But the temperature is not getting incresed slowly ..a small change directly increses the temp...can any one help me
Thu Jan 19 2017, 04:27 PM
roba
send me alarm clock simulation using proteus software
Mon Jan 16 2017, 03:15 PM
Rutuja
How can we read notepad file using random acess file

Downloads

Comments

SAUnwin
Tue Mar 21 2017, 02:29 PM
letonarolikah
Mon Mar 20 2017, 11:21 AM
nerodear
Tue Mar 14 2017, 07:08 AM
XuZiling
Wed Feb 22 2017, 02:40 AM
diwakar_96
Thu Feb 16 2017, 02:40 PM
Helia
Thu Feb 09 2017, 09:59 AM
fasihaftab
Sat Jan 28 2017, 08:58 AM
jmunjr
Tue Jan 17 2017, 06:25 PM

Online

Guests: 65, Members: 0 ...

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

Members: 37804
Newest member: SAUnwin
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Mar 25 2017, 09:49 PM
I have attached code showing one method you could ...
Deepakvaishu Avatar
Posted By Deepakvaishu
Sat Mar 25 2017, 07:59 AM
I am using Keil and 8051 microcontroller
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Mar 24 2017, 06:05 PM
The best way is to use an interrupt to run the cou...
Deepakvaishu Avatar
Posted By Deepakvaishu
Fri Mar 24 2017, 05:22 AM
Hi,I got that we should use timer......But I am a ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Mar 23 2017, 09:14 PM
You have largely answered your own question.Use on...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Mar 23 2017, 07:03 AM
I have looked at your code.I think you are confuse...
Deepakvaishu Avatar
Posted By Deepakvaishu
Thu Mar 23 2017, 05:34 AM
hello,I can type the letters now when the particul...
SAUnwin Avatar
Posted By SAUnwin
Tue Mar 21 2017, 02:55 PM
HI,There are two ways I'd tackle thiss.Key down on...
Deepakvaishu Avatar
Posted By Deepakvaishu
Mon Mar 20 2017, 08:24 AM
hello,I am using a keypad to type the text message...
Helia Avatar
Posted By Helia
Thu Mar 16 2017, 09:15 AM
hi.. the following code is not working on hardware...