---
tag: m0512
title: Set Passcode
brief: Set a numeric passcode for locking the machine
author: shitcreek, thinkyhead

group: security
since: 2.0.6.1
requires: PASSWORD_FEATURE

codes: [ M512 ]
related: [ M510, M511 ]

notes:
- Requires `PASSWORD_FEATURE`.
- Use `PASSWORD_LENGTH` to configure the length, up to 9 digits.

parameters:

- tag: P
  description: Current passcode. This must be correct to clear or change the passcode.
  values:
  - tag: password
    type: int

- tag: S
  optional: true
  description: If `S` is included the new passcode will be set to this value.
  values:
  - tag: password
    type: int

example:
- pre: Change passcode from '1234' to '9090'
  code: M512 P1234 S9090

---

Check the passcode given with `P` and if it is correct clear the passcode. If a new passcode is given with `S` then set a new passcode.
