Tieval Posted October 17, 2014 Posted October 17, 2014 Hi all, I'm using ABB drives so I am unable to use position compare. Instead, I'm using the following PLCC to generate a pulse output every 0.5mm: OPEN PLCC 0 CLEAR #define TRIGOUT L1 L1->Y:$78402,8 #define MOVE L2 L2->X:$130,17 #define YENC F1 F1->D:$10B #define ENA P81 #define INCREMENT P82 #define STARTENC P83 #define GRID P84 #define RATIO P85 #define TRIGPOS P86 #define TRIGNEG P87 #define TRIGCOUNT P88 #define PULS P89 #define LINESTART P90 #define LINEEND P91 While (ENA = 1) If (MOVE = 0) STARTENC = (LINESTART*RATIO)*3072 INCREMENT = (GRID*RATIO)*3072 TRIGPOS = STARTENC + INCREMENT TRIGNEG = STARTENC - INCREMENT PULS = (LINEEND-LINESTART)/GRID TRIGCOUNT = 0 Else If (YENC > TRIGPOS) Or(YENC < TRIGNEG) TRIGOUT=1 TRIGCOUNT = TRIGCOUNT + 1 TRIGOUT=0 TRIGPOS = TRIGPOS + INCREMENT TRIGNEG = TRIGNEG - INCREMENT EndIf EndIf EndWhile CLOSE This works great whilst the system is on. If I leave the system on, it is consistent. However, if the system is reset or the PMAC reset, the timing changes slightly. I have set I5 to 3 and I8 to 0. Am I doing something wrong? Thanks
Tieval Posted October 17, 2014 Author Posted October 17, 2014 Hi all, I'm using ABB drives so I am unable to use position compare. Instead, I'm using the following PLCC to generate a pulse output every 0.5mm: OPEN PLCC 0 CLEAR #define TRIGOUT L1 L1->Y:$78402,8 #define MOVE L2 L2->X:$130,17 #define YENC F1 F1->D:$10B #define ENA P81 #define INCREMENT P82 #define STARTENC P83 #define GRID P84 #define RATIO P85 #define TRIGPOS P86 #define TRIGNEG P87 #define TRIGCOUNT P88 #define PULS P89 #define LINESTART P90 #define LINEEND P91 While (ENA = 1) If (MOVE = 0) STARTENC = (LINESTART*RATIO)*3072 INCREMENT = (GRID*RATIO)*3072 TRIGPOS = STARTENC + INCREMENT TRIGNEG = STARTENC - INCREMENT PULS = (LINEEND-LINESTART)/GRID TRIGCOUNT = 0 Else If (YENC > TRIGPOS) Or(YENC < TRIGNEG) TRIGOUT=1 TRIGCOUNT = TRIGCOUNT + 1 TRIGOUT=0 TRIGPOS = TRIGPOS + INCREMENT TRIGNEG = TRIGNEG - INCREMENT EndIf EndIf EndWhile CLOSE This works great whilst the system is on. If I leave the system on, it is consistent. However, if the system is reset or the PMAC reset, the timing changes slightly. I have set I5 to 3 and I8 to 0. Am I doing something wrong? Thanks
Recommended Posts