+ All Categories
Home > Documents > Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib...

Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib...

Date post: 24-Jan-2021
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
73
Operating Software Instruction Manual for MCC Series of Motion Controllers Control Panel Stand-alone Operation Command Reference Manual Host Controlled Operation
Transcript
Page 1: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

Operating Software Instruction Manualfor

MCC Series of Motion Controllers

Control Panel Stand-alone Operation

Command Reference Manual Host Controlled Operation

Page 2: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

Power-up Help System Operation Controlling the Outputs and Monitoring the Inputs Power-up After power-up the status LED blinks and then remains lit. The controller sends a message to the PC showing its revision number that would be displayed in the Incoming Messages pane.

You could click on the button to make sure the status LED blinks then remains lit and the revision number is displayed in the Incoming Messages pane. This ensures that the communication is established between the controller and the PC

Help System After installation of the software the online help system will be available.The online help system may be accessed by;

1) Click on "?" located on upper right corner of the control panel,

then drag it to any button and click. A message will explain the functionality of that button.

Page 3: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

Operation

If the controller is not connected to the PC, Click on ‘Configuration’ then select ‘Demo Mode’ from the drop down menu to test drive the software without the controller.

Page 4: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

If you click on any button, you would see the outgoing messages to the controller and the incoming messages from the controller in the corresponding panes.

Page 5: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

The following display will appear that allows the user to set or reset each output individually and monitor all analog and digital inputs.

Page 6: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

www.OESIncorp.comCopyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 7: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

Stand-alone Operation The following are the steps that need to be taken to write, download and run the code. 1) Click on 'Code Development'.

2) Click on ‘Open File’ icon to open an existing file in the default directory; for example, x-axis-absolute-move.txt.

Page 8: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

3) Click on the button before each download. Please make sure the status LED blinks then remains lit. The revision number should be displayed in the Incoming Messages pane.

4) Click on button to send the code from PC to the controller.

Page 9: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

At the start of download the controller sends "Downloading from PC to Controller" which is displayed in the Incoming Messages. When the download is completed the controller sends "End of downloading" message to the PC.

5) Once the download is completed, click on and the controller will start to execute the program.

6) To store the code to non-volatile memory of the controller, repeat step 4 and 5 then click on . This will save the program in the non-volatile memory of the controller.

7) To retrieve the saved code from the non-volatile memory and run the code , click on then .

Page 10: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

Or, you could use the Upload-and-Run pin of the command port. Please consult the Hardware Reference Manual for the location of the pin.

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 11: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

MOTION ACCX value or variable Sets the linear acceleration of the X-axis to value or variable.DONEX? Halts the execution of the program until the motion of the X-axis is completed.HOMEX Instructs home searching sequence of the X-axis.JOGX Instructs jogging mode of the specified X-axis.MOVAX Begins an absolute move on the X-axis.MOVRX Begins a relative move on the X-axis.POSX value or variable Sets the distance to move of the X-axis to value or variable.STOPX Stops the motion of the X-axis.VELMNX value or variable Sets the minimum step rate of the X-axis to value or variable.VELX value or variable Sets the maximum step rate of the X-axis to value or variable.

GENERAL CONFIGURATION

EPOSX Equates the current position of the X-axis to the value of the corresponding step counter.

JOFF Disables the joystick and trackball operation.JON Enables the joystick and trackball operation.MOFFX Turns the motor driver of the X-axis off.MONX Turns the motor driver of the X-axis on.MSGOFF Turns off the feedback messages sent from the controller.MSGON Turns on the feedback messages sent from the controller.SPOSX value or variable Sets the current position for the X-axis to value or variable.SQUADX value or variable Sets the X-axis quadrature decoder to value or variable.

DATA FLOWCLRBIT value or variable Resets the discrete output specified by value to low state.DISPLAY value or variable Displays the specified string, value or variable on the LCD display.INPUT variable Receives numeric data from the serial port and places it in variable.IN variable Reads the input ports and places its value in variable.KEYPAD variable Reads the keypad and places its value in variable.OUT value or variable Writes the value to the output ports.PRINT string, value or variable Prints the specified string, value or variable to the serial port.RQUADX variable Places the value of X-axis quadrature input in variable.RSTSX variable Places the status of X-axis in variable.RX Reports the value of X-axis step counter.SETBIT value or variable Sets the discrete output specified by value to high state.

PROGRAM FLOWCONT Continues the program after a PAUSE command is received.END Terminates the program execution.GOSUB line Branches to subroutine starting at line number specified by line.GOTO line Transfers program execution to line number specified by line.IF expr THEN statement If expr is true executes statement , otherwise continues execution on to next line.IF expr THEN statement1 ELSE statement2 If expr is true executes statement1 , otherwise executes statement2.IFBIT value THEN statement If the specified bit is high then executes statement.

Page 12: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

IFBIT value THEN statement1 ELSE statement2 If the specified bit is high then executes statement1 , otherwise executes statement2.

IFNOTBIT value THEN statement If the specified bit is low then executes statement.IFNOTBIT value THEN statement1 ELSE statement2 If the specified bit is low then executes statement1 , otherwise executes statement2.REM Designates a comment line.

RETURN Ends a subroutine and causes execution to resume at the statement after the line, which called the subroutine.

PAUSE Pauses program execution until CONT is received.WAIT value or variable Waits for value number of milliseconds.

MISCELLANEOUS

DOWNLOAD Prepares the controller to receive the BASIC code. The mode is terminated upon receiving a dollar sign "$”.

LIST Sends the current program to the serial port.NEW Purges the memory.ROM Used for updating the controller codeRUN Runs the program.

VARIABLES and OPERATIONSLogical and Mathematical

RAND variable Assigns a random value to variable

EXAMPLES

Page 13: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

Host Controlled Operation In this mode the host will send a series of ASCII commands to the controller over the RS-232 serial port. The controller process to the incoming commands and responses with the proper messages. Programming Example in Visual BASIC The following example sets the linear acceleration to 500,000 Steps / sec2 , step rate at 100 KHz, and the distance to travel equal to 200,000 steps. Then the controller is commanded to make an absolute move on the X Axis. Private Sub Command1_Click()

'Function Prototype Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long Dim Code As Long Dim StringToBeTransmtd As String' Set the linear acceleration of X Axis to 500,000 steps / sec / sec StringToBeTransmtd = "accx 500000" + vbCr Code = SioPuts(ThePort, StringToBeTransmtd, Len(StringToBeTransmtd)) ' Set the linear velocity of X Axis to 100,000 steps / sec StringToBeTransmtd = "velx 100000" + vbCr Code = SioPuts(ThePort, StringToBeTransmtd, Len(StringToBeTransmtd)) ' Set the position to move of X Axis to 200,000 steps StringToBeTransmtd = "posx 200000" + vbCr Code = SioPuts(ThePort, StringToBeTransmtd, Len(StringToBeTransmtd)) 'Command the X Axis of the controller to make an absolute move StringToBeTransmtd = "movax" + vbCr Code = SioPuts(ThePort, StringToBeTransmtd, Len(StringToBeTransmtd))

End Sub Programming Example in 'C'The following example sets the acceleration at 10 Million Steps / sec2 , step rate at 100 KHz, and the distance to travel equal to 100,000 steps. Then the controller is commanded to make an absolute move. void send_command(void) {

char StringToBeTransmtd[80]; // Set the linear acceleration of X Axis to 500,000 steps / sec / sec strcpy(StringToBeTransmtd,"accx 500000\n"); SioPuts(Port,StringToBeTransmtd,strlen(StringToBeTransmtd)); // Set the linear velocity of X Axis to 100,000 steps / sec strcpy(StringToBeTransmtd,"velx 100000\n"); SioPuts(Port,StringToBeTransmtd,strlen(StringToBeTransmtd)); // Set the position to move of X Axis to 200,000 steps strcpy(StringToBeTransmtd,"posx 200000\n"); SioPuts(Port,StringToBeTransmtd,strlen(StringToBeTransmtd));// 'Command the X Axis of the controller to make an absolute move strcpy(StringToBeTransmtd,"movax\n"); SioPuts(Port,StringToBeTransmtd,strlen(StringToBeTransmtd));

}

The following is the information that you need to establish communication with OES line of controllers. 1) The baud rate is 19.2 K, 8-bit, no parity, one stop bit. 2) The length of input buffer of the MCC controller is 256 bytes. 3) ASCII characters should be terminated with CR or LF.

Page 14: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

4) After sending each packet of data to the MCCcontroller, sufficient time should be given to the controller to process it, usually 100msec.

To receive characters, a buffer is setup and all the incoming characters are stored in it until they are fetched by the application.

The following commands the X-axis to stop, and checks the receiving buffer for “X Stopping” string to make sure the X-axis has received and performed the command. Private Sub cmdXPlus_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim S As String Dim Start As Single Dim Counter As Integer Dim Where As Long

StringToBeTransmtd = "stopx" & vbCr Do While (Counter < NoofRetries And Where = 0) Code = SioPuts(ThePort, StringToBeTransmtd, Len(StringToBeTransmtd)) Start = Timer() Do While Timer() < Start + DelayTime DoEvents ' Yield to other processes. Loop Where = InStr(strRcvdMsg, "X Stopping") Counter = Counter + 1 Loop

If (Counter >= NoofRetries) Then If MsgBox("The controller is not responding! Turn the controller's power off.", vbOKOnly, "Error46") = vbOK Then Exit Sub End If

End Sub OES uses a serial communication package from www.marshallsoft.com.

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 15: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

accx

Syntaxaccx value or variable FunctionSets the linear acceleration of the X-axis to value or variable or variable.This value is used to accelerate and decelerate the motor. The acceleration may not be modified while moving. The unit of value is in steps per sec2 . Range of Value40,000 - 40,000,000 Controller ReturnsNone ModeRun, Command Examplerem Set X-axis linear acceleration to 500,000 steps per sec2.accx 500000A = 1000000rem Set X-axis linear acceleration to value stored in Aaccx A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 16: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

donex? Syntaxdonex? FunctionHalts the execution of the program until the motion of the X-axis is completed. Controller ReturnsDONE X Mode Run Examplerem Begin absolute movemovaxrem Wait until move is donedonex?

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 17: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

homex Syntaxhomex FunctionInstructs a home searching sequence on the X-axis. The homing sequence is as follows: The motor will start to move. The sign of the velocity determines the direction of the move. Once it hits the Home switch, it decelerates to stop at the same rate as acceleration. Then the motor will move in reverse direction, at the slowest speed, until it senses the Home switch changes state then stops. A normally closed or normally low switch should be connected to the Home pin. Please consult the Hardware Reference Manual for the location of the Home pin. Controller ReturnsX HomingAfter completion of the sequenceDone X ModeRun, Command Exampleaccx 10000 velx -8000 homex

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 18: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

jogx Syntaxjogx FunctionInstructs jogging mode of the X-axis. Controller ReturnsX JoggingAfter stoppingDone X ModeRun, Command Examplerem set the accelerationaccx 500000rem set the velocityvelx 10000rem start to jogjogx end$

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 19: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

movax Syntaxmovax FunctionBegins an absolute move on the X-axis. Controller ReturnsX Abs. Move ModeRun, Command Examplerem set the accelerationaccx 1000000rem set the velocityvelx 10000rem set the position to move toposx 15000rem start to make an absolute movemovax

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 20: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

movrx Syntax movrx FunctionBegins a relative move on the X-axis. Controller ReturnsX Rel. Move ModeRun, Command Examplerem set the accelerationaccx 1000000rem set the velocityvelx 100000rem set the position to move toposx 15000rem start to make a relative movemovrx

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 21: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

posx Syntaxposx value or variable FunctionSets the distance to move of the X-axis to value or variable. Range of Value-2147483647 to +2147483647 Controller ReturnsNone ModeRun, Command Examplerem Set accelerationaccx 1000000rem Set minimum velocityvelmnx 0rem Set maximum velocityvelx 100000rem Set the position to move toposx 150000rem Instruct to make an absolute movemovax

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 22: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

stopx Syntaxstopx FunctionStops the motion of the X-axis. Controller ReturnsX Stopping ModeRun, Command Exampleif X > 10000 then stopx

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 23: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

velmnx Syntaxvelmnx value or variable FunctionSets the minimum step rate of the X-axis to value or variable.The value sets the minimum slew speed of the motor. The value may not be modified while moving. The unit of value is in steps / Sec. Range of Value200 – 200,000 Controller ReturnsNone ModeRun, Command Examplevelmnx 0

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 24: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

velx Syntaxvelx value or variable FunctionSets the maximum step rate of the X-axis to value or variable.This value sets the slew speed of the motor. The speed may not be modified while moving. The unit of value is in steps / Sec. Range of Value200 – 200,000 Controller ReturnsNone ModeRun, Command Examplerem Set accelerationaccx 250000rem Set minimum velocityvelmnx 0rem Set maximum velocityvelx 100000jogx

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 25: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

eposx Syntaxeposx FunctionEquates the current position of the X-axis to the value of the corresponding step counter. Controller ReturnsNone ModeRun, Command Example eposx

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 26: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

joff Syntaxjoff FunctionDisables the joystick and trackball operation. Range of ValueNone Controller ReturnsJoystick is off. ModeRun, Command Exampleif A = B then joff

jon Syntaxjon FunctionEnables the joystick and trackball operation. Controller ReturnsJoystick is on. ModeRun, Command Exampleif A = B then jon

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 27: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

moffx Syntaxmoffx FunctionTurns the motor driver of the X-axis off. Controller ReturnsNone ModeRun, Command Exampleif A = B then moffx

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 28: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

monx Syntaxmonx FunctionTurns the motor driver of the X-axis on. Controller ReturnsNone ModeRun, Command Exampleif A = B then monx

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 29: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

msgoff Syntaxmsgoff FunctionTurns off the feedback messages sent from the controller. Controller ReturnsNone ModeRun, Command Examplemsgoff

msgon Syntaxmsgon FunctionTurns on the feedback messages sent from the controller. Controller ReturnsNone ModeRun, Command Examplemsgon

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 30: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

sposx Syntaxsposx value or variable FunctionSets the current position of the X-axis to value or variable. Range of Value-2147483647 to +2147483647 Controller ReturnsNone ModeRun, Command Examplesposx 10000A = 200000 sposx A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 31: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

squadx Syntaxsquadx value or variable FunctionSets the X-axis quadrature decoder to value or variable. Range of Value-2147483647 to +2147483647 Controller ReturnsNone ModeRun, Command Examplesquadx 10000A = 200000squadx A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 32: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

clrbit Syntaxclrbit value or variable FunctionResets the discrete output specified by value or variable. Refer to the hardware reference manual for the location of each pin. Range of Value1 to 16 Controller ReturnsNone ModeRun, Command Examplerem Reset discrete output 5clrbit 5A = 10rem Reset discrete output 10clrbit A

setbit Syntaxsetbit value or variable Function Sets the discrete output specified by value or variable. Refer to hardware reference manual for the location of each pin. Range of Value1 – 16 Controller ReturnsNone ModeRun, Command Examplesetbit 5A = 12setbit A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 33: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

keypad Syntaxkeypad variable FunctionRead the state of the keypad and places it in variable. Range of Variable0 to 5 Controller Returnsnone ModeRun, Command Examplekeypad A

display Syntaxdisplay valuedisplay “string”display “string”, value FunctionDisplays the specified value or string to the serial port. Range of Value-2147483647 to +2147483647 Controller Returnsstring, value ModeRun, Command ExampleA = 123display “A =”, A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 34: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

input Syntaxinput variable FunctionReceives numeric data from the serial port and places it in variable. Range of Variable-2147483647 to +2147483647 Controller Returns“?” ModeRun, Command Exampleinput Arem A numeric value should be sent to the controller through the serial port

print Syntaxprint valueprint “string”print “string”, value FunctionPrints the specified value or string to the serial port. Range of Value-2147483647 to +2147483647 Controller Returnsstring, value ModeRun, Command ExampleA = 123print “A =”, A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 35: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

in Syntaxin variable FunctionReads a word from the input ports and places it in variable. Refer to the hardware reference manual for the location of each pin. Range of Value0 to 256 Controller ReturnsNone ModeRun, Command Example in A

out Syntaxout valueout variable FunctionWrites the value or variable to the output ports. Refer to the hardware reference manual for the location of each pin. Range of Value0 to 256 Controller ReturnsNone ModeRun, Command Example A = 10out A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 36: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rquadx Syntaxrquadx variable FunctionPlaces the value of X-axis quadrature input in variable. If no variable is specified the controller sends the value to the serial port. The optional quadrature decoder card is required. Range of Value-2147483647 through +2147483647 Controller ReturnsThe value if no argument is specified. ModeRun, Command Examplerquadx Aprint "value of X-axis quadrature input = ”, A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 37: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rstsx Syntaxrstsx variable FunctionPlaces the values of X-axis modes and inputs in variable. Bit 0 is 1 if in MOVE mode else 0Bit 1 is 0 if Positive Limit Switch is hit else 1Bit 2 is 0 if Negative Limit Switch is hit else 1Bit 3 is 0 if Home Limit Switch is hit else 1Bit 4 is spareBit 5 is spareBit 6 is spareBit 7 is spareBit 8 is 1 if Joystick Lower Left Key Is Pressed.Bit 9 is 1 if Joystick Middle Right Key Is Pressed.Bit 10 is 1 if Joystick Upper Right Key Is Pressed.Bit 11 is 1 if Joystick Lower Right Key Is Pressed.Bit 12 is spare.Bit 13 is spare.Bit 14 is spare.Bit 15 is spare.Bit 16 - bit 23 = X-axis analog value.Bit 24 - bit 31 = Spare Range of Value-2147483648 to +2147483647 Controller ReturnsThe value if no argument is specified. ModeRun, Command Examplerstsx Aprint "Value of X-axis status =”, A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 38: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rx Syntaxrx FunctionReports the value of X-axis step counter prefixed by X. Controller ReturnsThe value of X-axis step counter prefixed by X. ModeRun, Command Examplesposx 12345rxrem Controller will return X+12345sposx -98765rxrem Controller will return X-98765

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 39: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

cont Syntaxcont FunctionContinues the execution of the program after a pause command is received. Controller ReturnsNone ModeRun Examplerem Halt program execution. The controller may be interrogated after receiving the pause.pause rem Continue the program execution.cont

pause Syntaxpause FunctionPauses program execution until CONT is received. PAUSE is useful in debugging. Using PAUSE, the execution of the program may be halted and the controller can be interrogated. Range of ValueNone Controller ReturnsPausing...Type CONT. ModeRun Exampleif A = B then pause

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 40: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

end

Syntaxend FunctionEnds program execution, and returns to command level. Controller ReturnsEnding ModeRun Examplerem Assign a value to AA = 1rem Print the value stored in Aprint Arem End program executionend

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 41: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

gosub Syntaxgosub line FunctionBranches to subroutine starting at line number specified by line. Controller ReturnsNone ModeRun Examplegosub 100rem other commands…end100 rem commands…return

return Syntaxreturn FunctionEnds a subroutine and causes execution to resume at the statement after the line that called the subroutine. Controller ReturnsNone ModeRun Examplegosub 100rem other commands…end100 rem Subroutine starts here…return

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 42: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

goto Syntaxgoto line FunctionTransfers program execution to line number specified by line. Controller ReturnsNone ModeRun Examplegoto 100rem other commands…end100 rem commands…return

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 43: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

if…then Syntaxif {relational expression} then instruction FunctionIf relational expression is true execute instruction. Error MessageIf then is missing, “Expected: then” ModeRun Exampleif A<> B then print “A<>B”

if…then…else Syntaxif {relational expression} then instruction1 else instruction2 FunctionIf relational expression is true execute instruction1, otherwise execute instruction2. Error MessageIf then is missing, “Expected: then” ModeRun Exampleif A<> B then print “A<>B” else print “A=B”

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 44: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

ifbit…then Syntaxifbit value then instruction FunctionIf the bit specified by value or variable is high then execute instruction. Refer to the hardware reference manual for the location of each pin. Range of Value1 to 16 Controller ReturnsNone ModeRun ExampleA = 10ifbit A then goto 100

ifbit…then…else Syntaxifbit value then instruction1 else instruction2 FunctionIf the bit specified by value or variable is high then execute instruction1, otherwise execute instruction2. Refer to the hardware reference manual for the location of each pin. Range of Value1 to 16 Controller ReturnsNone ModeRun ExampleA = 10ifbit A then goto 100 else goto 200

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 45: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

ifnotbit…then Syntaxifnotbit value then instruction FunctionIf the bit specified by value or variable is low then execute instruction. Refer to the hardware reference manual for the location of each pin. Range of Value1 to 16 Controller ReturnsNone ModeRun ExampleA = 10ifnotbit A then goto 100

ifnotbit…then…else Syntaxifnotbit value then instruction1 else instruction2 FunctionIf the bit specified by value or variable is low then execute instruction1, otherwise execute instruction2. Refer to the hardware reference manual for the location of each pin. Range of Value1 to 16 Controller ReturnsNone ModeRun ExampleA = 10ifnotbit A then goto 100 else goto 200

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 46: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Syntaxrem FunctionDesignates a comment line. Controller ReturnsNone ModeRun Examplerem This is a comment line.

wait Syntaxwait value wait variable FunctionWaits for value or variable number of milliseconds. Range of Value0 – 65535 Controller ReturnsNone ModeRun Example rem Wait for 10 mSecswait 10rem Wait for 200 mSecsA = 200wait A

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 47: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

downlaod

Syntaxdownload FunctionSignals the controller to receive the BASIC code. The mode is terminated upon receiving a dollar sign “$”. Controller ReturnsDownloading from PC to Controller(After completion of downloading)End of downloading ModeCommand Examplerem Signal the controller to receive the BASIC code. The code should be terminated by a dollar sign “$”.download

list Syntaxlist FunctionSends the current program from the controller to the serial port. Controller ReturnsListing ModeCommand Examplelist

new Syntaxnew FunctionPurges the controller’s memory. Controller ReturnsPurging the memory ModeCommand Examplenew

Page 48: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rom Syntaxrom FunctionUsed for updating the controller's firmware code. Range of ValueNone Controller ReturnsROMing ModeCommand Example

run Syntaxrun FunctionRuns the program. Controller ReturnsRunning ModeCommand Examplerun

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 49: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

variables The controller recognizes twenty two 32-bit variables, A through V. These variables may be used to receive, store and process numeric values. The range of the variables is from -2147483647 through +2147483647.

W, X, Y, and Z store the value of step counters. These values are read only and may not be written to.logical and mathematical operations The following operation may be performed on any two values or variables. + Addition / Division < Less Than <= Less Than or Equal & Logical AND | Logical OR # Logical XOR % Modulo > More Than >= More Than or Equal * Multiplication <> Not Equal ~ Logical One’s Complement () Parentheses - Subtraction

rand Syntaxrand variable FunctionPlaces a 32-bit random value in the variable. Range of Value0 - 4294967295 Controller ReturnsNone ModeRun, Command Examplerem a random value will be placed in Brand B print B

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 50: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

Examples Most of the following examples are based on x-axis-absolute-move. Please study it first. clrbit-setbit This program makes the X-motor to move back and forth, at the end of each move output 1 is toggled.gosub-return Demonstrating the usage of a subroutine.if-then-else Demonstrating the conditional execution of a program based on a logical statement.ifbit-then-else Demonstrating the conditional execution of a program based on the value of a discrete input.ifnotbit-then-else Demonstrating the conditional execution of a program based on the value of a discrete input.in-out Demonstrating reading and writing from / to the discrete inputs / outputs.input Demonstrating receiving numerical values from the serial port.joff-jon Demonstrating how to enable and disable the joystick.line-circle Illustrating the coordinated move, lines and arcs.msgoff-msgon Illustrating how to turn on and off the feedback messages.operations Illustrating logical and mathematical operations.variables Demonstration of usage of variables.x-axis-absolute-move Moving the X-motor relative to the reference point.x-axis-homing Commanding the X-motor to find the home switch.x-axis-jogging Commanding the X-motor to jog.x-axis-moff-mon Turning X-motor driver on or off.x-axis-relative-move Moving the X-motor relative to its last point.x-axis-rquadx Using the quadrature-X decoder for position verification.x-axis-rstsx Demonstrating the usage of the status of the X-motor.x-axis-sposx Demonstrating how to set the X-motor position to a valuex-axis-stop Demonstrating how to stop the X-motor

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 51: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Moving the X-motor relative to the reference pointrem This program makes the x-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 52: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Commanding the X-motor to find the home switchrem This program makes the X-motor to find the home position rem Commands demonstrated; velx, accx, homex, donex?, end rem Set the velocity velx -8000 rem Set the acceleration accx 10000 rem Start homing homex rem Wait until the move is completed donex? end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 53: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Commanding the X-motor to jogrem This program makes the X-motor to jog rem Commands demonstrated; velx, accx, jogx, end rem Set the velocity velx 8000 rem Set the acceleration accx 10000 rem Start jogging jogx end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 54: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Moving the X-motor relative to its last pointrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movrx, rem, wait, goto rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 rem Set the position to move to posx 5000 rem Start the relative move movrx rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Move again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 55: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating how to stop the X-motorrem This program makes the X-motor to jog rem Commands demonstrated; velx, accx, jogx, stopx, end rem Set the velocity velx 8000 rem Set the acceleration accx 10000 rem Start jogging jogx 100 rem Wait until the trip point if X < 50000 then goto 100 stopx end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 56: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Setting the minimum velocity of the X-motorrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, velmnx, accx, posx, movax, rem, wait, goto rem Set the velocity velmnx 10 velx 2000 rem Set the acceleration accx 1 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rx rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rx rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 57: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Illustrating the usage of the X-motor step counterrem This program makes the X-motor to jog rem Commands demonstrated; velx, accx, jogx, stopx, eposx rem Set the velocity velx 8000 rem Set the acceleration accx 10000 rem Start jogging jogx 100 rem Wait until the trip point if X < 50000 then goto 100 stopx eposx end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 58: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating how to enable and disable the joystick rem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, joff, jon, pause, cont rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Activate the joystick jon rem PAUSE until CONT is received pause rem Disable the joystick joff rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 59: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Turning X-motor driver on or offrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, moffx, monx rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 moffx pause monx rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 moffx pause monx rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 60: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Illustrating how to turn on and off the feedback messagesrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto. msgon, msgoff rem Set the velocity velx 2000 rem Set the acceleration accx 20000 rem Turn off the feedback messages sent from the controller msgoff 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Turn on the feedback messages sent from the controller msgon rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 61: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating how to set the X-motor position to a valuerem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, sposx rem Set the velocity velx 2000 rem Set the acceleration accx 20000 rem Set the current position sposx 1000 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Set the position to move to posx 1000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 62: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Using quadrature-X decoderrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, rquadx rem The X-motor quadrature encoder should be connected to the quadrature encoder of rem input of the controller. Please consult the Hardware Reference Manual. rem Set the velocity velx 2000 rem Set the acceleration accx 20000 rem Set quadrature decoder to 0 squadx 0 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Read quadrature decoder-X rquadx A print "Quad-X = ", A rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Read quadrature decoder-X rquadx A print "Quad-X = ", A rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 63: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem This program makes the X-motor to move back and forth, at the end of each move output 1 is toggled. rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, setbit, clrbit rem Set the velocity velx 2000 rem Set the acceleration accx 20000 clrbit 1 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? setbit 1 rem Wait for 250 msec wait 250 rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 clrbit 1 rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 64: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating receiving numerical values from the keypadkeypad A display "You entered ", A end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 65: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating reading and writing from / to the discrete inputs / outputs rem This program reads a value from discrete input ports and writes it to the discrete rem output port. 100 in A out A goto 100 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 66: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating the usage of the status of the X-motorrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, rstsx, rx rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed 100 rx wait 250 rstsx A if (A & 1) = 1 then goto 100 rx rem Wait for 250 msec wait 250 rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed 150 rx wait 250 rstsx A if (A & 1) = 1 then goto 150 rx rem Wait for 250 msec wait 250 rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 67: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, gosub, return rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 gosub 300 rem Start all over again goto 200 300 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 return end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 68: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating the conditional execution of a program based on a logical statement rem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto. if...then...else rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 I = I + 1 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Start all over again if I < 5 then goto 200 else end end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 69: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating the conditional execution of a program based on the value of a discrete inputrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, ifbit...then...else rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Start all over again ifbit 1 then goto 200 else end end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 70: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstrating the conditional execution of a program based on the value of a discrete inputrem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto, ifnotbit...then...else rem Set the velocity velx 2000 rem Set the acceleration accx 20000 200 rem Set the position to move to posx 5000 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for 250 msec wait 250 rem Start all over again ifnotbit 1 then goto 200 else end end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 71: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Demonstration of usage of variables rem This program makes the X-motor to move back and forth rem Commands demonstrated; velx, accx, posx, movax, rem, wait, goto A = 2000 B = 20000 C = 5000 T = 250 rem Set the velocity velx A rem Set the acceleration accx B 200 rem Set the position to move to posx C rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for T msec wait T print "X = ", X rem Set the position to move to posx 0 rem Start the absolute move movax rem Wait until the move is completed donex? rem Wait for T msec wait T print "X = ", X rem Start all over again goto 200 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 72: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Illustrating logical and mathematical operations100 print "Testing addition / subtraction operation..." rem generate a 32-bit number rand A rand B C = A + B D = C - A if D <> B then print "...Addition / subtraction test failed." print "Testing multiplication / division operation..." rand E rand F E = E & 32767 F = F & 32767 REM to make sure that divider is not zero F = F + 1 G = E * F H = G / F if H <> E then print "...multiplication / division test failed." if H <> E then end print "Testing modulos operation..." rand E rand F E = E & 32767 F = F & 32767 REM to make sure that divider is not zero F = F + 1 if E >= F then H = E / F else H = F / E if E >= F then I = E % F else I = F % E if E <= F then if (( E * H ) + I) <> F then print "...modulos operation failed." if E <= F then if (( E * H ) + I) <> F then end wait U print "Testing logical operation..." rand G rand H G = G * H H = G # -1 I = G | H if I <> -1 then print "...logical OR operation failed." if I <> -1 then end I = G & H if I <> 0 then print "...logical AND operation failed." if I <> 0 then end I = G # -1 if I <> H then print "...logical XOR operation failed." if I <> H then end I = ~G if I + G <> -1 then print "...logical unary operation failed." if I + G <> -1 then end goto 100 end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.

Page 73: Operating Software Instruction Manual for MCC Series of ...€¦ · Declare Function SioPuts Lib "WSC32.DLL" (ByVal Port As Long, ByVal Buffer As String, ByVal Size As Long) As Long

rem Illustrating the coordinated move, lines and arcsvaccel 10000 vvel 200000 rem arc 1st_axis_end, 2nd_axis_end, 1st_axis_center, 2nd_axis_center, direction rem line 1st_axis_end, 2nd_axis_end A = -7071 B = -7071 C = 0 D = 0 E = 1 F = 7071 G = 7071 SPOSX 0 SPOSY 0 line F, G done? wait 5 rx ry arc A, B, C, D, E done? wait 5 rx ry line 0, 0 done? wait 5 rx ry end $

www.OESIncorp.com

Copyright © 2002 - 2010 Optimal Engineering Systems, Inc.


Recommended