Discussion in "Project Doubts" started by    sankalp_s    Nov 29, 2014.
Sat Dec 27 2014, 03:59 PM
#21
Dear Phil 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 help me for the code?
thank u for your cooperation..
Sun Dec 28 2014, 05:34 AM
#22
you need to remove jump statements from main program codes. only the design loop should remain. rest you can do something like this...
;You main loop will be like this..
main:
JB P3.3, program2
;Put program 3 code here
program2:
JB P3.2, program1
;Put program 2 code here
sjmp main
program1:
;Put program 1 code here
sjmp main
 sankalp_s like this.
Fri Jan 30 2015, 05:40 PM
#23


you need to remove jump statements from main program codes. only the design loop should remain. rest you can do something like this...

;You main loop will be like this..
main:
JB P3.3, program2
;Put program 3 code here
program2:
JB P3.2, program1
;Put program 2 code here
sjmp main
program1:
;Put program 1 code here
sjmp main

ajay_bhargav



THANK U SIR FOR UR REPLY,

Dear sir i want to put five design in program 1, five design in program 2 & five design in program 3,
then how will be program structure & loop structure
Each program would be selected by switch.

"you need to remove jump statements from main program codes. only the design loop should remain" Sir could u please explain this line with my code.

thank u..
Wed Feb 04 2015, 05:45 AM
#24
refer to updated code @http://www.8051projects.net/forum-t64188-10.html#post_64249
Its hard to explain everything line by line. You need to understand the logic first.
Mon Feb 16 2015, 08:33 PM
#25
Dear sir facing error.... for jb and sjmp..
"Label is too far for 8-bit relative addressing."
Mon Feb 16 2015, 10:27 PM
#26


Dear sir facing error.... for jb and sjmp..
"Label is too far for 8-bit relative addressing."

sankalp_s


jb and sjmp can only jump to within 127 bytes of code,
so you will get problems if your design is poor.
For sjmp you can just use jmp instead.
For jb, jnb etc, you will need to change the program layout.
Post your latest code so we can see where you are up to.
 sankalp_s like this.
Tue Feb 17 2015, 11:48 PM
#27


Sir i'm doing this, code is given below..
now there i no any error but JB instructions are not working.
only progrm one starts.

sankalp_s


Hi sankalp_s, because of your program text
your last post was hard to handle.
I have removed it, and re-posted the contents here.
For larger program it is better to Zip and attach them.





Wed Feb 18 2015, 12:57 AM
#28
I have changed your code to make it's operation clearer
and to remove all long branches.
I have not compiled it, so there could be minor errors.
MAIN:

testButton1:
                jb P3.3,testButton2
                call program0  ;Run this segment if button pressed
                sjmp testButton1  ;done

testButton2:
                jb P3.4,default
                call program2  ;Run this segment if button pressed
                sjmp testButton1

default:  
                call program1  ;Run this segment if no buttons pressed
                sjmp testButton1


Your "DELAY: " code gives very little delay and tests the buttons
what does it do ?




[ Edited Wed Feb 18 2015, 01:30 AM ]
 sankalp_s like this.
Wed Feb 18 2015, 06:51 AM
#29
Thank you Dear experimenteruk sir.. its working after completion of all design of running program. what can we do for instant change of program..please suggest.

"Your "DELAY: " code gives very little delay and tests the buttons
what does it do ?"...... actually sir i'm using 555 timer for delay..

sir any alternate option for making mirror effect actually the code i'm using for mirroring is taking much space.


[ Edited Wed Feb 18 2015, 03:27 PM ]
Wed Feb 18 2015, 09:23 PM
#30


sir any alternate option for making mirror effect actually the code i'm using for mirroring is taking much space.

sankalp_s


What is mirroring ?


Thank you Dear experimenteruk sir.. its working after completion of all design of running program. what can we do for instant change of program..please suggest.

sankalp_s


This code should do it.
It makes the "DELAY: " routine return to the main loop.
Remember it works here because "DELAY: " is always
3 calls away from the main loop.
This method is not usually a safe method.
popByte  equ 0x40  ;dump stack here ; (add to top of program)

DELAY: 
JNB P3.2,FULL
JB P3.1,$
JNB P3.2,FULL
JNB P3.1,$
JNB P3.2,FULL
RET
;************************************************* ***********************************************
; ROUTINE FOR BREAK
;************************************************* ***********************************************

FULL: MOV P1,#11000000B
JNB P3.2,$
MOV P1,#11111111B
pop popByte ;dump return address
pop popByte ;dump return address
pop popByte ;dump return address
pop popByte ;dump return address
RET



[ Edited Wed Feb 18 2015, 09:26 PM ]

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: 30, 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 ...