Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/08/11 08:30
Read: 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


List of 36 messages in thread
TopicAuthorDate
Speed control of running adancing LEDs            01/01/70 00:00      
   Duplicate Posting            01/01/70 00:00      
      This is just an inadequately understood homework problem            01/01/70 00:00      
   Design your code, make it pretty.            01/01/70 00:00      
   RE: please suggest some idea            01/01/70 00:00      
      I totally agree with ANDY            01/01/70 00:00      
         Very unhelpful comments            01/01/70 00:00      
            Thank you sir            01/01/70 00:00      
               While analysing the problem            01/01/70 00:00      
               Translation into assembler task of programmer.            01/01/70 00:00      
   'subb' instruction            01/01/70 00:00      
      Yes, debounce is definitely good to have.            01/01/70 00:00      
         Got Success !            01/01/70 00:00      
            What is the final code?            01/01/70 00:00      
               homework is done..            01/01/70 00:00      
               Surely not secret, at least for my seniors            01/01/70 00:00      
               Teacher will know            01/01/70 00:00      
                  Don't worry            01/01/70 00:00      
                     What code?            01/01/70 00:00      
                     You must show your effort.            01/01/70 00:00      
                        yes, it's another "gimmee", yet nobody sees it            01/01/70 00:00      
                           what's the problem            01/01/70 00:00      
                              Why ever source current for driving LEDs?            01/01/70 00:00      
                              true enough, but is that what he did?            01/01/70 00:00      
                           I think everybody saw that?            01/01/70 00:00      
                              Cleverness            01/01/70 00:00      
                                 Stange !            01/01/70 00:00      
                                    because it is            01/01/70 00:00      
                                    Yes, often very obvious when copied code turned in            01/01/70 00:00      
                              I agree with Andy            01/01/70 00:00      
                                 the key word is 'help'            01/01/70 00:00      
                                    May not be an achievement for you            01/01/70 00:00      
                                       So ... where's the evidence of your struggle?            01/01/70 00:00      
                                    problem can be outside            01/01/70 00:00      
                                    This is certainly correct!            01/01/70 00:00      
   About sinciarity            01/01/70 00:00      

Back to Subject List