Programming Flashcards

1
Q

’’’ # ‘’’

A

Label Designator
1. The # denotes the name of a program label, eg. #move
2. Labels are often used to implement subroutines or loops .
3. Labels are either user-defined or are reserved names, called “automatic subroutines”, that automatically execute when a particular event occurs.
* Labels can include the characters A-Z, a-z, 1-9. Numbers cannot be the first character. All other characters are invalid.
* A label can only be defined at the beginning of a new line.
* The number of labels available can be queried with MG_DL
* LL returns the current label table in the controller.
* Galil recommends that at least the first character be lowecase for user labels to differentiate from automatic subroutines.
* Automatic subroutines are listed in the command reference starting with a # character.
* There is a maximum of 510 labels available.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

’’’ #AUTO ‘’’

A

Sub
1. Defines the automatic entry point of embedded DMC code.
2. When power is applied to the controller, or after the controller is reset, the program will automatically begin executing at this label.
3. When no host software is used with the controller, #AUTO is required to run an application program on the controller stand-alone
4. Label must be the first element on a line of code.
5. Use EN to end the routine.
6. Thread 0 is used to execute #AUTO on startup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

’’’ #COMINT ‘’’

A

Communication interrupt automatic sub
1. Automatic subroutine to provide interrupt driven communications from the serial port.
2. #COMINT can be configured by the CI command to run either when any character is received, or when a carriage return is received over the com port. (auxiliary port is used if equipped)
3. #COMINT runs in thread 0, and an applications must be running in thread 0 in order for #COMINT to be enabled.
4. Code running in thread 0 will be interrupted by the #COMINT subroutine
5. It is important to handle the interrupt condition and return without delay. The controller will continue to to receive data and update the operands (P1CH, P2CH, etc) while in #COMINT. This can lead to missed characters, numbers, and strings if #COMINT is unnecessarily delayed.
6. It is the user’s responsibility to ensure the communication buffer is not filled when in this mode, otherwise the controller will report error code 5 “Input Buffer Full”. The buffer on the controller is cleared when either of the two following conditions are met
* A carriage return is received on the communication port.
* CI -1 is called.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

’’’ #ININT ‘’’

A

Input Interrupt Automatic Sub
1. The #ININT subroutine is used to execute specific code when inputs specified by the II command are in the desired state.
2. Use the II command to enable the routine,
3. Use RI to exit the routine.
4. To make an unconditional jump from #ININT, there are two methods for re-enabling the interrupt capability.
* Issue a ZS and then re-issue the command II before the JP
* Use a “null” routine. The “null” routine allows for the execution of the RI command before the unconditional jump.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

’’’ #MCTIME ‘’’

A

MC Command Timeout Automatic Sub
1. Automatic sub used to run user-code is a Motion Complete (MC) trippoint times out.
2. If the motor position does not reach or pass the target within the specified timeout (TW), #MCTIME will run if present.
3. MC uses position from TP for servos, or TD for steppers.
4. Use EN to terminate the subroutine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

AB

A

Abort
1. The AB command is a command to issue an abort to controller operation.
2. AB (Abort) stops motion instantly without a controlled deceleration.
3. If there is a program operatin, AB can also be specified to abort the program and all running threads.
4. The command, AB, will shut off the motors for any axis in which the off on error function (OE) is enabled.
5. -AB gives state of Abort Input , 1 inactive and 0 active
6. AB aborts motion on all axes in motion and cannot stop individual axes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

BK

A

Breakpoint- Pause program execution
1. The BK command causes the controller to pause execution of the given thread at the given thread at the given program line number. When that line is reached, program execution halts before the line is executed, while all other threads continue running.
2. After a breakpoint is encountered, a new breakpoint can be armed (to continue execution to the new breakpoint) or BK will resume program execution.
3. The SL command can be used to single step from the breakpoint.
4. Only one breakpoint may be armed at any time.
5. BK can be armed before or during thread execution.
6. -BK will tell whether a breakpoint has been armed, whether it has been encountered, and the program line number of the breakpoint:
* = -LineNumber : breakpoint armed
* = LineNumber : breakpoint encountered
* = -2147483648: breakpoint not armed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

DA

A

De-allocate variable and arrays
1. The DA command freed the array and/or variable memory space.
2. In this command, more than one array or variable can be specified for memory deallocation.
3. Differenc arrays and variables are separated by comma when specified in one command.
* str[] - Defined array name
* str - Defined variable name
* str = * -Deallocates all the variables
* str = * [] - Deallocates all the arrays
4. -DA contains the total number of arrays available
5. DA? returns the total number of arrays available
6. Since this command deallocates the spaces and compacts the array spaces in the memory it is possible that execution of this command may take longer time than a standard command.
7. Variables and arrays that are deallocated are not set to zero. A routine that writes a zero to the array and/or variables should be created if this is desired.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

DL

A

Download Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

DM

A

Dimension Arrays
1. The DM command defines a single-dimensional array with a name and n total elements. The first element of the defined array starts with element number 0 and the last element is at n -1
2. Typing in array name with [-1] eleemtn marked reports the number of elements for that array.
3. The first character of str must be alphabetic. The rest can be any alphanumeric characters.
4. When assigning array elements, the number specified must be less than the current available array space.
5. -DM contains the available array space.
6. DM? returns the available array space.
7. The DM command can allocate any number of array in a single command up to the maximum command line length of the controller being used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

ELSE

A

Else for IF Conditional Statement
1. The ELSE command is an optional part of an IF conditional statement.
2. The ELSE command must occur after an IF command and it has no arguments.
3. It allows for the execution of a command only when the argument of the IF command evaluates False.
4. If the argument of the IF command evaluates false, the controller will skip commands until the ELSE command.
5. If the argument for the IF command evaluates trum the controller will execute the commands between the IF and ELSE command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

EN

A

End of Program or Subroutine
1. The EN command is used to designate the end of a program or subroutine.
2. If a subroutine was called by the JS command, the EN command ends the subroutine and returns program flow to the point just after the JS command.
3. A return parameter can be specified to EN from a subroutine to return a value from the subroutine to the calling stack.
4. The EN command is used to end the automatic subroutines #MCTIME, #COMINT, and #CMDERR.
* USe the RE command to end the #POSERR and #LIMSWI subroutines.
* Use the RI command to end the #ININT subroutine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

ENDIF

A

End of If Conditional Statement
1. The ENDIF command is used to designate the end of an IF conditional statement.
2. An IF conditional statement is formed by the combination of an IF and ENDIF command, An ENDIF command must always be executed for every IF command that has been executed.
3. It is recommended that the user not include jump commands inside IF conditional statements since this causes re-direction of command execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

HX

A

Halt Execution of Program
1. The HX command halts the execution of any program that is running
2. the parameter n specifies the thread to be halted.
3. When used as an operand, -HXn contains the running status of thread n with:
* 0 Thread not running
* 1 Thread is running
* 2 Thread has stopped at trippoint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

IF

A

IF Conditional Statement
1. The IF command is used in conjunction with an ENDIF command to form an IF conditional statement.
2. The arguments consist of one or more conditional statements and each condition must be enclosed with parenthesis ().
3. If the conditional statement(S) evaluates true, the command interpreter will continue executing commands which follow the IF command.
4. If the conditional statement evaluates false, the controller will ignore commands until the associated ENDIF command or an ELSE command occurs in the program.
5. Conditions are tested with the following logical operators:
* < less than or equal to
* > greater than or equal to
* = equal to
* <= less than or equal to
* >= greater than or equal to
* <> not equal
* | and & can be used to evaluate multiple conditions
* The “&” operand between any two conditions requires that both statements must be true for the combined statement to be true.
The “|” operand between any two conditions requires that only one statement be true for the combined statement to be true.
* A true condition = 1 and a false condition = 0
* Each condition must be placed in paranthesis for proper evaluation by the controller.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

JP

A

Jump to Program Location
1. The JP command causes a jump to a program location on a specific condition.
2. The program location may be any program line number or label.
3. A jump is taken if the specified condition is true.
4. Multiple conditions cna be used in a single jump statement,
5. JP can be used for relative jumps and for jump tables
6. Conditions are tested with the following logical operators:
* < less than or equal to
* > greater than or equal to
* = equal to
* <= less than or equal to
* >= greater than or equal to
* <> not equal
* | and & can be used to evaluate multiple conditions
* The “&” operand between any two conditions requires that both statements must be true for the combined statement to be true.
* The “|” operand between any two conditions requires that only one statement be true for the combined statement to be true.
* A true condition = 1 and a false condition = 0
* Each condition must be placed in paranthesis for proper evaluation by the controller.

17
Q

JS

A

Jump to Subroutine
1. Allows the program to jump to a subroutine and return back after completion.
2. This command is often used to call reusable code.
3. JS can be nested, called up to 16 deep.
4. When used after a JS is called, the -JS operand contains the returned value of the subroutine called by JS.
5. The JS command will change the sequential order of execution of command in a program.
6. If the jump is taken, program execution will continue at the line specified by the destination parameter, which can either be a line number or label.
7. A variable holding a line number or an expression resulting in the calculation of a line number can also be used.
8. The line number of the calling JS command is saved and after an EN command is encountered (End of Subroutine), program execution will continue with the instruction following the calling JS command.
9. A jump is taken if the specified condition is true . Each condition must be placed in parenthesis for proper evaluation by the controller.
10. A single subroutine can be written and called many times from various locations in the code. The stack “remembers” where to return when completed. This is opposite from a “blind jump” (JP)

Passing Values on the Stack
1. Parameters can be passed on the subroutine stack.
2. Passing parameters in a subroutine has many advantages including the following
* Variable scope/ Local Variables: A subroutine can run with a protected variable space. Local variables exist only in the extent of the subroutine, and no external thread or stack level can access local variables. Local variables can be used for counters, indicies, and other helper variables.
* Each thread has its own stack, therefor subroutines are reentrant. In other words, multiple threads can be running the same subroutine simultaneously at various stack depths.
* Support for recursion: Although the subroutine stack is only 16 deep, recursion is possible . A stack depth of 16 is sufficient for many recursive tasks. EG recursing axes, handles, and thread status.
* Parameter passing: A calling command can explicitly specify the inputs to a subroutine. The subroutine can pass one value back to the calling command. More returns are possible with pass by reference and array passing.
3. Constants, variables, and arrays may be passed up a subroutine stack
4. Variables may be passed by value or by reference. If passed by value, a copy is made in the subroutine stack, leaving the original variable immutable. If passed by reference, the original variable’s value will be changed when the subroutine writes to its local variable. This is similar, but not exactly analgous to a C pointer.
5. A variable passed by reference is automatically dereferenced; The variable pointer is not exposed to the user. Following the C syntax, a by reference pass is accomplished with the ampersand (&) in the invoking call.
* Important Note: When passing a variable by reference, do not allocate any new variables in the called subroutine.
6. Arrays can be passed in the stack, though only by reference. No “&” is used when passing arrays, by reference is assumed. To pass an arraym use its name in quotations.
* Important Note: Arrays to be passed must have names that are 6 characters or less.
7. The number of elements in an array is returned by reading index -1. eg array[1].
8. To return values on the stack, write the value in the EN command upon ending the subroutine. The parent stack can access this value via -JS.

18
Q

RA

A

Record Array
1. The RA command selects the user arrays to be populated by the Record Array function.
2. The data to be captured is specified by the RD command and time interval by the RC command.
3. The array name str must be followed by the [] brackets. Those brackets must be empty.
4. The array name str must be a valid array defined by the DM command and reported by LA

19
Q

RC

A

Begin Automatic Record Array Mode
1. The RC command beginds recording for the Automatic Record Array Mode. RC 0 stops recording.
2. The record array mode loads source data specified by the RD command into the arrays defined by the RA command.
3. The address for the array element for the next recording can be interrogated with -RD
4. Do not allocate or deallocate arrays (DM,DA) while the Automatic Record Array Mode is running.
5. Do not attempt to download arrays from a host application while automatic record array mode is running.
6. n0 = non zero number automatically starts record mode.
7. n0 = ? returns status of recording. ‘1’ if recording, ‘0’ if not recording.

Second Parameter Rules
* n1 specifies the last array element to use for record mode.
* If arrays specified by RA have different sizes, the smallest array size is the maximum value for n1.
* if n1 = 0 or not specified, the maximum value is used.
* A negative value for n1 specifies circular (continuous) record over array addresses 0 to (n1-1)
* The absolute value of the minimum n1 allowed = maximum n1 allowed.

Operand Usage
-RC contains status of recording, ‘1’ if recording, ‘0’ if not recording.

Setting up the Record Array mode
1. Dimension an array(s) for storing data. Make sure you dimension the array with the number of elements required to capture data for your application.
2. Set the RA command with the arrays to be used for recording.
3. Set the RD command with the data sources to be applied to the arrays. The order of your arrays entered into RA will match the order of data sources set by RD.
4. Set the RC command to get the desired time between records and enable the recording.
5. Monitor the -RC operand for a 0 to indicate recording is done.

20
Q

RD

A

Record Data
1. The RD command specifies the data type to be captured for the Record Array (RA) mode. The data defined in this command is stored in arrays defined by the RA command at the time interval specified with the RC command.
2. Arguments listed as -XXm are valid when m is a valid axis mask.
3. The order of args specified in RD corresponds with the array order specified in the RA command.
4. The operand -RD contains the address for the next array element for recording.
5. When recording -AFm, the returned value is signed. This means that when AQ is used to set unipolar inputs, values on the upper half of the voltage range are sign extended. Ending the vlaue with $0000FFFF will return the expected unsigned value

21
Q

RI

A

Return from Interrupt Routine
1. The RI command is used to end the input interrupt subroutine.
2. The input interruput subroutine begins with the label #ININT. An RI at the end of this routine causes a return to the main program.
3. To avoid returning to the main program on an interrupt, use the command ZS to zero the subroutine stack. This turns the jump subroutine into a jump only.
4. If the program sequencer was interrupted while waiting for a trippoint, such as WT, RI 1 restores the trippoint on the return to the program. RI 0 clears the trippoint.
5. A motion trippoint like MF or MR requires the axis to be actively profiling in order to be restored with the RI1 command.
6. The RI command re-enables input interrupts.