ABB Motion Login Contact Us  

MINT - Hints and Tips


  • Arrays can be initialised with a comma separated list of numbers, and the last value can be repeated using a trailing semi-colon, e.g. "Dim x(20) as Integer=0;", or "x=0;", or "x=1,2,3,4,0;", etc.
  • Arrays can be assigned, so long as their types are the same, which copies all the elements of one to the other, e.g. "Dim x(20) as Integer, y(4,5) as Integer ... x = y" If the array sizes differ, then as many elements in the right hand size array are copied that can be, and if there us a shortfall, then any remaining elements in the left hand side array are left unaltered.
  • Assigning a single value to an array will copy it to the arrays first element.

    Dim myArray(10)
    myArray = 7.3

    is equivalent to:
    myArray(1) = 7.3

  • You can declare arrays with an arbitrary number of dimensions and arbitrary lower and upper bounds for each dimension. The latter point allows the index range of arrays to match that of axes, leading to simpler code, e.g. "Dim currentPos(0 To 7) As Float" would allow "currentPos(i) = POS.i" to be used.

Numbers and Variables

  • Scientific notation can be used to express very large and small numbers more concisely, e.g. "Const tol=0.5e-6". Scientific notation may also be output in a print statement by using the 'Sci' modifier.
  • When dimensioning multiple variables in one Dim statement, each one must have a type specified otherwise the unspecified types will default to Float, e.g. "Dim i, j As Integer" will result in 'i' being a Float.
  • A floating-point value can be converted to the nearest integer using the 'Round' function, which properly handles both positive and negative values.  The Round function can also round a floating-point value to a specified number of decinal places.
  • There are functions for shifting and rotating integer bitmaps, called Shift and Rotate. These can be used in statement form to shift/rotate the contents of an integer variable, or in function form in an expression.
  • Constant expressions are evaluated by the compiler, obviating the need to evaluate them by hand, which can help to make the derivation of a constants value more obvious.

Input Command

  • The Input statement does not allow a badly formed number to be entered, and if no Using clause is present, it follows the number conventions of MINT (binary numbers start with '2#', hexadecimal numbers with '16#', etc.).
  • You can input data directly into an array element using Input, e.g. "Input "Value: ", x(i)". You can also use an indexed array as the counter in a 'For' loop and as a reference parameter in a call.


  • Each task has its own bank, bus, terminal and axis string.
  • An event uses the parent tasks settings (bank, bus, terminal and axis string), but changes made to these parameters within the event will not alter the parent tasks settings. This fixes a fault in v4, where an event could cause side effects in the main program.
  • The Input, Wait and Pause statements do not hold up other tasks that are running in parallel, though only one task may be in an Input statement at any given time.
  • It is possible to access data declared within a task, event or start-up block from outside of the module by using the scope override operator, e.g. "myTask1::counter=0" would access the variable 'counter' declared with task 'myTask1'.


  • Brackets can be used around the Using clauses parameters, allowing multiple parameters in one print statement for arguments where the number of decimal places is meaningless or simply not required, e.g. "Print i Using(6), j Using(4)".
  • Defines may include references to other defines in their definition.
  • Long lines may be continued on the next line by using the line continuation character (an underscore).
  • The last key read using InKey can be accessed via the LastKey function, making programs simpler and more efficient, e.g. "Pause InKey: If LastKey=..." rather than "Dim c As Integer: Repeat: c=InKey: Until c: If c=...".
  • It is possible to exit a loop using the Exit statement and to continue with the next iteration using the Continue keyword. It is also possible to specify the loop type to exit/continue, which can be useful in nested loops.  If this does not provide enough control, the specified control structure can be labelled and the label used in the Exit/Continue statement.  E.g. Loop#picker ... Exit picker.
  • Exit can be used within a module when qualified with the module type (Sub, Function, Event, Task, Startup) to force immediate termination of the module (this used to be done with Return in v4).
  • The axis string can be displayed by printing it in binary, e.g. "Print Bin Axes". This used to be done with the Axes command in v4, which used to display the axis string.
  • If very small delays are required for timing issues, the 'Nop' statement can be used, though you will need a lot of them to get a sizeable delay (400,000 nops per second on NextMove PCI).
  • The error string of the last encountered error can be accessed using the 'ErrStr' function. This is useful in the error event handler, in displaying the current error (Print "Error ", Err, ": ", ErrStr, " on line ", Erl).
  • Non-printing ASCII codes can be embedded into literal strings using the back-slash followed by two hexadecimal digits that define the characters code. This notation can also be used to specify a double quote (\") and a back-slash (\\).
  • Blocks of code may be commented out using /*...*/.

For more information on the Mint language, see the 'Mint Basic Programming' manual.