Passcode Check

In this application example, the star key (*) is used for resetting the input code, while the pound key (#) is used to check whether the input code matches the passcode. Therefore, this function begins by checking whether one of these special characters are pressed. If not, the pressed alphanumeric character is added to the pin code input string.

Figure 1. Passcode Processing Overview

If the pound key is pressed and the input code matches the passcode, the green LED is flashed before the input code is reset. If, on the other hand, the input code does not match, the red LED is flashed instead. If the star key is pressed, the passcode is simply reset.

The application implements a fixed length input code of 20 characters. If the length is exceeded, it flashes the red status LED twice and resets the input code.