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

Tue Sep 19 2017, 08:36 PM
Ted
In a missing pulse detector using a 555 timer connected as a monostable vibrator with a PNP transistor,how does the positve input pulse turn on the PNP transistor?
Sun Sep 03 2017, 10:29 AM
martymarty
How do I connect an <NOKIA 1100 LCD > to an atmega328P ?
poojab51296
Sun Aug 20 2017, 06:23 AM
i am intending to interface sd card with STM32F4 and want to write a file in sd card using SPI protocol but using HAL only. Can anyone help me PLEASE!!!!
poojab51296
Sun Aug 20 2017, 06:22 AM
hello
rawat742
Fri Aug 18 2017, 07:37 AM
hi @ angel patel i will attach a file i hope it will be helpfull for you
ExperimenterUK
Mon Aug 14 2017, 05:57 PM
@ angel patel... just log in and post your problem
Mon Aug 14 2017, 09:45 AM
angel patel
hey any one help to make the led scrolling display
desuza6
Sat Jul 29 2017, 03:09 AM
I see the code for step motor h l 298 to rotate 45 degree, but all delay time, if I want to input sensor to h the pulses to stepmotor
rammichael
Thu Jul 27 2017, 08:05 AM
okay fine
ExperimenterUK
Wed Jul 26 2017, 03:51 PM
Please post questions in the forum, the chat box is for chat

Downloads

Comments

butt_butt
Fri Sep 08 2017, 02:58 PM
RKTJ
Fri Sep 08 2017, 01:55 PM
ahmed2016
Thu Sep 07 2017, 05:55 AM
Johnleonarduc
Sat Sep 02 2017, 01:48 AM
Suseethra
Fri Sep 01 2017, 06:31 AM
ashokreddy424
Sat Aug 26 2017, 04:02 PM
abdullah6484
Tue Aug 22 2017, 10:21 PM
crank.tp
Mon Aug 21 2017, 02:17 PM

Online

Guests: 75, Members: 0 ...

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

Members: 37888
Newest member: butt_butt
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Sep 11 2017, 12:07 AM
The hardware for connecting to a PC or a modem is...
Suseethra Avatar
Posted By Suseethra
Sat Sep 09 2017, 09:43 AM
Hi,we are doing the same project(LED scrolling dis...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Aug 28 2017, 07:21 PM
First you have to decide which version of the 8051...
rawat742 Avatar
Posted By rawat742
Sat Aug 26 2017, 12:36 PM
Dear Sir, I want to purchase progra...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Aug 25 2017, 08:22 PM
Debuggers and programmers are different things.Whi...
rawat742 Avatar
Posted By rawat742
Thu Aug 24 2017, 04:30 PM
Dear Sir, if I am not purchase debugger then how ...
poojab51296 Avatar
Posted By poojab51296
Thu Aug 24 2017, 06:27 AM
I am using STM32 cube MX and Atollic truestudio so...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Aug 23 2017, 01:30 PM
It will be easier to help if you can post the comp...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Aug 23 2017, 01:24 PM
There is a company in china which makes 8051 micro...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Aug 23 2017, 01:19 PM
Which library or driver are you using for SD card ...