User Tools

Site Tools


plc:software_plc_examples

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
plc:software_plc_examples [2019/07/12 09:26] ivanplc:software_plc_examples [2021/02/03 16:04] ivan
Line 261: Line 261:
 }; };
  
 +</code>
 +
 +
 +===Switching an output ON for a certain period of time===
 +
 +<code>
 +#define OUTPUT_TIMER 15
 +main()
 +{
 +count=0;
 +do{
 +a=gvarget(7373);
 +
 +if (a!=0)
 +{
 +  count++;
 +  if (count<30) { portset(OUTPUT_TIMER); }
 +  else { 
 +            portclr(OUTPUT_TIMER); 
 +            if (count>6000) { count=0; };
 +          };
 +}else
 +{
 +  portclr(OUTPUT_TIMER);
 +  count=0;
 +};
 +}while(1);
 +exit(99);
 +};
 </code> </code>
  
plc/software_plc_examples.txt · Last modified: 2022/03/29 15:55 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki