1、PMAC training notePMAC 变量及其功能1. I-变量 (Non-Turbo 1024, Turbo 8192) 初始化和设置参数 有固定的定义 有一部分影响整个卡 有一部分只针对电机 有一部分只针对坐标系 有一部分只针对编码器I-变量类型 开关型 数值型 整型数 浮点数 地址型2. P-变量 (Non-Turbo 1024, Turbo 8192) 通用用户变量 48-bit 浮点数 全局变量P-变量:是用户在进行PMAC编程计算时通用的全局变量 48-bit 浮点数 1024 个从 P0 到 P1023用于: 1.计算 P100=P101*(sin(45) 2. 软件触发
2、 IF( M1!= 1 AND P10 = 0)3. Q-变量 (Non-Turbo 1024, Turbo 8192) 通用用户变量 48-bit 浮点数 座标系变量Q-变量是用户在进行PMAC编程计算时坐标系内部通用的变量 多坐标系时可以用 Q-变量来进行管理Q变量在不同坐标系中的物理地址是不一样的.可以用同一个Q变量访问不同的物理内存地址&1 Q0 访问地址 $1400&2 Q0 访问地址 $1600&7 Q0 访问地址 $1580&8 Q0 访问地址 $1780假设我们有8个坐标系分别运行8个运动程序, 所有的程序都可以用同一个Q变量 Q0 to Q127 而没有冗余因此不会有内存冲突
3、 我们也可以用不同的Q变量来访问相同的物理内存地址&1 Q0 访问地址 $1400&2 Q512 访问地址 $1400&7 Q640 访问地址 $1400&8 Q128 访问地址 $14004. M-变量 (Non-Turbo 1024, Turbo 8192) 提供客户有权使用内存和 I/O 用户定义地址, 偏移量, 宽度M-变量用于访问 PMAC 内存 和 I/O 点的地址指针M-变量没有预先定义. 用户必须自己定义,例如: M9-Y:$FFC2,8,8 ;JOPTO端口 输出一旦定义以后, M-变量就可以进行置位,计算,判别 M9-Y:$FFC2,8,8X: 1 to 24 bits X
4、-memory 固定点Y: 1 to 24 bits Y-memory 固定点D: 48 bits X- and Y-memory 固定点L: 48 bits X- and Y-memory 浮点DP: 32 bits (X and Y 低16位) 固定点 (使用DPRAM时)F: 32 bits (X and Y 低16位) 浮点 (使用DPRAM时)X: 地址, 偏移量, 宽度, 格式Y: 地址, 偏移量, 宽度, 格式偏移量 起始位宽度 缺省为 1; 可以是 1, 4, 8, 12, 16, 20,or 24 位宽 格式 缺省为 U (无符号); 可以是S(有符号 )PMAC1 内存地址
5、 Y :$FFC2 指向 JOPTO port: 8 inputs and 8 outputs在PMAC软件手册中推荐详细的M变量定义 M0-x:$0000,0,24 ;Point to Servo Clock M1-Y:$FFC2,8,1 ;Point to Machine Output 1 M9-Y:$FFC2,8,8 ;Point to Machine Output 1-8 M102-Y:$C003,8,16,s ;Point to DAC 1 output M197-X:$0806,0,24,s ;Point to Feedrate Override M120-Y:$C000,20,1
6、 ;Point to Home Flag Axis 1 M172-L:$082B ;Point to #1 Variable Jog M1000-* ;Self Referenced (pointing to the memory ; location of itself)M-变量使用M1=1 ;Turn on Machine Output 1M9=45 ;Turn on Machine Outputs 1,3,4,6 and turn off Machine Outputs 2,5,7,8 ;45=00101101 binaryPMAC PLC ProgramsWhat is a PLC A
7、 PMAC PLC program is a general-purpose program that runs in PMAC that can run either in background time (for PLC and PLCC) or foreground time (PLC0 and PLCC0) Scans through as fast as processor speed allows before the next servo interrupt Ideal for any task that is asynchronous to motion program seq
8、uences and for jogging and homing routines Some common uses for PLC programs:Monitoring inputs, setting outputsChanging gainsMonitoring card statusCommanding actionsSending messagesJogging motorsConfiguring hardwareStarting or stopping motion programsDifferent Types of PLCsBackground PLCs: PLC (numb
9、ered 1-31, 31 total available):Uncompiled; i.e., interpreted by PMACSlower than PLCC, but can be uploaded easily from PMACPMAC scans completely to the end of one PLC once each background cycle, or if the PLC is in a While loop presently, scans to the end of the loop once each background cycle PLCC (
10、numbered 1-31, 31 total available):Compiled; more efficient and flexible than uncompiled PLCsCan operate 10-30x faster than PLCs when programmed properlyPMAC scans through all background PLCCs (1-31) each background cycleForeground PLCs: PLC0 and PLCC0Special priority PLCs will execute top to bottom
11、 at the end of every Real Time Interrupt (RTI)Execute every real-time interrupt as long as the tasks from the previous RTI have been completedKeep these short to prevent starving background of time or tripping Watchdog timerWhat Makes a PLCC So Much Faster The faster execution of the compiled PLCs c
12、omes from two factors: From the elimination of interpretation timeFrom the capability of the compiled PLC programs to execute integer arithmeticSee “Optimization for Speed” on page 380 of the Turbo PMAC User Manual Floating-point operations in compiled PLC programs run two to three times faster than
13、 in interpreted PLC programs; integer (including Boolean) operations run 20 to 30 times faster in compiled form Can use L-Variables for fast integer arithmetic just replace your M-Variable definitions using L-Variables L- and F-Variables are pointers linked at compile time, rather than at runtime li
14、ke M-Variables areBackground PLC/PLCC Execution OrderExecution order:PLC0 and PLCC0 are at a higher priority level and can interrupt any of the background PLCsEvery PLCC scans through between each PLC scanUncompiled: PLC1, 2, 331Compiled: PLCC1, 2, 3, 431Writing and Downloading a PLC All PLCs must h
15、ave an opening statement and a closing statement, e.g.:Open PLC 1 Clear/ PLC ContentsCloseOpen PLCC 1 Clear/ PLCC ContentsClose Once written in the Editor window (from PeWin32Pro2 click FileNew File), click the “Download” button to download to PMACEnabling and Disabling a PLC Set I5 to permit the PLC types you plan to use:I5 SettingSetting Meaning0Foreground PLCs off; background PLCs off1Foreground
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1