A Trio BASIC Function Library for calculating min, max and average

A Trio BASIC Function Library for calculating min, max and average

The attached library has 10 functions;

result = compare_2(v1, v2)
preset_max(index, value)
preset_min(index, value)
compare_max(index, value)
compare_min(index, value)
value = read_max_register(index)
value = read_min_register(index)
And for the TABLE memory:
max_value = check_table_max(first, last, seed_value)
min_value = check_table_min(first, last, seed_value)
average_value = get_table_average(first, last)
    • Related Articles

    • Set and Clear bits in TABLE values (Function)

      Here are 2 functions to set and clear a bit in a given TABLE value. ' functions to set and clear bits in TABLE FUNCTION set_table_bit(index, bit AS INTEGER)   DIM pattern AS INTEGER   pattern = 1 << bit   TABLE(index, TABLE(index) OR pattern) ENDFUNC ...
    • Timed ramps and dwells - a FUNCTION example

      Functions to make timed position ramps and dwells. For example as might be used in a blow moulding controller. ' Function library to support timed ramps ' 'Declare a universal value to hold the table index DIM tab_index AS INTEGER ' Set up a linear ...
    • Moving CAM CSV/Text File to TABLE or VR's location

      The example attached is a Trio basic program that will extract the numerical values of each text file line and move the values into a TABLE or VR array. The program moves the data from the controllers on board memory but can be adjusted to move data ...
    • How many TABLE values are saved to Flash in the MC6N?

      The default is none (only VRs are stored; FLASH_DATA = 0) However 64000 will be stored when FLASH_DATA is set to 1   See the Trio BASIC help for FLASH_DATA.
    • Trouble with table

      In the MC2xx range of Motion Coordinators, the TABLE is dynamic and the memory shared with the programs. When you first use it, there is no table. TABLE is allocated when it is written tot. You can see the size with TSIZE parameter. If a program ...