Programming Texmate Meters - FAQ

  1. Apps

    1. What are apps?

    2. Can I use both apps and the standard configuration utility?

    3. For which applications do I have to use an app?

    4. How difficult is it to write an app?

    5. When should I use the configuration utility instead of an app?

  2. Display control

    1. How can I get a faster display update?

  3. Buttons

    1. Can I get rid of the builtin user interface?

  4. LEDs and Setpoints

  5. Function pins (HOLD, LOCK, CAPTURE)

    1. Can you turn off the basic functionality of the HOLD and LOCK pin?

  6. Printing

    1. Is there a way to determine when a PRINT is complete?

  7. Logging

  8. Passwords

    1. How can I include a password protection for the front panel setup capabilities?

  9. BASIC programming

    1. What is a state machine?

    2. How can I enter and store characters/strings?

    3. 'out of integer variable space' - what can I do?

    4. How can I store 32bit values in user memory?

    5. How can I make permanent changes to setup registers (Code1-10, setpoints...)


  1. Apps

    1. What are apps?

      Apps are an extension for our meter programmability. In addition to the preprogrammed features (e.g. calibration or setpoint logic) they can be used for customized operations like text output, switching between different modes of operation, or an application specific user interface.

    2. Can I use both apps and the standard configuration utility?

      Yes, as they both change the same internal registers. In fact we suggest to use them together, storing the corresponding configuration file together with your apps.

      When you save a configuration in the utility existing apps will be stored, too. But you still need your BASIC source code if you want to make changes later on.

    3. For which applications do I have to use an app?

      • using Function buttons (except as logging trigger)

      • complex calculations (other than the predefined ones for CH1 and RESULT)

      • text output on display

      • automated changes of meter programming

      • customized user interface

      • extended serial output (e.g. printer output including a headline)

      • using EEPROM for storage of arbitrary data

    4. How difficult is it to write an app?

      This depends on your previous programming knowledge as well as on the complexity of your application. We decided to use BASIC as a programming language because it is rather simple and thus easy to grasp - especially if you never learned a programming language before. So probably the language won't give you many   headaches.

      However, you have to be familiar with the meters registers you are using in your application - whether you use the configuration utility or a macro. But for most application issues you will find a section in our BASIC tutorial, for some standard features we provide you with sample apps and finally you will find detailed information in our Register Supplement. In fact, you might end up adding more and more features to your application as most times the basic functionality is implemented in only a few lines of code.

    5. When should I use the configuration utility instead of apps?

      As a basic rule: use the configuration utility as far as possible.

      In most cases the user of the meter won't have direct access to its programming. So most settings (like the format and the source of the displayed data or the logging settings) will not change and are therefore more appropriately set with the configuration utility.

      Using the built-in user interface (view mode for different data display, setpoint setup capabilities) you can already achieve what you need for many applications.


  2. Display control

    1. How can I get a faster display update?

      To get a display update every MAIN_MACRO loop set the second digit of CODE1 to X2X (e.g. &CODE1 = 0020). The number of macro loops per second is set with the first digit of CODE2 (output rate).

  3. Buttons

    1. Can I get rid of the builtin user interface?

      Yes. Simply turn the serial switch register over to remote mode: &SWITCHES = 0x8000.

      As many applications need at least access to the calibration menu, we recommend to leave the meter at startup in normal mode or to provide other means to switch back to normal mode, though.

      Please note that the standard function button macros won't work in remote mode.

  4. LEDs and Setpoints

    Usually the LEDs are used to indicate the relay status which is controlled by the setpoint logic. If you want direct control over a LED from a macro you have to set the corresponding remote flag either setting the bit register to ON/OFF (not NORMAL) or directly accessing the &ANNUNCIATORS register. If you want to return the control to the setpoints set the bit register to NORMAL or use the &ANNUNCIATORS register.

    In the same fashion the setpoints can be controlled directly by the macro, the actual control register here is &ALARM_STATUS.

    You can also directly switch the relays using &RELAY_STATUS. In this case you should turn off the corresponding setpoints as they may overwrite your own settings. There is no remote mode for the relays as they reflect the actual output.

    See also LEDs.bas in our samples section.

  5. Function pins (HOLD, LOCK, CAPTURE)

    1. Can you turn off the basic functionality of the HOLD and LOCK pin?

      No, even if they are only used by a macro and are not connected to any output at all. You can only choose a function that does not interfere with your application (e.g. reset totalizers) by changing CODE9 settings.

      As the DISPLAY pin always resets the meter it cannot be used directly from a macro, only by implenting a RESET_MACRO.

      The only pin without inherent function is the CAPTURE pin.

  6. Printing

    1. Is there a way to determine when a PRINT is complete?

      Currently not. But starting with meter version 3.02q subsequent PRINT commands will succeed as long as the print buffer (100 characters) has space left. Print commands longer than 100 chars have to be split into packets which are sent in different macro loops (e.g. using a state machine).

  7. Logging

    See also Logging.bas in our samples section.

  8. Passwords

    1. How can I include a password protection for the front panel setup capabilities?

      You have to extend your edit macro. A simple solution is to use one or a combination of numbers which have to match some predefined value (either constant or user memory variable). If you use more than one number the password check should be performed after all numbers have been entered. Therefore you have to store the input temporarily. As this is not to happen very often, this could be done in user memory, too.

      The somewhat more complex solution is to use alphanumerical input as password (i.e. a password string). With this you store only the index of the string array instead of the actual ASCII value for each character. So the password check will only compare the indeces. See also below.

      See also DeviceNumber.bas in our samples section.

  9. BASIC programming

    1. What is a state machine?

      A state machine resembles an abstract view of an operating machine. This machine has a well defined number of operating states (e.g. waiting, initializing, op_mode1, op_mode2, resetting) and only one current state.

      As Texmate meters are actual machines this abstract construct is often used especially as the number of operations in a macro are restricted by the maximum time for a single macro loop (even if further development will soften this restriction it has still to be considered).

      Typically state machines are implemented using a user defined integer variable which has to be tested by the 'state machine'. The best way to do this is:

      • define constant values for each state

      • define and initialize a state variable in the reset macro

      • use a select statement in the main macro to switch the handling accordingly

      See also StateMachine.bas in our samples section.

      State machines are not only useful for the main macro. For example in edit mode if you press the program button the predefined &STATE variable is always set to a non-zero value (default 1 if it is not set by the user). As soon as you want to edit more than one value you are actually forced to build a state machine in the edit macro.

    2. How can I enter and store characters/strings?

      As described in the BASIC tutorial you can use Text String Arrays together with an EDIT_MACRO to select a string from a list. You can then store the index of this list entry for example in USER_MEMORY.

      This feature can also be used to enter arbitrary strings if you define a text string array containing all characters you want to be able to enter - each as a single string - and storing the indeces for each character.

      See also DeviceNumber.bas in our samples section.

    3. 'out of integer variable space' - what can I do?

      The meter provides only a restricted number of variables (currently 10 integer, 8 floating point stored in &VARIABLE1 to &VARIABLE18). If you run out of variables you will have to review your program. Here are some hints where to look at:

      • Do you use several variables only for boolean values?

        Starting with compiler version 1.1.19 up to 32 user defined bit variables are available sharing one integer variable register. Simply prefix the variable name with a '|', e.g. |flag_1.

        In some cases it is more useful to combine the variables into a single state variable and use a state machine.

      • Is a 24bit variable sufficient for some values?

        You can use a floating point variable without data loss. Keep in mind that this will change the output format if you are using the variable together with WRITE/APPEND/PRINT commands.

      • Do you use PEAK, VALLEY, SPAN, ZERO (either in meter setup or macro)?

        If not, you might use these as variables, too. Actually you can use any otherwise unused register but you always have to consider that they may be used for internal operations of the meter and what kind of data they can hold (8/16/24/32 bit, signed or unsigned, integer or float).

      • Do you rarely change some variables using only 16bit?

        You might use USER_MEMORY to store your data. User memory is located in EEPROM with considerably short life time (currently 100,000 writes) and needs more time to access it. So you should NEVER use user memory when you are constantly changing its value. Also keep in mind that user memory can only store 16bit data.

    4. How can I store 32bit values in user memory?

      For an example see RememberCalibration.bas in our samples section.

      Many registers of the meter setup are 32bit (some of the integer registers and all of the floating point registers) whereas the user memory registers are only 16bit signed.

      Obviously you have to use two user memory registers if you want to store a single 32 bit value, one storing the higher 16 bit (shifted 16 bits to the right), one storing the lower 16 bit. To filter out the respective portion bitmasks are used and ANDed with the 32 bit value.

      If you combine the stored portions again you have to consider that the user memory registers are 16 bit signed. You cannot simply add the higher 16 bit (shifted back 16 bits to the left) and the lower 16 bits. The calculation uses 32 bit values. If the lower portion is negative (bit 15 = 1) the expansion to 32 bit will set bits 16-31 to 1, too, corrupting the intended result. To avoid this you have to AND the lower portion with the bitmask.

      Floating point registers can be stored in the same way. But if you combine the stored values as described above you will end up with an integer value. For this problem a special variable register is provided that allows you to view its bits either as integer or as floating point value: VARIABLE_A_INT/VARIABLE_A_FP. So if you restore a floating point value you simply combine the value as before but store it in VARIABLE_A_INT. Now you only have to copy VARIABLE_A_FP into your floating point register.

    5. How can I make permanent changes to setup registers (Code1-10, setpoints...)

      Any changes to a register other then USER_MEMORY are only made in RAM, so after reset these changes are gone. Since nearly all registers are relevant to the meter setup they are also stored in a non-volatile memory. After reset those non-volatile values are restored. Examples for purely volatile registers are the channel data registers, peak, valley, and tare, and of course the variable registers.

      To store a value both in RAM and in non-volatile memory you only have to set the flag |NON_VOLATILE_WRITE = ON. This will affect only the following register assignment as the flag is automatically reset afterwards.

      For an example see Logging.bas or RememberCalibration.bas in our samples section.

App Documentation