User Tools

Site Tools


plc:m07_mist_coolant_on

M07 - Mist Coolant ON

Normally M07 function is the simplest PLC procedure. It should just turn ON 1 relay and exit. PLC source code will look like -

M07.plc
main()
{
  portset(5);
  exit(99);  //normal exit.
};

Output #5 is used as coolant pin.

According to smart programming books it is a good style to avoid direct numbers in source code (portset(5)) and use variable or define names instead.

In this case source code will be

M07.plc
#include pins.h
main()
{
  portset(OUT_COOLANT);
  exit(99);  //normal exit.
};

name “OUT_COOLANT is defined in “vars.h” file which is included in the first line.

pins.h
#define OUT_COOLANT   5
plc/m07_mist_coolant_on.txt · Last modified: 2017/10/02 15:38 by skirillov

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki