Home AMX User Forum NetLinx Studio
Options

Storing Variables During Upload

Greetings,

Does anyone have a good way of storing variable values while uploading code to a Netlinx system?

In this case I have a residential system in which I have given the client many things that they can preset; lighting levels, TV channels, etc. I would like to find a way to not lose those user values after re-uploading code.

I beleive I once saw a Netlinx system in which there was an AXB-EM working as a data storage device.

Any suggestions?

Thank you.

Comments

  • Options
    Joe HebertJoe Hebert Posts: 2,159
    Does anyone have a good way of storing variable values while uploading code to a Netlinx system?
    You can use PERSISTANT variables or you can save your data by writing to the flash drive.
  • Options
    DHawthorneDHawthorne Posts: 4,584
    I use PERSISTENT all the time for this - you just have to keep an eye on non-volatile memory use for larger projects. It helps to explicity declare your other variables as VOLATILE to conserve the memory space. If you run out of non-volatile memory, your master will simply lock up solid.
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    I used to use persistent variables all of the time for that, but recently I switched to storing the info in files for items like favorite channels. I did this with the intention of being able to edit the favorites externally or using a stock file and just putting the file on the master. I am moving this direction to allow others at my company the ability to change settings and options without having to edit the code.

    Jeff
  • Options
    Could you please give me a $.50 explanation of how to go about storing data in external files? That is new to me.

    Thank you.
  • Options
    Storing Variables During Upload

    Netlinx has a large set of file based I/O operations that allow you to create, open, read, write, append, close, delete, search etc. files that are located on the Master's compact flash file system. Check out the Netlinx help file for more information on FILE_OPEN() which is used to create a new file or open an existing file, FILE_READ() to obtain data from a file, FILE_WRITE() to write data to a file, and FILE_CLOSE() to release the handle for a file. There are versions of the read and write commands designed to operate on lines terminated by CR or CR/LF pairs. Operations to create and search directory hierarchies in the file system are also supported.

    You will have to determine the structure of your data that will reside in the file so that your Netlinx program can make sense of it when it is read back in. You can keep separate files for different types of persistent data or you can create a complex structure that organizes all of the persistent data for your program and maintains it all in one file. The structure or organization of the data on the CF is entirely up to you - Netlinx does not impose any restrictions on it (other than limitations on maximum file size which will depend on the specific CF capacity in use of course).
Sign In or Register to comment.