5.PMAC Lower machine-lower machine programming Introduction

Source: Internet
Author: User

The programming of the subordinate machine of PMAC involves three aspects: manual operation, motion program and PLC program. This is mainly about the basic programming aspects of the various aspects, there are many need to explore on their own.

Variable

The subordinate machine of PMAC is actually a kind of basic programming language, but similar to assembly language, all variables storage space is pre-allocated, when the operation of the storage data can only be stored in the specified variable type and variable name, the whole system parameters are stored in the variable.

The variable types and functions are as follows:

I variables: parameters such as card, motor and encoder are used to set the motor speed, accuracy, back 0 and other values, as well as the state of the coordinate system, the feedback form of the encoder, PID parameters and so on, in a word, set the system parameters on it.

Examples are as follows:

ixx19-> Max manual Acceleration Limit

ixx20-> Manual Acceleration Time

ixx22-> Manual Speed


m Variable: when working in PMaC, the current running state (motor parameters, encoder position, IO parameters) is placed in the specified memory, we want to see this part of the parameter, only need to use the M variable binding specified memory can be accessed and set, a bit like a C language pointer, However, the general m parameter is set in Pewin32 using the default m parameter definition.

Examples are as follows:

read motor status, given position ( mx61) , actual location (mx62) , Position deviation ( mx64) which x=1-16 or 1 - -

Read I/O Port Status M11

in the computer's learning software, monitoring procedures and the programming process of the next computer program, the current position of the motor, I/O port status and other data, collected by M variable to complete.

p Variables and Q variables:

Pvariables and q variables are available forPMACthe calculation in programming,48-bit floating-point form,Pvariable isP0 ~ p8191,q variable is q0~q8191, different card p variable and q variable quantity are slightly different. The difference between p and Q variables is that the former is a global variable that can be changed at any time in any program or position, which directly affects other programs or states, while the Q variable is a local variable in a single coordinate system, and the concept of the coordinate system is described later. The main uses are as follows:1.can be used for calculation functions. p100=p101*452.can be triggered as a flag bit softwareIF (m1!= 1 and P10 = 0)


Manual Operation PMaC Manual operation is mainly for debugging convenience, the main instructions are as follows, you can test yourself in the view->terminal window: 1. View and set the values of i/p/m variables for various types of variables 2. Control motor Operating State
Of course, in addition to the console, the following are commonly used: use View->position to view current motor position, speed and acceleration using view->motor status to view current motors, limit switches, IO, etc. view and set I, M, P in Parameter settings , q variables
Several commonly used motor manual operation instructions are to be noted, as follows:j+-JogForward Continuous motionJ --JogInverse Continuous Motionj/-JogMotion Stop(or Closed loop)j={Constants}-Jogto the specified location(Unit is Pulsecounts)j^{Constants}-Jogthe distance specified from the current actual position movementCtrl +k K off all motors
Exercise ProgramTo facilitate the writing of motion programs, the concept of a coordinate system is used in PMaC, such as the number 6th motor and the No. 8th motor, which we map to the x and Y coordinates in a coordinate system, as shown below
&1#6->819.2Y, Robot y-direction, unit mm, (819.2=8192/10, screw lead 10mm) #8->819.2x; manipulator x-direction, unit mm, (819.2=8192/10, screw lead 10mm)
So when we program, we can directly think of the current motion into a realistic coordinate system motion, for example, we want to 6-axis motor forward motion 10mm,8 Axis Motor Forward motion 10mm, then the complete program is as follows:
program function: Realize linear motion of XY platform 6 and 8 axes; **********************************************************************close; Confirm that all buffers are closed &1#6->819.2Y, Robot y-direction, unit mm, (819.2=8192/10, screw lead 10mm) #8->819.2x; manipulator x direction, unit mm, (819.2=8192/10, screw lead 10mm); ~ ~ ~ ~~~~~~~~~~~~~~~~~~~~~~ the  following part is the motion program  ~~~~~~~~~~~~~~~~~~~~~~~open PROG 30CLEAR; Define the motion parameters of the rectangle motion linear; linear motion Mode abs ,  using absolute coordinate TA (200), Acceleration time, Unit: Millisecond TS (50); S-Curve Acceleration time, unit: milliseconds f (x),  Motion speed unit: unit distance/unit time, unit distance determined by axis definition, unit time determined by I5390 or I5490 × (ten) Y (Ten) CLOSE

is so simple, &1b30r can see the effect, of course, the exercise program commands a lot, you can set the circle, curve and other motion trajectory, specific please check the manual!
PLC motion program in the electrical system, PLC is often used in the control element, in PMaC has the function of Analog plc. Plainly speaking, there is a background program in the fast scanning each state, the scan to the state changes to do the corresponding processing. As in the following paragraph Simple PLC program:
; program function: Achieve the XY platform 6, 8 axis stop; **********************************************************************close; confirm that all buffers are closed; ~ ~ ~ ~~~~~~~~~~~~~~~~~~~~~~ the  following part is the motion program  ~~~~~~~~~~~~~~~~~~~~~~~open PLC 2CLEARIf (p1000=1); Detect p1000 value, This confirms whether the program stops the cmd "&1a" Command^kdisable plc 2EndIfCLOSEENABLE PLC 2

This plc in the PLC download to flash after the completion of the time directly open PLC2, and then cycle check p1000, based on this judgment.

To say a word, in fact, these hardware use are very much the same, mainly to see manuals and practices, there is no special attention to matters, here I just about the basic terms and content described below. Other self-operation is almost the same, especially the PMaC this fool-level control card is easy to get started, basically have problems to check the manual on the line, pay attention to learning methods, understand the approximate-operation-view manuals, detailed I will not write, and manuals, journal boring.
The following is mainly about the PMAC host computer programming problems, during the period will be interspersed with some of the knowledge of the lower machine.

Original, reprint please indicate from http://blog.csdn.net/wenzhou1219

5.PMAC Lower machine-lower machine programming Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.