logo资料库

5_AOI指令学习心得.pdf

第1页 / 共8页
第2页 / 共8页
第3页 / 共8页
第4页 / 共8页
第5页 / 共8页
第6页 / 共8页
第7页 / 共8页
第8页 / 共8页
资料共8页,全文预览结束
RSLogix5000 AOI 用户自定义指令学习心得 Created by Jackwell Cheung, Copyright of Jackwell Automation www.plcab.cn jackwellcheung@gmail.com 1、定义 AOI 中的输入参数 Input Parameter Input Paramter 用法: For an Add-On Instruction, an Input Parameter defines data that is passed into the instruction. Input Parameters can accept a literal value or a tag as an argument. The value is passed to the instruction before execution. The data type of an Input Parameter can be any valid atomic data type. The parameter's value is also accessible through a member of a tag, which is of the Add-On Instruction's data type. SINT, INT, DINT, REAL, or BOOL data type. In our example, Input_a1 is defined to be an Input Parameter. Input_a1 can be accessed from outside of the AOI. Input Parameter 用来传递用户自定义功能块中的输入变量。传递的给功能块 的变量类型要与定义功能块时的对应变量类型相匹配。 Input Parameter - passed by value into the Add-On Instruction. Must be a 勤知达科技 1
2、定义 AOI 中的输入参数 Output Parameter Output Paramter 用法: For an Add-On Instruction, an Output Parameter defines data that is produced as a direct result of executing the instruction. An Output Parameter can only accept a tag as an argument, which is passed as a value back after execution. The data type for Output parameters can be any valid atomic data type. The parameter's value is also accessible through a member of a tag, which is of the Add-On Instruction's data type. This value is updated as result of executing the Add-On Instruction. passed by value out of the Add-On Instruction. Must be a SINT, INT, DINT, REAL, or BOOL data type. In our example, Output_a1 and Output_a2 are used as Output Parameters. Output Parameter 用来传递用户自定义功能块中的输出变量。传递的给功能 块的变量类型要与定义功能块时的对应变量类型相匹配。 3、定义 AOI 中的输入/输出参数 Inout Parameter 勤知达科技 2
Inout Parameter 用法 For an Add-On Instruction, an InOut Parameter defines data that is used as both input and output during the execution of the instruction. An InOut Parameter is passed by reference, meaning the logic deals directly with the tag passed to the instruction. InOut parameters can be any valid data type because they are passed by reference. This includes message, motion group, all axis, and module data types. Any data structures or arrays that need to be passed to an Add-On Instruction must be done using InOut Parameters. Inout Parameter 用来传递用户自定义功能块中的输入/输出变量。传递的给 功能块的变量类型要与定义功能块时的对应变量类型相匹配。Inout Parameter 参数能够传递给功能块并在该功能块内进行运算更新,然后把更新后的值进行输 出。 4、定义 AOI 中的本地标签 Local Tag 勤知达科技 3
LocalTag 用法: For an Add-On Instruction, Local Tags are used strictly by the instruction and not the user of the instruction. As such, Local tags are not available as members in the data structure when a tag is of the Add-On Instruction data type. Local tags are typically used for instructions internal to the Add-On Instruction or for tags that are used as retentive intermediate values in some operation. Local tags can be viewed only from within the Add-On Instruction definition. 本地标签,只能在功能块内部进行操作,不能对外传递参数。 AOI_1 自定义功能块全部参数 勤知达科技 4
添加 AOI 指令后,在 Add-On-Defined 中会自动显示 AOI 指令里面定义的参数, 并且可以选择哪些参数是可以在该功能块中显示出来的。 每一个 AOI 功能块都有自己独立的数据,相互之间不互相影响。在 AOI 指令中 单击右键,点击 Open Instruction Logix 可能打开 AOI 后台的指令代码。 勤知达科技 5
注意:可以监视此段代码,但是不能在代码上进行操作! 勤知达科技 6
单击 AOI 右侧的按钮可以查看 AOI 关联的参数的值。 AOI 用户自定义功能块可以进行封装保护,封装后不影响该功能块的功能使用, 但是无法查看到源代码。可以起到知识产权保护作用。 勤知达科技 7
先安装 RS5KSrcPtc 软件 勤知达科技 8
分享到:
收藏