SCL 18
FB XPSUS12AC By jledun on 23rd April 2026 04:01:08 PM
  1. // compteur de secondes
  2. #cnt := #cnt + #ct;
  3.  
  4. // cadence atteinte
  5. IF #cnt >= 0.2 THEN
  6.     #timeout := #timeout + #cnt;
  7.     #cnt := 0.0;
  8.     #wd.%X0 := #z1;
  9.    
  10.     IF #run THEN
  11.         #i := #i + 1;
  12.        
  13.         // les 6 bits ont été lus
  14.         IF #i >= 6 THEN
  15.             #run := FALSE;
  16.             #status := #wd AND 16#003F;
  17.             #wd := 16#0000;
  18.         END_IF;
  19.     ELSE
  20.         // déclencheur lecture des 6 bits de diagnostic
  21.         IF (#wd AND 16#000F) = 16#0002 THEN
  22.             #i := 0;
  23.             #run := TRUE;
  24.             #timeout := 0.0;
  25.         END_IF;
  26.     END_IF;
  27.    
  28.     // ROTATION DU REGISTRE DE DECALAGE
  29.     #wd := ROL(IN := #wd, N := 1);
  30.    
  31. END_IF;
  32.  
  33. #moduleOk := FALSE;
  34. IF #timeout <= 5.0 THEN
  35.     #moduleOk := #status = 16#2F;
  36. END_IF;

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.