rio application programming

Post on 11-Jul-2015

1.018 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

RIO 471x0 ManualApplication Programming

Hsu Hui-Kuang

Agenda• Program Format

• Executing Programs

• Debugging

• Program Flow Commands

• Math & Functional Expressions

• Variables

• Operands

• Arrays

• Input of Data

• Output of Data

• Programmable I/O

Program Format

• `

• 80 Characters

Program Lines Greater than 40 Characters

Program Format

• PW / ^(cntl)L^(cntl)K

Lock Program Access Using Password

Executing Programs

• XQ #A,n / HX n

• 4 Thread

• IN Command(Only Thread 0)

Multitasking

Debugging

• Trace Command TR1

Debugging

• Error Code

• RAM Memory Interrogation

MG _ED

TC0/TC1

DM?DA?LV/LL/LA/LS

Debugging

• Operand_ED last line of program execution_DL available label_UL available variable_DA the number of available array_DM

Program Flow

• Interrupt

• Event Trigger

II#ININTn

AIJPII

Program Flow

• Condition Jump

• IF, ELSE, ENDIF

JS/JPMultiple Condition Jump|,&,<>,<=,=>

Nesting IF(Up to 255 IF)

Program Flow

• Stack Manipulation

• Automatic SubroutineZS 0/ZS 1

#AUTO#AUTOERR#ININTn#CMDERR#TCPERR#COMINT

Program Flow

• Automatic Subroutine

MultiThread Application handle CMDERRXQ _EDn

_ED1 returns the number of the thread that generated an error_ED2 retry failed command_ED3 skip failed command

XQ _ED2(OR _ED3),_ED1,1

Math & Function Exp

• Math Operator

• Bit-Wise Operator

+,-,*,/,%,()

&,|

Math & Function Exp• Functions

@SIN[n] @RND[n]@COS[n] @SQR[n]@TAN[n] @IN[n]@ASIN*[n] @OUT[n]@ACOS*[n] @AN[n]@ATAN*[n] @AO[n]@COM[n]@ABS[n]@FRAC[n]@INT[n]

Variables

• Variables

126 Variables8 CharactersNumerical range:

4 Byte Integer followed by2 Byte Fraction

Operands

• _

• Special Operands_BN return serial # of the board_DA return the number of array available_DL return the number of available label_DM return the available array memory_UL return the number of available variableTIME real-time clock

Arrays

• 400 elements / 6 arrays

• DM/DA

• QU/QD

• Automatic Data Capture

RARDRC

Input of Data

• IN Instruction

• RS-232 Only

Output of Data

• MG

• {Sn}/{Fn.m}/{Zn.m}/{^n}

• VF Global Variable Formatting

Programmable I/O

• Digital Output

• Digital Input

SB / CBOB / OP

@IN[n]TI

Programmable I/O

• Analog Input@AN[n]AQAA

access from Data Record :

N= (((V-Vlo)*4095)/(Vhi-Vlo))*8

Programmable I/O

• Analog Output

AODQ (RIO-47120)

access from Data Record:

N= ((V-Vlo)*4095)/(Vhi-Vlo)

The END

top related