Home AMX User Forum AMX General Discussion

Code Processing Sequence During Boot of NX / NI

I am having a problem with code that ran on an NI-3100 running on an NX-3200. I believe it is related to the processing sequence of code during a boot. I thought I understood the order, but maybe I don't. Can some one provide a complete list of when each section is executed?

DEFINE_START in main-program and modules

DEFINE_EVENTS - ONLINE: in main-program and modules
(How do virtual-devices fit in here, both for the local to the NI/NX and for a remote NI/NX)

Comments

  • cmatkincmatkin Posts: 86
    Hi tholt0831,

    There shouldn't be any differences.

    We upgrade NI's to NX's fairly often and the code only requires a few changes with respect to devices depending on model upgrading.

    These do load faster. :)

    Maybe post some code for us to check?
  • AuserAuser Posts: 506
    Check whether the DEVICE HOLDOFF setting on the 3200 is the same as on the 3100(s) you've been running it on too.
  • vincenvincen Posts: 526
    Be careful that traditional DEFINE_START and DEFINE_PROGRAM*are deprecated and should no more be used with NX series ;) In all matters if you program fully in Netlinx these sections should be already empty or removed !
  • Why would you not want to use DEFINE_START?

    I use it to initialize Variables on Boot.

    Do we have a better place to get a Boot Status?
  • ericmedleyericmedley Posts: 4,177
    Why would you not want to use DEFINE_START?

    I use it to initialize Variables on Boot.

    Do we have a better place to get a Boot Status?

    It has to do with under the hood stuff and the way Java is working.

    You can make your own Define_Start like this:
    DEFINE_DEVICE
    
    dv_My_Master = 0:1:0
    
    DEFINE_EVENT
    
    data_event[dv_My_Master]{
      online:{
        // put define_start stuff here.  Now it's an event.
        } // online
      }//D-e
    
  • DHawthorneDHawthorne Posts: 4,584
    vincen wrote: »
    Be careful that traditional DEFINE_START and DEFINE_PROGRAM*are deprecated and should no more be used with NX series ;) In all matters if you program fully in Netlinx these sections should be already empty or removed !

    That's not exactly true. Technically, every DEFINE_FUNCTION and DEFINE_MODULE are part of the DEFINE_START section. If you leave it out, you are going to get a compiler error. DEFINE_PROGRAM, however, you can do without.
  • NZRobNZRob Posts: 70
    Also CREATE BUFFER can only be in the DEFINE_START section otherwise there is a compile error too ( just tried it)
  • ericmedleyericmedley Posts: 4,177
    NZRob wrote: »
    Also CREATE BUFFER can only be in the DEFINE_START section otherwise there is a compile error too ( just tried it)

    Yeah, this knda points to an old AMX credo of never do somethng that breaks old code. We've been doing DEFINE_START for ever. I'm not sure what exactly is the issue with the discussion on define_start with the new NX series and how it interfaces with JAVA under the hood. I do know that using define program on them results in a significant performance hit. Perhaps it's the same issue.

    Define_start has always struck me as odd in regard to what all goes there, like for example, CREATE_BUFFER and why you can't create code with any stack_vars but put the same code in a function or call and call it in DEFNE start and it compiles and works fine. I know it all has to do with the order of the runtime build. But it manifests itself in puzzling ways sometimes.
Sign In or Register to comment.