Difference between revisions of "Getting Started with MC-Basic and ControlStudio"

From SoftMC-Wiki
Jump to: navigation, search
(MC-Basic Fundamentals)
(MC-Basic Fundamentals)
Line 39: Line 39:
 
Queries are prefixed with the character ?.   
 
Queries are prefixed with the character ?.   
 
Following are a few examples of queries and the responses they produce.
 
Following are a few examples of queries and the responses they produce.
 +
 +
{| class="wikitable"
 +
|-
 +
|?<axis>.En <br/>?<axis>.Enable || Possible responses:<br/>0 = drive disabled<br/>1 = drive enabled
 +
|-
 +
|?<axis>.PCMD<br/>?<axis>.PositionCommand ||Returns the position command
 +
|}

Revision as of 09:16, 22 March 2017

Overview

This document is a quick introduction to help you begin operating the softMC using the MC-Basic language and ControlStudio software. MC-Basic (Motion Control BASIC) is a proprietary programming language developed by Servotronix for use with the softMC. It is based on standard BASIC programming language, with extensive enhancements for multi-tasking and motion control functionalities. The Terminal pane in ControlStudio gives you access to the MC Basic environment. ControlStudio is a PC-based graphical user interface for developing, running, and testing motion applications that will be controlled and/or coordinated by the softMC. ControlStudio contains a programming editor, data recorder, debugger and monitoring tools. Once the application programs are completed, the PC can be removed and the softMC controller can operate standalone or within a network. For downloads and more information about the softMC hardware and software systems, use the resources available on the Servotronix website.

Three files are used in the procedures in this training manual. They should be supplied in a compressed file, and extracted to a folder on the user’s PC.

  • CONFIG.PRG
  • MOVE_2AX.PRG
  • MAS_SLAV.PRG

MC-Basic Fundamentals

Using MC-Basic you can issue commands to the softMC and retrieve data from it. These operations can be executed from a program that is loaded and run in the softMC, or by entering commands directly to the softMC by means of the Terminal pane in ControlStudio. General Purpose Tasks (*.prg)

  • User program.
  • Defines the work to be performed by the motion controller.
  • Runs simultaneously with, and independently of, other tasks.

General Purpose Libraries (*.lib)

  • User (shared) libraries.
  • Collection of frequently used subroutines and functions in MC-Basic.
  • Subroutines and function in libraries can be called by tasks and other libraries.
  • Libraries are global if loaded from config.prg or by command loadglobal;
  • libraries are local if loaded by command load.
  • Public functions in global libraries can be called from anywhere , without explicit import;
  • Public functions in local libraries can be called from other libraries and programs, but require command import (see wiki: MC-Basic:IMPORT).

Configuration (config.prg) Refer to the section Loading Config.prg.

  • Used primarily to declare global objects and load all global libraries.
  • Automatically loads and runs once at power up if variable system.dipswitch.6 = 1. (see wiki: MC-Basic:SYSTEM.DIPSWITCH).
  • Runs whenever command reset all is executed.

Autoexecute (autoexec.prg)

  • Used to start the application tasks.
  • Loads and runs automatically once at power up if variable system.dipswitch.6 = 1. (see wiki: MC-Basic:SYSTEM.DIPSWITCH).

Reset all The command reset all clears all tasks and variables from system memory, and loads and runs CONFIG.PRG. After powering up the softMC, you must execute reset all from the terminal in order to load the configuration file for the first time.

Queries Queries are prefixed with the character ?. Following are a few examples of queries and the responses they produce.

?<axis>.En
?<axis>.Enable
Possible responses:
0 = drive disabled
1 = drive enabled
?<axis>.PCMD
?<axis>.PositionCommand
Returns the position command