The lower machine programming of PMAC consists of three programs: Command sequence program, motion program and PLC program.
In the PMAC program, the file->new new file opens the editor and all the files are PMC suffixes. The current program can be viewed in the File->uplaod programs to view the current program and PLC programs and their number, status.
1. Command sequence in the section, the PMAC card can use manual operation, the command line to set the parameter status, control motor, etc., but it can only send one command at a time, so in order to run multiple command sequences at once, you can write in the PMC program as follows:
i620=200i621=20i622=10#6j/
This first sets the motion parameters of the 6-axis motor, and then activates the motor, which is often used in the initialization of the PMAC parameters. Once the program has been written, click the Download button,The Command series program is executed during the download process.。
For example, tick Show Message window to open the Mesage
For example, in the message window you can see whether the current program has errors, etc., similar to the C language compilation process.
Command sequences are often mixed with PLC programs and motion program programs, as explained below.
2. 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 put the current motion into a realistic coordinate system of motion, the actual line we specify in the program x Motion 1 units is motor movement 819.2 pulses, converted into the axis of the movement distance is 1mm, so the program is simple and easy to understand.
The template for the standard sports program is as follows:
&1; coordinate system 1CLOSE; Confirm that all buffers are closed open PROG 40; The program number is 40CLEAR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exercise program subject-start;;;;;;;;;;;;;;;;;;;;; Motion program body-Close close
These instructions are command commands, so they are all run when the program is downloaded, and the motion program body is written to a specific buffer, but at this point the program does not run.
Write a simple program as follows:
&1close; Confirm that all buffers are closed #6->819.2x; manipulator x-direction, unit mm, (819.2=8192/10, screw lead 10mm) #8->819.2y; robot y, Unit mm, (819.2=8192/ 10, screw lead 10mm) #6j/#8j/open PROG 40CLEARINC; incremental motion mode X (Ten) Y (10); X Positive direction forward 10mm,y positive direction 10mmCLOSE
Note here that the definition of the axis and the activation of the motor are accomplished using a sequence of commands, but the two lines of motion program code in the middle are simply written to the corresponding buffer and not yet executed. Entering commands in the terminal window&1b40rThe program is not running. Note that all motors associated with a coordinate system must be activated for the motion program to function properly. In practice, the definition of the axis and the activation of the motor are best placed in a separate command sequence file.
The following is a more complex program:
&1close; Confirm that all buffers are closed #6->819.2x; manipulator x-direction, unit mm, (819.2=8192/10, screw lead 10mm) #8->819.2y; robot y, Unit mm, (819.2=8192/ 10, screw lead 10mm) #6j/#8j/open PROG 40CLEAR, motion parameters set TA (+); MsTS; MsF (mm/sabs; absolute mode linear; linear motion P1 = 0While (P1 < 10) F (a) X (2) y (Ten) F (Ten) X (Ten) y (in) If (P1 >) Return EndIf p1=p1+1endwhileclose
The meaning of the above program is from the current position at a speed 50mm/s linear motion to the position of absolute coordinates (30,10), and then from the current position at a speed 10mm/s linear motion to the position of absolute coordinates (10,30), so loop, if there is no if statement, Loop 10 times, But this adds an if statement that loops only 2 times.
The basic exercise program is this way, and then the complex motion program is extended on this basis. All kinds of motion instructions please checkPMAC Software ManualManual, the corresponding program is written please checkPMAC User ManualManual.
3.PLC Motion Program in the electrical system, the PLC is often used in the control element, is the rapid scanning of various states, the scan to the state changes to do the corresponding treatment. His real-time nature is very high, simple and reliable. In PMaC there is the function of Analog plc. Also for the last instance function in the motion program, rewrite the following:
Exercise Program:
&1close; Confirm that all buffers are closed #6->819.2x; manipulator x-direction, unit mm, (819.2=8192/10, screw lead 10mm) #8->819.2y; robot y, Unit mm, (819.2=8192/ 10, the screw lead is 10mm) #6j/#8j/open PROG 40CLEARTA ($), MsTS, MsF (mm/sabs; absolute mode linear; linear motion P1 = 0While (P1 <) F ( x (+) y (+) F (Ten) X (Ten) y (+) P1=p1+1endwhileclose
PLC Program:
OPEN plc 20CLEARIf (p1 = 2) COMMAND "&1b40a" EndIf closeenable PLC 20
In general, we let the PLC program always run in the background, scanning the specified state, here we download plc when the activation of the PLC program. When you enter &1b40r to run a motion program in terminal, the program is terminated as soon as P1=2,PLC can be scanned to that state by default.
Here originally the motion program will run two loops, but because of the lookhead function of PMaC, here only run a loop to abort the program, first leave a suspense, immediately said.
4.PMAC Motion Program Lookhead function PMaC in the execution of the Lookhead function, as the name implies is a forward-looking function, that is, in the execution of the time will be read ahead of the execution of the following code, for the motion trajectory-related code will be pre-calculated, variable assignment will advance. Analysis such as the motion program, in the second cycle, the pre-read the entire loop content, that is, the motion instruction is not running, P1=p1+1 has been executed, when the PLC detects P1 changes will abort the program. So what to do here to avoid the side effects of pre-reading, it is very simple, in X (Ten) Y (30) plus a sentence dwell 0 can, this tells the exercise program, pre-read to this location or must dwell 0 before the execution of the program will be done after the next operation.
Lookhead will also bring other effects, such as a right angle turn, opened the Lookhead after the actual running trajectory for the round corner, this should be noted, specific please refer to the manual.
Original, reprint please indicate from http://blog.csdn.net/wenzhou1219
6.PMAC slave-Lower machine programming