| ??? 10/08/11 02:30 Read: 216 times |
#184138 - While analysing the problem Responding to: ???'s previous message |
Hi,
Here I am analysing the problems which I find while studying the code which will result in not getting the desired speed. The main problem is you are not restricting R4 in between 0 to 6.because you assign the speed only from 0 to 6 of R4.Then how will it work for another value. So first restrict the value of R4. The other reason is you write clause for r4 = 3,r4 = 5,r4 = 6 in increment button & r4 = 0,r4 = 1 & r4 = 2 in decrement button.But when you increment the r4 from 3 to 6 and now press decrement then the value of r4 = 5.So the speed for r4 = 5 would also reflects in decrement routine too.same way r4 = 0,r4= 1 sholud also reflects in increment too. See the following code of delay
NOR_DEL:
MOV R0,#0FFH
m1:
MOV R1,#0FFH
INLOP:
MOV R2,#01H
m2: DJNZ R2,m2
DJNZ R1,INLOP
DJNZ R0,m1
RET
In this code the value of speed loaded as r0,#0ffh.So your speed,you decide by pressing inc. & dec,. button will become null & void after furnishing one time only & then it will work on the original speed.For avoiding these situatioan you should use register for that. Your code shoude be
NOR_DEL:
MOV R0,dly1
m1:
MOV R1,dly2
INLOP:
MOV R2,#01H
m2: DJNZ R2,m2
DJNZ R1,INLOP
DJNZ R0,m1
RET
define dly1 & dly2 in the beggining & load the value in dly1 & dly2 while pressing the Increment & decrement button. Your processor would become also hang because of the following code
NXT5: CJNE R4,#00H, NXT5
MOV R0,#0FFH ;Speed---
AJMP NXT5
if R4 is not equl to zero while you press decrment the down key the controller stuck on NXT5: label.isn't the case ? So first consider all these points in this code for getting the desired speed. Regards Maunik |
| Topic | Author | Date |
| Speed control of running adancing LEDs | Rajesh Kumar | 10/07/11 05:14 |
| Duplicate Posting | Michael Karas | 10/07/11 06:56 |
| This is just an inadequately understood homework problem | Richard Erlacher | 10/07/11 09:51 |
| Design your code, make it pretty. | David Prentice | 10/07/11 07:02 |
| RE: please suggest some idea | Andy Neil | 10/07/11 07:15 |
| I totally agree with ANDY | Erik Malund | 10/07/11 08:12 |
| Very unhelpful comments | Per Westermark | 10/07/11 09:19 |
| Thank you sir | Rajesh Kumar | 10/08/11 02:00 |
| While analysing the problem | Maunik Choksi | 10/08/11 02:30 |
| Translation into assembler task of programmer. | Per Westermark | 10/08/11 03:20 |
| 'subb' instruction | Stefan KAnev | 10/08/11 11:53 |
| Yes, debounce is definitely good to have. | Per Westermark | 10/08/11 12:11 |
| Got Success ! | Rajesh Kumar | 10/10/11 01:16 |
| What is the final code? | David Prentice | 10/10/11 04:21 |
| homework is done.. | Stefan KAnev | 10/10/11 05:11 |
| Surely not secret, at least for my seniors | Rajesh Kumar | 10/10/11 05:39 |
| Teacher will know | Andy Neil | 10/10/11 05:40 |
| Don't worry | Rajesh Kumar | 10/10/11 05:49 |
| What code? | Andy Neil | 10/10/11 06:15 |
| You must show your effort. | David Prentice | 10/10/11 07:09 |
| yes, it's another "gimmee", yet nobody sees it | Richard Erlacher | 10/10/11 07:22 |
| what's the problem | Erik Malund | 10/10/11 08:03 |
| Why ever source current for driving LEDs? | Per Westermark | 10/10/11 08:15 |
| true enough, but is that what he did? | Richard Erlacher | 10/10/11 22:23 |
| I think everybody saw that? | Andy Neil | 10/10/11 08:03 |
| Cleverness | Per Westermark | 10/10/11 08:17 |
| Stange ! | Rajesh Kumar | 10/10/11 11:29 |
| because it is | Erik Malund | 10/10/11 12:48 |
| Yes, often very obvious when copied code turned in | Per Westermark | 10/10/11 13:02 |
| I agree with Andy | David Prentice | 10/10/11 08:24 |
| the key word is 'help' | Erik Malund | 10/10/11 08:35 |
| May not be an achievement for you | Rajesh Kumar | 10/10/11 11:08 |
| So ... where's the evidence of your struggle? | Richard Erlacher | 10/10/11 22:31 |
| problem can be outside | Stefan KAnev | 10/10/11 11:12 |
| This is certainly correct! | Richard Erlacher | 10/10/11 22:29 |
About sinciarity | Maunik Choksi | 10/11/11 02:58 |



