Shop OBEX P1 Docs P2 Docs Learn Events
Propeller ASM help needed (Got it working) — Parallax Forums

Propeller ASM help needed (Got it working)

BeanBean Posts: 8,129
edited 2006-05-10 00:22 in Propeller 1
Okay I'm trying to blink an LED with assembly.
It will turn on ONE TIME, then turn off and never come on again.
What am I doing wrong ?
Bean.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com


COMING SOON "SD DATA LOGGER" www.sddatalogger.com

"I reject your reality, and substitute my own." Mythbusters


Post Edited (Bean (Hitt Consulting)) : 5/9/2006 11:49:52 PM GMT

Comments

  • SSteveSSteve Posts: 808
    edited 2006-05-09 23:21
    My PropStick hasn't shown up yet, so I can't test anything, but try pasting this much of the program:
                            MOV outa,ONValue                ' Set pin high
                            MOV CntTime,CntDuration         ' Get CntDuration, put in CntTime
                            ADD CntTime,cnt                 ' Add current cnt
                            WAITCNT CntTime,#0              ' Wait awhile                                      
                            MOV outa,OFFValue               ' Set pin low
                            MOV CntTime,CntDuration         ' Get CntDuration, put in CntTime
                            ADD CntTime,cnt                 ' Add current cnt
                            WAITCNT CntTime,#0              ' Wait awhile
    


    right before the JMP statement. That way you'll at least have an idea of which part of the program is failing, the loop or turning the LED back on. If the LED goes on and off twice it's the loop. If it goes on and off once it's a problem turning the LED back on.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows
  • BeanBean Posts: 8,129
    edited 2006-05-09 23:24
    Steve,
    · Excellent idea.
    · I tried it and it blinks twice. So why doesn't "JMP :again" seem to be working ???
    · I tried it without the leading ":" and it doesn't work that way either.

    Edit: Found it!!! I needed to use "JMP #:again"

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters


    Post Edited (Bean (Hitt Consulting)) : 5/9/2006 11:27:23 PM GMT
  • SSteveSSteve Posts: 808
    edited 2006-05-09 23:29
    Should it be "JMP again" instead of "JMP :again"? I'm trying to track down some Propeller asm code to see an example.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows
  • SSteveSSteve Posts: 808
    edited 2006-05-09 23:33
    Here you go: try "JMP #:again". I found it in some example code by Jon.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-10 00:22
    If you look at·the attached program you can see that the waitcnt instruction lets you add the span value automatically, saving you a few lines of code.· And let me clarify that this code was written by Chip, not me.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.