In motion control, the motion axis 0 is a common problem: for semi-closed-loop encoder + motor + module or full-closed-loop linear motor + grating, they are able to know what position they are in today is the encoder and grating to record the current position , The problem is that we usually use a relative encoder or a grating , in other words, we have to tell the encoder and the grating where to start calculating the current coordinates as 0 o'clock , and the process of specifying the current 0 point is back to 0 . . The relative encoder or the grating ruler once the power down, must return to 0, this is also most CNC machine tool power to return 0 reason.
For example, in order to specify 0 points of the current motion system, we use a 0-bit sensor to mark, for the encoder + motor + module, 0-bit sensor is a 0-bit limit sensor , for linear motor + grating can not set special hardware, directly capture the grating ruler of the 0-bit signal Yes, of course you can also use a limit sensor to specify 0 bits without a 0-bit signal. At the same time, each motion system is generally positive and negative limit, on the one hand, as a safe use, once the module movement beyond the positive and negative limit range automatically stop the motor to prevent harm, on the other hand, can also be used as a trigger, the following will be discussed.
1. Triggering of the signal
In order to illustrate the problem of the image, consider the following relative motion of the module and the sensor, where the sensor can be either a limit sensor or a 0-bit point trigger, the basic principle is the same. Here to illustrate the problem, the sensor is elongated, in fact the contact length of the sensor is very short.
It can be seen that the current module and the sensor relative movement, when not in contact with the signal is low, once the module starts to enter the sensor range, when the level jumps to high level, there is a rising edge, capturing this rising edge is the module just entered the sensor range of the moment. The module continues to move, and once the module completely leaves the sensor range, the level jumps to low levels, there is a falling edge, and capturing this falling edge is the moment when the module has just completely left the sensor range.
Because the first time did not return to 0, the module is not aware of their current position in the end, but when the high and low level of the transition will send an interrupt, we can capture the two interrupts to determine whether the current module movement to the specified position , so that the current specified position is marked as 0 points.
2. Back to the 0 strategy above has actually described the most basic thought:use the top and bottom edge of the signal trigger to tell if the PMAC has moved to the specified position, thus marking the position of the current module as relative to 0 points。 However, one of the problems we need to face is that the initial position of the module is uncertain. In the same way that the previous diagram, the first time the module may be in the 0-bit forward is also likely to be negative, or even directly on the positive or negative limit or 0 points. At this time how to write a back 0 program, in the first do not know the position of the module when the module to the correct movement to 0 points?
There is no doubt that the module in the forward direction must be negative to move to the 0 point trigger, the module must be negative to the positive movement in order to 0 point trigger, but they are in the opposite directions, which let us write the motion program is very difficult. To solve this problem, we use the following strategy:
- 1. Regardless of the current module position, the first negative motion until the negative limit is triggered
- 2. From the negative limit trigger point to the positive movement, PMAC is done by specifying an offset value, the so-called offset is to reach the trigger point and then offset how much distance, this offset requires that the module must be moved to 0-bit forward
- 2. Then, the module negative movement until exactly stop at 0 point Trigger Point, the current mark is 0 points
OK, now the basic strategy is settled. Now let's talk about the problem of offset value. When we move to the specified limit causing the level to appear up and down along the signal, this time the PMaC is interrupted, but still in motion,does not stop exactly at the specified point。 For this problem, the solution provided by PMAC is thatsince it cannot be stopped accurately, it is not allowed to stop exactly at the specified trigger point, but instead specify an offset valueWhen the first upper and lower edge is triggeredthe current location is recorded, the current position can be accurately recorded, somotion to offset a specified valueCan be done, of course, this value is not too small, or it is not allowed to stop. So to stop at a point exactly how to do it, very simple, draw on this method, since you have to run, thenlet you run first, and then reverse back the offset value ., this is a lot of machine tool look back to zero first over 0 points back to the reason, see the sports platform in that do not know the so-called back and forth, its hard work is this thing. The specified offset value in the PMAC is 0, and it is carefully observed that the PMAC will help us through the process of coming back, which needs to be understood so that we can understand why the entire 0 trajectory is running and why the offset value is used.
Look back at the 0 process below
can see:
- 1. Negative movement to negative limit until triggered, there are two cases:
A. In the absence of a negative limit, the direct negative movement until the rising edge triggers B. At the time of the negative limit, the forward movement until the falling edge triggers the attention of one using the rising edge, one using the falling edge, is to ensure that the module position is the same when the two conditions are triggered
.
- 2. Move the shift offset value specified in step 1 to the positive direction of the 0-bit, as long as the offset value is specified, PMaC automatically completes the migration process
- 3. The negative movement from the position after the offset, according to the previous said to go through a point and then reverse back to the exact stop in 0 bits, the offset may be very small, the human eye is not easy to observe.
3.PMAC back 0 code A separate axis of the typical back 0 program is as follows:
; program function: Realize 6 axis back 0 movement; **********************************************************************close; confirm that all buffers are closed &1;~ ~~~~~~~~~~~~~~~~~~~~~~~~ The following section for the motion program ~~~~~~~~~~~~~~~~~~~~~~~open PROG 20clear;6 axis back 0 if (M622 = 1) ; Negative limit has a signal i623=50, return 0 speed (counts/msec), the direction is positive i626=81920*16 ; back 0 bias, Unit 1/16 counti7123=2 ; Use negative limit for trigger signal i7122=10 capture trigger signal falling along home 6, back 0 dwell 20Else, negative limit no signal i623=-50 , back 0 speed (counts/msec), direction is negative i624=$120000, disable limit i626= 81920*16 ; Back 0 offset, unit 1/16 counti7123=2 ; Use negative limit to trigger signal i7122=6 ; capture trigger signal rising edge Home 6 ; Back 0 dwell 20endifi623= -50 ; back 0 speed (counts/msec), the direction is negative i624=$100000 ; enable limit i626=0 ; Back 0 offset, unit 1/16 counti7123=0 ; Using the in situ signal as the trigger signal i7122=7 , capturing the rising edge of the trigger signal and the falling edge of Z Direction home 6 ; Back 0 dwell 50CLOSE
The code needs to be explained as follows:
- 1. Use the negative limit to mark the time, must be forbidden to limit, otherwise, once the module movement to the limit sensor will automatically stop the current motor
- 2. When back to position (0-bit), the capture mode is set to 7, which supports both the encoder's rising edge and the 0-bit signal of the grating ruler.
- 3. In the first two steps, the speed can be faster, the last step accurately back to 0 when the speed is slow
Here's back to 0 code the author has used in various projects, stable and reliable, the specific parameter meaning please consult the manual.
Original, reprint please indicate from http://blog.csdn.net/wenzhou1219
7.PMAC Next machine-back to 0 program writing