Shop OBEX P1 Docs P2 Docs Learn Events
Assembly program does not run at power on — Parallax Forums

Assembly program does not run at power on

Brian218Brian218 Posts: 92
edited 2009-01-25 22:16 in General Discussion
I'm just starting to learn assembly and I'm puzzled by an apparent difference between SX/B and assembly.
I'm using the PDB ans SX-Key.

With a SX/B program, after downloading/running, it stays in the SX chip's memory and will start running if the power is turned off and then turned back on.

When I run the attached program, it runs as expected until the power is turned off and then turned on. After the power is turned back on, it does not run.

Is this normal?
How would I get it to start running at power-on?

The program is a simple program that increments RB.

Thanks in advance!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
This post is a work of art. Variations in spelling and grammar are intentional, artistic endeavors that add value to all of mankind.

Comments

  • Mark HubersMark Hubers Posts: 19
    edited 2009-01-25 19:00
    Hi Brian,
    Do you still have the SX-Key plug in when you reboot it? You must remove the SX-Key if you want to run on it own from a reboot.

    Mark
  • Brian218Brian218 Posts: 92
    edited 2009-01-25 19:31
    Thanks Mark,

    I tried unplugging the SX-Key and it still will not run at power on. Any other ideas?

    SX/B programs will run at power-on with or without the SX-Key being plugged in.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    This post is a work of art. Variations in spelling and grammar are intentional, artistic endeavors that add value to all of mankind.
  • Mark HubersMark Hubers Posts: 19
    edited 2009-01-25 20:03
    Looking at your code does look fine to me. Do you have a 4 MHz resonator installed? How are you using the RB's ports? Do you have LEDs on them? If you have LEDs then you may not see anything as they are flashing so fast you cannot see it. If you have a LED on RB.0 you will not see anything because it just to fast for anything to show up on the LED. Even a LED on RB.7 maybe still to fast to see anything. If you have a scope on the ports you should see something then. My 2 cents. [noparse];)[/noparse]
  • Brian218Brian218 Posts: 92
    edited 2009-01-25 20:28
    Thanks Mark,

    I don't have a 4 MHz XTAL, but I just went to the device selection (under the run header) and changed the Oscillator to "4 MHz internal" and loaded the program; that seems to fix the problem, so your thought about the resonator appears to be correct.

    I have all RB pins connected to LEDs; it runs way to fast to see the individual LEDs blink on/off, but since the program loops continually, all LEDs appear on.

    Thanks again, I appreciate your suggestions
    B-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    This post is a work of art. Variations in spelling and grammar are intentional, artistic endeavors that add value to all of mankind.
  • ZootZoot Posts: 2,227
    edited 2009-01-25 21:49
    The reason your original .src file did not run is because of your device line settings:

        DEVICE  SX28, TURBO, STACKX, OSCHS2  ; oschs2 here tells the sx to look for a 20-50mhz clock source on osc1/osc2
        IRC_CAL IRC_FAST
        FREQ    4_000_000  ; this is a "convenience" -- what the clock does is what the sx will do when running "standalone"
                                         ; i.e. this doesn't actually affect how the clock interacts with the sx
    
    



    The run->device menus will do the same thing (change the fuse bits), but here is what you would do to run your .src program without the Key and without an external clock:


        DEVICE  SX28, TURBO, STACKX, OSC4MHZ  ; use internal 4mhz oscillator
        IRC_CAL IRC_4MHZ ; tune internal oscillator get as close to 4mhz as possible
        FREQ    4_000_000  
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 1/25/2009 10:59:40 PM GMT
  • Brian218Brian218 Posts: 92
    edited 2009-01-25 22:16
    Thanks for the explaination and code suggestion Zoot.
    As always I'm thankful for the help!

    B-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    This post is a work of art. Variations in spelling and grammar are intentional, artistic endeavors that add value to all of mankind.
Sign In or Register to comment.