Am I reading this assembler correctly?


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77

    Unhappy Am I reading this assembler correctly?

    Hi All,

    I am still struggling with my stepper motor driving itīs PBL3717's.
    I have a program from another guy written in assembler which works great, it rotates very slowly and also smoothly. I copied the sequence and my version seems to always be rough and bumpy movements (using the same PCB controller)
    The letters I0 & I1 are the current settings for A and B coils respectively.
    They are set as follows:
    I0 high I1 high = No current
    I0 Low I1 high = Low current
    I0 High I1 Low = Medium Current
    I0 Low I1 Low = High Current (full power 400mA)

    I have attached the assembler version and my PBP version, If anyone is good with assembler could you please check it for me.

    Best Regards

    Chris
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Chris,

    I think each step has the same problem ...
    Code:
    '* step 1*
    A=1
    I0A=0
    I1A=1
    B=1  
    I0A=0 ; should be I0B
    I1B=0
    PAUSEUS TIME
    DT

  3. #3
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Cool Assembler reading

    Thanks Darrel,

    Yes that was an error but even after correcting that it still is moving "jumpily"
    Has that guy got some secret I don't know about?



    Regards

    Chris

  4. #4
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Question Assembler has a small header routine

    I revised the assembler and found that it has an additional routine above.
    My spanish is not great but can you figure out how it modifies the stepping?

    Regards

    Chris

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Step 12 seems to be different between the two versions. (I1B)

    Other than that, it would help to see the rest of the ASM program, so I can see in which order the subroutines are called.
    <br>
    DT

  6. #6
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Unhappy I cannot seem to read the assembler correctly

    You have for a long time been an inspiration to me on how you can interctively work with assembler and PBP. Your Instant interrupts are a great result of that.

    Thanks for checking out the code I posted, I changed the I0B's of my code but the motor continued with a jerky movement when running slowly. The project is a X-Y yoke for a CCTV camera using 2 bi-polar stepper motors. The person who designed the original camera has long since dissapeard and I need to add some new features. My problem is that assembler is worse than trying to read Chinese for me.
    His version rotates slowly as smooth a silk but when I program that same PIC with my version in PBP it looks like a tractor idling. I read the datasheet of the PBL3717 and I think I have written it correctly. (I cannot change to another chip as the PCB and components have been purchased)
    He definately wrote all movements to run in quarter step mode.I have attached his full code (The slave code is the second pic which just checks a parrallel bus to see what movements it must make) and my modified code that I tried on friday.

    Best Regards

    Christopher Rhomberg
    Attached Files Attached Files

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Thanks Chris,

    Isn't it great that you can jump in and out of ASM at will?
    The most powerfull feature of PBP.

    It looks like Step 12 is still the same.
    Maybe it just didn't get changed in the attached file, but I want to make sure you've tried it.
    <table border=1 cellpadding=8><tr><td align=center>ASM</td><td align=center>PBP</td></tr><tr><td valign=top><pre>paso_12h:<br> bsf PORTB,0<br> bsf PORTB,1<br> bcf PORTB,2<br> bcf PORTB,3<br> bcf PORTB,4<br> bcf PORTB,5<br> movlw 11<br> movwf paso_h<br> call retardo_velocidad<br> return</pre></td><td valign=top><pre>'* step 12*<br>A=1<br>I0A=1<br>I1A=0<br>B=0 <br>I0b=0<br>I1B=1 ; should be 0<br>PAUSEUS TIME</pre>
    </td></tr></table>

    Looking at the rest in the mean time.
    DT

  8. #8
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Wink Thanks Darrel

    Really Darrel, You always seem to spot the errors quick.

    Like usual I didn't see that small error in step 12, even though you mentioned it.
    Now it is rotating very smoothly.
    If you have any other nasties you can see in that code please tell me.


    ManyThanks

    Chris

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by crhomberg View Post
    Really Darrel, You always seem to spot the errors quick.
    It's a Curse, really.

    I can spot things in other peoples programs like it's got a blinking red light on it.
    But in my own programs, it can take weeks to find a simple bug.

    er - ok well I think it works that way for everyone. I just never ask for help.

    If you have any other nasties you can see in that code please tell me.
    Well, if it's turning smoothly then I think the "Nasties" are gone. But I might be able to make some new ones for you.

    Sorry, my other curse is the need to reduce redundant code (RRC).
    So here's my idea.
    Code:
    Qstep  VAR BYTE
    Coils  VAR BYTE
    
    StepForward:
        Qstep = Qstep + 1
        IF Qstep >= 16 THEN Qstep = 0
        GOTO DoStep
    
    StepReverse:
        IF Qstep = 0 then Qstep = 16
        Qstep = Qstep - 1
          
    DoStep:
        LOOKUP Qstep,[%001101,%001111,%001100,%001010,%101000,%111000,%100000,%010000 _
                     ,%000100,%000110,%000101,%000011,%100001,%110001,%101001,%011001], Coils
        PORTB = (PORTB & %11000000) | Coils
        PAUSEUS TIME
    RETURN
    Completely un-tested.
    Last edited by Darrel Taylor; - 13th November 2007 at 05:50. Reason: Reverse is a reserved word. DOH!
    DT

  10. #10
    Join Date
    Apr 2007
    Location
    Santiago, Chile
    Posts
    77


    Did you find this post helpful? Yes | No

    Talking Thanks Darrel

    Very neat Darrel, very neat!
    Why donīt you ask when you have problems, even the best professionals can be helped by a second set of eyes to check the design.

    Again,

    Thank you very much

    Chris Rhomberg

Similar Threads

  1. Reading temperature using multi DS18B20
    By KVLV in forum Code Examples
    Replies: 16
    Last Post: - 3rd November 2017, 19:48
  2. PIC assembler forum?
    By Lajko in forum Off Topic
    Replies: 1
    Last Post: - 29th September 2008, 05:34
  3. Assembler problem
    By om3bc in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th March 2008, 19:12
  4. Pot reading jumping like crazy!!!
    By champion in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 20th November 2006, 21:24
  5. Which assembler are you using?
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st November 2005, 20:34

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts