User Tools

Site Tools


plc:ferror_implementation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

plc:ferror_implementation [2018/09/24 21:16]
skirillov created
plc:ferror_implementation [2018/09/24 21:41] (current)
skirillov
Line 1: Line 1:
 ===== FERROR implementation ===== ===== FERROR implementation =====
  
 +
 +<code C FERROR.plc>​
 +main()
 +{
 +
 +do{
 +
 +
 +    ferror=0;
 +    n=0;
 +    a0=gvarget(9016);​ if (a0<0){ a0=0-a0;};
 +    a1=gvarget(9017);​ if (a1<0){ a1=0-a1;};
 +    a2=gvarget(9018);​ if (a2<0){ a2=0-a2;};
 +    a3=gvarget(9019);​ if (a3<0){ a3=0-a3;};
 +    a4=gvarget(9020);​ if (a4<0){ a4=0-a4;};
 +    a5=gvarget(9021);​ if (a5<0){ a5=0-a5;};
 +
 + 
 +    if (a0>​5) ​ {ferror=1;​};​
 +    if (a1>​5) ​ {ferror=1;​};​
 +    if (a2>​5) ​ {ferror=1;​};​
 +    if (a3>​5) ​ {ferror=1;​};​
 +    if (a4>​5) ​ {ferror=1;​};​
 +    if (a5>​5) ​ {ferror=1;​};​
 +
 +
 +    if (ferror!=0) //turn off ALL the servos
 +     {
 +       ​gvarset(60001,​1); ​ //Servo OFF
 +     };
 +
 +}while(1);
 +
 +exit(99);
 +};
 +
 +</​code>​
  
plc/ferror_implementation.txt · Last modified: 2018/09/24 21:41 by skirillov