Converting Your AeroBasic Programs

Automation1 uses AeroScript, which is a new programming language for machine control. When you migrate your AeroBasic programs, this process tries to automatically convert them into AeroScript programs.

IMPORTANT: This process might not successfully convert some of your AeroBasic programs into Automation1 programs. If some of your AeroBasic programs cannot be converted, then you must manually rewrite them in AeroScript. See the Manual Conversion section on this page for more information.

If the conversion tool cannot create working AeroScript code from your AeroBasic programs, the tool marks program lines that could not be converted with the preprocessor statement #error_unconvertible. See the Manual Conversion section that follows for details on how to manually correct these lines.

Manual Conversion

If you must manually rewrite some of your AeroBasic programs in AeroScript, use the powerful programming and development tools that are available in the Develop workspace of Automation1 Studio. For information about the Develop workspace, see the Develop Workspace page. For information about which AeroBasic commands were removed from or changed in Automation1, see the AeroScript Equivalents of AeroBasic Commands for the A3200 page.

Lines of code that could not be converted to AeroScript are marked with the #error_unconvertible preprocessor statement. These statements cause a compile-time error on each line that they occur. This lets you quickly find the unconverted code in the Build tab of the Develop workspace.

The list that follows includes reasons that the conversion tool could not convert a line of AeroBasic to AeroScript. Refer to the AeroScript Equivalents of AeroBasic Commands for the A3200 page to see if the AeroBasic command has an AeroScript equivalent.

  • Some AeroBasic commands do not have AeroScript equivalents and were removed in Automation1.
  • Some commands have an AeroScript equivalent, but they were added in a recent version of Automation1 and are not yet recognized by the automatic conversion tool.
  • The automatic conversion tool cannot expand preprocessor defines or macros. If a preprocessor define or macro uses an AeroBasic command that cannot be converted, the #define or #macro statement is marked as unconvertible as well as all instances of the defined target word.
  • If a preprocessor define or macro is ambiguous and must have context to convert, the #define or #macro statement is marked as unconvertible as well as all instances of the defined target word. This can occur if an AeroBasic command was replaced by more than one AeroScript function. See the section that follows for information about ambiguous definitions.

Using AeroScript Properties for Ambiguous Definitions

Sometimes you can use AeroScript Properties instead of selecting from two or more AeroScript functions. You can use property accessors to call different AeroScript functions based on if the property is being read or written to.

For example, a define that expands to the AeroBasic command $DO is ambiguous and must have context to convert because $DO was replaced with two functions in AeroScript, DigitalOutputGet() and DigitalOutputSet(). The program example that follows shows how to create a property to convert the AeroBasic command $DO instead of having to select either DigitalOutputGet() and DigitalOutputSet().This lets you keep the unexpanded definition in your program, and you only have to manually convert the definition.

Program Example

property $do[$index as integer][$axis as axis] as integer
    get
        return DigitalOutputGet($axis, $index)
    end

    set
        DigitalOutputSet($axis, $index, value)
    end
end

// Now change any definitions to use indexes instead of dot-notation,
// as the AeroBasic dot-notation (as in $do[1].X) is not valid in 
// AeroScript. Finally, delete the #error_unconvertible marker from
// the definition and all use-sites.
#error_unconvertible #define MyDO $do[1][X]

 

Next Step: Reconfiguring Program Automation