RIO Commands Flashcards

1
Q

#

A

Label Designator

The # denotes the name of a program label, for example, #move. Labels are often used to implement subroutines or loops. Labels are either user-defined or are reserved names, called “automatic subroutines”, that automatically execute when a particular event occurs.

‘A sample FOR loop
‘Routine will run 10 times and sum all integers 1 through 10
sum=0; ‘ variable to hold sum of integers
i=1; ‘ create a counter
#for
sum=sum+i; ‘ add counter to sum
i=i+1; ‘ increment counter
JP#for,(i<=10)
EN

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

#AUTO

A

Subroutine to Run Automatically on Power-Up

Defines the automatic entry point of embedded DMC code. When power is applied to the controller, or after the controller is reset, the program will automatically begin executing at this label. When no host software is used with the controller, #AUTO is required to run an application program on the controller stand-alone.

‘On startup, this code will create a 50% duty cycle square wave
‘on output 1 with a period of 1 second
#AUTO; ‘ start on powerup
SB 1; ‘ set bit 1
WT 500; ‘ wait 500msec
CB 1; ‘ clear bit 1
WT 500; ‘ wait 500msec
JP #AUTO; ‘ jump back to #AUTO

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

@AN

A

Analog Input Query

The @AN[] operator returns the value of the given analog input in volts.

:MG @AN[1] ; ‘print analog input 1 value
1.7883
:x = @AN[1] ; ‘assign analog input 1 state to a variable

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

@AO

A

Analog Output Query

The @AO[n] operator is used to query the value of an Analog Output.

:MG@AO[1]; ‘ Displays status of Analog output 1
2.5000
:temp=@AO[1]; ‘ Sets variable temp to the value of Analog output 1

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

@IN

A

Read Digital Input

The @IN operand returns the value of the given digital input (either 0 or 1).

:MG @IN[1]
1.0000
:x = @IN[1]
:x = ?; ‘ print digital Input 1
1.000

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

@OUT

A

Read Digital Output

Returns the value of the given digital output (either 0 or 1)

:MG @OUT[1]; ‘ print state of digital output 1
1.0000
:x = @OUT[1]; ‘ assign state of digital output 1 to a variable

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

AI

A

After Input

The AI command is a trippoint used in motion programs to wait until after a specified input has changed state. This command can be configured such that the controller will wait until the input goes high or the input goes low.

AI 8;’ Wait until input 8 is high
#A;’ Begin Program
AI 7&15&-1&-12;’ Wait until inputs 7 & 15 are high, and inputs 1 & 12 are low
MG “DONE”;’ Send message ‘DONE’ when conditions are satisfied
EN;’ End Program

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

AT

A

ex

At Time

The AT command is a trippoint which is used to hold up execution of the next command until after the specified time has elapsed. The time is measured with respect to a defined reference time. AT 0 establishes the initial reference.

AT 0;’ Establishes reference time 0 as current time
AT 50;’ Waits 50 msec from reference 0
AT 100;’ Waits 100 msec from reference 0
AT -150;’Waits 150 msec from reference 0 and sets new reference at 150
AT 80;’ Waits 80 msec from new reference (total elapsed time is 230 msec)
EN

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

BN

A

Burn Parameters

The BN command saves certain board parameters in non-volatile EEPROM memory. Once written to the memory, all parameters which can be burned will persist through a software reset (RS command), hardware reset (reset button) or power cycle. This command typically takes 1 second to execute and must not be interrupted. The controller returns a colon (:) when the Burn is complete. All parameters which have been burned into memory can be restored to their factory defaults through a master reset.

SB1; ‘ set bit 1
CB2; ‘clear bit 2
CW1; ‘ set data adjustment bit
BN; ‘ burn all parameter states

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

BP

A

Burn Program

The BP command saves the application program in non-volatile EEPROM memory. This command may take several seconds to execute and must not be interrupted. The controller returns a : (colon) when the Burn is complete.

:BP; ‘ burn in program to controller
: //get colon response when done

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

BV

A

Burn Variables and Arrays

The BV command saves the controller variables and arrays in non-volatile EEPROM memory. This command typically takes up to 2 seconds to execute and must not be interrupted. The controller returns a : when the Burn is complete.

:BV;’ burn in variables
: //controller returns a colon when Burn is complete

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

CB

A

Clear Bit

The CB command clears a particular digital output. The SB and CB (Clear Bit) instructions can be used to control the state of output lines.

When an output has been cleared, current will cease flowing through the optocoupler for that output.

SB 5; ‘ Set digital output 5
SB 1; ‘ Set digital output 1
CB 5; ‘ Clear digital output 5
CB 1; ‘ Clear digital output 1
EN

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

IQ

A

Digital Input Configuration

The IQ command sets the bitwise active level for each of the digital inputs. The input for IQ is a bitmask representing the inputs of the controller. When bit n of IQ is 0, then current flowing through the opto of input n returns a 0. When bit n is 1, current flow returns a 1.

:IQ255; ‘This sets inputs 0-7 such that current flowing results in logic 1
:
:IQ192;’ Current flowing on inputs 6 and 7 results in logic 1 - current flowing on 0-5 and 8-15 are logic 0

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

IF

A

input

IF Conditional Statement

The IF command is used in conjunction with an ENDIF command to form an IF conditional statement. The arguments consist of one or more conditional statements and each condition must be enclosed with parenthesis (). If the conditional statement(s) evaluates true, the command interpreter will continue executing commands which follow the IF command. If the conditional statement evaluates false, the controller will ignore commands until the associated ENDIF command or an ELSE command occurs in the program.

IF (@IN[1]=0);’ IF conditional statement based on input 1
MG “Input 1 is Low”;’ Message to be executed if “IF” statement is true
ENDIF;’ End of IF conditional statement
EN

v1=@AN[1]*5;’ some calculation for variable v1
IF((v1>25)&(@IN[4]=1));’ Conditions based on V1 variable and input 4 status
MG “Conditions met”;’ Message to be executed if “IF” statement is true
ENDIF;’ End of IF statement
EN

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

ENDIF

A

End of IF Conditional Statement

The ENDIF command is used to designate the end of an IF conditional statement. 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. It is recommended that the user not include jump commands inside IF conditional statements since this causes re-direction of command execution. In this case, the command interpreter may not execute an ENDIF command.

IF (@IN[1]=0);’ IF conditional statement based on input 1
IF (@IN[2]=0);’ 2nd IF conditional statement executed if 1st IF conditional true
MG “IN1 AND IN2 ARE ACTIVE”;’ Message if 2nd IF conditional is true
ELSE;’ ELSE command for 2nd IF conditional statement
MG “ONLY IN1 IS ACTIVE”;’ Message if 2nd IF conditional is false
ENDIF;’ End of 2nd conditional statement
ELSE;’ ELSE command for 1st IF conditional statement
IF (@IN[2]=0);’ 3rd IF conditional statement executed if 1st IF conditional false
MG “ONLY IN2 IS ACTIVE”;’ Message if 3rd IF conditional statement is true
ELSE;’ ELSE command for 3rd conditional statement
MG “IN1 AND IN2 INACTIVE”;’Message if 3rd IF conditional statement is false
ENDIF;’ End of 3rd conditional statement
ENDIF;’ End of 1st conditional statement

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

ELSE

A

ELSE Function for Conditional IF Statement

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

IF (@IN[1]=0);’ IF conditional statement based on input 1
IF (@IN[2]=0);’ 2nd IF conditional statement executed if 1st IF conditional true
MG “IN1 AND IN2 ARE ACTIVE”;’ Message if 2nd IF conditional is true
ELSE;’ ELSE command for 2nd IF conditional statement
MG “ONLY IN1 IS ACTIVE”;’ Message if 2nd IF conditional is false
ENDIF;’ End of 2nd conditional statement
ELSE;’ ELSE command for 1st IF conditional statement
IF (@IN[2]=0);’ 3rd IF conditional statement executed if 1st IF conditional false
MG “ONLY IN2 IS ACTIVE”;’ Message if 3rd IF conditional statement is true
ELSE;’ ELSE command for 3rd conditional statement
MG “IN1 AND IN2 INACTIVE”;’Message if 3rd IF conditional statement is false
ENDIF;’ End of 3rd conditional statement
ENDIF;’ End of 1st conditional statement

17
Q

KP

A

Proportional Gain Constant

KP designates the proportional constant in the controller filter. The proportional gain outputs a control signal proportional to the amount of error.

:KP 12,14;’ Implicit notation to set channel A and B term
:KPB= 14;’ Explicit notation to set channel A only
:KP ,8;’ Implicit notation to set B
:KP ?,?;’ Return A,B values
12, 14
:KPB= ?;’ Return B value
14
:MG _KPA;’ Message the operand for the A channel
12
:

18
Q

LZ

A

Omit Leading Zeroes

The LZ command is used for formatting the values returned from interrogation commands, variables, and arrays. By enabling the LZ function, all leading zeros of returned values will be removed.

  • _LZ contains the state of the LZ function. ‘0’ is disabled and ‘1’ is enabled.

:LZ 0; ‘disable the LZ function
:TB; ‘tell status bits
001
:LZ 1; ‘inhibit leading zeros
:TB; ‘tell status

19
Q

NO

A

A; ‘Program A

No Operation

The NO (or ‘) command performs no action in a sequence and can be used as a comment in a program. NO (or ‘) command lines are downloaded to the controller and do take some execution time.

NO; ‘ No operation
NO This Program; ‘ No operation
NO Does Absolutely; ‘ No operation
NO Nothing; ‘ No operation
EN; ‘End of program

20
Q

OB

A

Output Bit

The OB command allows variable control of an output bit based on logical expressions. The OB command defines output bit n as either 0 or 1 depending on the result from the logical expression.

OB 1, pos; ‘ If pos<>0, Bit 1 is high. If pos=0, Bit 1 is low
OB 2, @IN[1]&@IN[2]; ‘ If Input 1 and Input 2 are both high, then Output 2 is set high
OB 3, count[1]; ‘ If the element 1 in the array is zero, clear bit 3
OB n, count[1]; ‘ If element 1 in the array is zero, clear bit n

21
Q

OP

A

Output Port

The OP command sets the output ports of the controller in a bank using bitmasks. Arguments to the OP command are bit patterns (decimal or hex) to set entire banks (bytes) of digital outputs. Use SB, CB or OB to set bits individually..

OP $85;’ Set outputs 1,3,8 and clear the others
OP 0;’ Clear all bits

22
Q

PW

A

Password

The PW command sets the password used to lock the controller. Locking the controller prevents interrogation of the controller program space.

  • The password can only be changed when the controller is in the unlocked state. See the ^L^K for more details.
  • The password is burnable but cannot be interrogated. If you forget the password and the controller is locked you must master reset the controller to gain access.
  • Quotes are not used to frame the password string. If quotes are used, they are part of the password.

:PWapple,orange
?
:TC1
138 Passwords not identical
:PWapple,apple
:^L^K apple,1

23
Q

REM

A

Remark

REM is used for comment lines. The REM statement is NOT a controller command. Rather, it is recognized by Galil PC software, which strips away the REM lines before downloading the DMC file to the controller.

REM differs from NO (or ‘) in the following ways:

  • NO (or ‘) comments are downloaded to the controller and REM comments are not.
  • NO (or ‘) comments take up execution time and REM comments don’t; therefore, REM should be used for code that needs to run fast.
  • REM comments cannot be recovered when uploading a program but NO (or ‘) comments are recovered. Thus the uploaded program is less readable with REM.
  • NO (or ‘) comments take up program line space and REM lines do not.
  • REM comments must be the first and only thing on a line, whereas NO (or ‘) can be used to place comments to the right of code (after a semicolon) on the same line.

REM This comment will be stripped when downloaded to the controller
‘This comment will be downloaded and takes some execution time
SB1 ;’this comment is to the right of the code and will be downloaded to the controller

24
Q

RS

A

Reset

The RS command resets the state of the processor to its power-on condition. The previously saved state of the hardware, along with parameter values and saved program, are restored.

:RS; ‘ reset the hardware
:RS-1; ‘ perform a soft master reset

25
Q

SB

A

Set Bit

The SB command sets a particular digital output. The SB and CB (Clear Bit) instructions can be used to control the state of output lines.

When an output has been set, current will begin flowing through the optocoupler for that output.

SB 5; ‘ Set digital output 5
SB 1; ‘ Set digital output 1
CB 5; ‘ Clear digital output 5
CB 1; ‘ Clear digital output 1
EN

26
Q

TC

A

Tell Error Code

The TC command reports programming or command errors detected by the controller. The TC command returns a number between 1 and 255. This number is a code that reflects why a command was not accepted by the controller. This command is useful when the controller halts execution of a program or when the response to a command is a question mark.

Refer to table in Command Reference for listing of error codes.

:GF32;’ Bad command
?
:TC1;’ Tell error code
1 Unrecognized command :

27
Q

TI

A

Tell Inputs

The TI command returns the state of the inputs in banks of 8 bits, or 1 byte. The value returned by this command is decimal and represents an 8 bit value (decimal value ranges from 0 to 255). Each bit represents one input where the LSB is the lowest input number and the MSB is the highest input bit.

:TI1; ‘ Tell input state on bank 1
8 //Bit 3 is high, others low
:TI0
0 //All inputs on bank 0 low
:input=_TI1; ‘ Sets the variable, input, with the TI1 value
:input=?
8.0000

28
Q

^L^K

A

Lock Program

Locks user access to the application program. When locked, the ED, UL, LS, and TR commands will give privilege error #106. The application program will still run when locked. Once the program is unlocked, it will remain accessible until a lock command or a reset (with the locked condition burned in) occurs.

‘Galil DMC Code Example
:PW test,test; ‘ set password to “test”
:^L^K test,1; ‘ lock the program
:LS; ‘ attempt to list the program
?
:TC 1
106 Privilege violation

29
Q

^R^S

A

Master Reset

The Master Reset command resets the controller to factory default settings and erases EEPROM. A master reset can also be performed by installing a jumper at the location labeled MRST and resetting the board (power cycle or pressing the reset button). Remove the jumper after this procedure.

‘Example burns-in a non-default value for KP, does a standard reset with
‘the RS command, then performs a master reset with ^R^S.

:KP?
6.00
:KP10
:KP? 10.00
:BN
:RS

:KP?
10.00
:^R^S
:KP?
6.00