Wie können wir helfen?
Generate a new user password from the day and month values or manually from the HMI screen
Goal
The goal here is to generate a new password each day for a user that can be calculated mentally. The benefits can be varied:
- Improved security: A password that changes daily reduces the risk of unauthorized access.
- Reduced reuse risks: This minimizes the risk associated with reusing passwords across different sites.
- Easy to remember: No need to memorize or write down the password, as it can be calculated mentally.
- Less dependence on external tools: Avoids the need to use password managers.

The HMI screen
Here we have:
- The currently logged-in user and their password
- The new password we want to enforce
- The button to confirm the new password
- An indicator that changes state each day, for testing and information
- The login and logout buttons
The script
The script handles the conversion of the date, month and password to ASCII.
The date and month are converted from BCD to DECimal.
The formula here for the password is: password = (day * month) * 20
#include "MacroInit.h"
//#include "subFun1.c" //Example
void Macro_main(IN *p)
{
MarcoInit
//ToDo
int i;
// Function copies a string of 16 characters from a source position to a destination position in LocalWord
void copyString(int sourceStart, int destStart) {
for (i = 0; i < 16; i++) {
LocalWord[destStart + i] = LocalWord[sourceStart + i];
}
}
int day=BCD2BIN(LocalWord[60003]);
int month=BCD2BIN(LocalWord[60004]);
int dateofweek=BCD2BIN(LocalWord[60006]);
static int previousdow;
if (dateofweek != previousdow) {
previousdow = dateofweek;
LocalBit[0]=1-LocalBit[0]; // Display if new day
int password = day * month * 20; // Calcul the new password (your formula)
char *asciiStr = (char*)&LocalWord[60441];
snprintf(asciiStr, 17, "%d", password);
LocalWord[60449] |= 0x0001;
}
}
The HMI project
You can download it here