For example:
Instruction
Interpretation
OP6
Sets bits 1 and 2 of bank 0 high. All other bits on bank 0 are 0. (21 + 22 = 6)
OP0,0
Clears all bits of bank 0 and 1
OP0,7
Sets output bits 0, 1 and 2 to one (20 + 21 + 22 ) on bank 1. Clears all bits on
bank 0.
The state of the digital outputs can be accessed with the @OUT[n] where n is the output number (Ex:
MG@OUT[1] displays the state of output number 1).
Digital Inputs
The digital inputs are accessed by using the @IN[n] function or the TI n command. The @IN[n] function
returns the logic level of a specified input, n, where ‘n’ is the input bit number. The IQ command determines
the active level of each input. The TI n command gives the input status of an entire bank, where ‘n’ is the
bank number, 0 or 1. The AI command is a trip-point that pauses program execution until the specified
combination of inputs is high or low.
Example – Using Inputs to control program flow
Instruction
Instruction
JP #A,@IN[1]=0
Jump to A if input 1 is low
MG@IN[2]
Display the state of input 2
AI 7&-6
Wait until input 7 is high and input 6 is low
Analog Inputs
Analog inputs are accessed with the @AN[n] function where n is the number assigned to the analog input
channel. The returned value will be a voltage reading with 12 bit resolution (16bit optional on RIO-47120).
The standard voltage range is 0 to +5VDC on the RIO-47100. The voltage input range is configurable on the
RIO-47120 using the AQ command.
Note: When analog input values are accessed from the Data Record or from the Record Array function, the
returned value will be an integer number that represents the analog voltage. For a RIO-47100, the equation
used to determine the decimal equivalent of the analog voltage is as follows:
N= (((V-Vlo)*4095)/(Vhi-Vlo))*8
Where N is the integer equivalent of the analog voltage, V is the expected analog voltage, Vlo is the lowest
voltage in the total range (0V for the standard analog input module) and Vhi is the highest voltage in the total
range (5V for the standard module). The data range for N is 0-32760.
These integer values will also be returned when accessing the analog inputs by the API calls in C/C++ or
Visual Basic.
The AQ command also configures the analog inputs to be either 8 single ended (default) or 4 differential
inputs.
The AA command is a trippoint that halts program execution until the specified voltage on an analog input is
reached. The third field of the AA command controls whether the trippoint will be satisfied when going
higher or lower than the voltage. With a command such as AA 1,4.5,0 - if the specified voltage is exceeded
prior to arrival at the AA command, the program will continue to execute without a pause. Analog inputs are
useful for reading special sensors such as temperature, tension or pressure. The range of AA is dependant on
the AQ setting. Here are some examples of using the Analog inputs:
RIO-47xxx
Chapter 5 Programming
●
73
Содержание RIO-47**0
Страница 2: ......
Страница 93: ...RIO Dimensions RIO 471xx Units in centimeters RIO 47xxx Appendix 87...
Страница 94: ...RIO 472xx Units in millimeters 88 Appendix RIO 47xxx...
Страница 107: ...Internal 56 64 Zero Stack 53 RIO 47xxx Index 101...