Home AMX User Forum NetLinx Studio

Locking a master from code

I didn't think it was possible, but I have some code that can lock a master (status light stops flashing). All that it took was an array index error in a timeline. Timelines must get some special priviledge to memory or something?!?
I didn't think you could lock a master from user code but it happens everytime I run this timeline.
Anyone done this before without using a loop or some other repetitive task that keeps the CPU busy? This is a timeline that runs only once and it usually works fine as intended unless the array index is too big and then its locks the master up.
Paul

Comments

  • DHawthorneDHawthorne Posts: 4,584
    Oh there are lots of ways to lock a master with code, and I think I have done them all :) . Overloading the message queue, running out of non-volatile memory, and endless loops are the most common.

    NetLinx is an interpreted language (like Visual Basic), and as such traps most of the kinds of errors that can lock a master; this is what makes it feel like you can't do such a thing most of the time. The thing is though, when stuff does get past the interpreter, the failures tend to be more spectacular. Probably in your case, you found an error the interpreter isn't catching rather than timelines being more privileged or something of that nature.
  • a_riot42a_riot42 Posts: 1,624
    DHawthorne wrote:
    Overloading the message queue, running out of non-volatile memory, and endless loops are the most common.

    I know about those types, while loops, recursive button events, bad code in program section and the like but I have never had one line of code that either locks up or reboots the master. I am going to do an experiment and post the line and see if others get the same behavior. Could come in handy sometime :)
    Paul
  • Just out of curiosity, how do you get them unlocked? I have accidentally locked one up due to putting some bad code in mainline. I took it to the local AMX University and one of the instructors did something with the dip switches, rebooted it, was able to connect via serial, and did CLEAN_DISK or something like that. Luckily he was able to get me out of my jam, but I am not sure what he did.
  • ericmedleyericmedley Posts: 4,177
    Just out of curiosity, how do you get them unlocked? I have accidentally locked one up due to putting some bad code in mainline. I took it to the local AMX University and one of the instructors did something with the dip switches, rebooted it, was able to connect via serial, and did CLEAN_DISK or something like that. Luckily he was able to get me out of my jam, but I am not sure what he did.


    yes,
    setting the 1st dip switch to 'on' on the NI master disables the program currently loaded in the memory. So, what you basically have is an Netlinx master booted up with no program in it. ONce you get to that point, you can go in and erase the old program or reload a new one. After you're done doing that, you reset the dip switch and the loaded program will begin running after reboot.
Sign In or Register to comment.