website logo
Home pageWeb storeDistributors
Software
Hardware
Settings
Troubleshooting
Navigate through spaces
⌘K
EdingCNC Documentation
Getting started with your new controller
G-code
Language standard
Supported G-code
Supported M-codes
Other input codes
Special commands
Special features
Macro programming
Run behavior during loading of job file and simulation
Software installation
Interface
Keyboard shortcuts
Docs powered by archbee 

M54, M55, M56, M57 (General purpose IO)

17min

Please note that mentioned commands may fail during loading and/or simulation.

To make your macro code avoid these errors please take a look at the manual section Run behavior during loading of job file and simulation



M54 P...

Set output.

M54 P1 (set AUX1 out to 1)

M54 E... Q...

Set PWM output E to permille value Q (0 <= y <= 1000)

M54 E2 Q500 (Set PWM2 to 50% PWM)

M55 P...

Clear output.

M55 P1 (set AUX1 out to 0)

M56 P...

Read input. The result is stored in variable #5399

M56 P3 (Read AUX in 3) If [#5399 == 1] Msg "AUX3=ON" Else Msg "AUX3=OFF" endif

M56 P ... L... Q...

Read digital input P and specify wait mode, the result is stored in variable #5399

  • P...: the input number
  • L0: do not wait
  • L1: Wait for High
  • L2: Wait for Low
  • Q...: timeout
M56 P3 L2 Q30 (Read AUX in 3) If [#5399 == -1] Errmsg "Timeout while waiting for AUX3 becoming low" Else Msg "AUX3 is off" Endif

Note that we use wait (L2) here, in the event of a timeout, the value of #5399 is -1.

M56 E…

Read analog input E, result stored in #5399

M56 E3 Msg "analog value is " #5399

Read other inputs using M56

M56 P...

Input

P value

Home Inputs

51 – 56 (axis X .. C)

Probe Input

61

Sync Input

62

HWA Input

63

HWB Input

64

ESTOP1

65

ESTOP2

66

EXTERR

67

PAUSE

68

Example: read home-input of X axis:

M56 P51 If [#5399 == 1] Msg "HOME X=ON" Else Msg "HOME X=OFF" endif

Read outputs using M57

Read output x, store result in variable #5399

M57 P...

Output

P value

AUX1-AUXn

1 to n

Machine On

51

Drive Enable

52

Coolant1 (Flood)

61

Coolant2 (Mist)

62

Tool

63

Tool direction

64

M57 E...

Read PWM output, result stored in #5399

M57 E3 If [#5399 == 0] Msg "PWM IS OFF" Else Msg "PWM IS ON, VALUE="#5399 endif

Optional IOCARD

If a relay board is used such as RLY8, the IO number P or E is specified like in the following examples:

  • value of 103 means card 1 port 3
  • value of 208 means card 2 port 8



PREVIOUS
M48 - M53 (Feed-Speed Override Control)
NEXT
M26, M27 (Rotary axis clamping)
Docs powered by archbee 
TABLE OF CONTENTS
M54 P...
M54 E... Q...
M55 P...
M56 P...
M56 P ... L... Q...
M56 E…
Read other inputs using M56
Read outputs using M57
M57 E...
Optional IOCARD