So I need to be able to give 10 people passwords to the machine and I need to make a log of when they are used.
...
I need to store when the passwords are used for x amount of time or cycles
Yes, you can do password management in the PLC if you really want to. We had to do that back in the ancient days, when an MMI was a really dumb terminal, acting as remote I/O even, with no connection to the outside world.
You could create a string array (or type of string -- say limited to 10 chars) or DINT (if you want a PIN type password). Better make it 50 long so that it's future-proof.
Use the FSC instruction to find if the password entered matches one in the list. RES the FSC's control word when your ready to search. If the .FD bit gets set but the .DN is not, it means the instruction found a match. .POS gives the location in the array of which password was a hit.
The "logging" thing needs more design decisions, I think. It may be that instead of creating a string array, you create an array of a UDT that includes password, a timer, and a counter and perhaps some sort of "active" bit. When the FSC.FD bit is set, it latches the active bit, which enables logic for tracking the time / cycles the user has. When those are done, the active bit gets reset.
Or by "log" you want a history of which password was used when? Building a timestamp string in the PLC is easy. Storing thousands of records (UDT array of {Password, Timestamp} is again doable, but PLCs have fixed memory, so just how far back do you need to keep these records? Better to use a historian for that.
How you want to manage the passwords is a whole separate kettle of fish. Perhaps you're happy getting into the PLC to edit the array every time someone is hired, fired, or their password known so that they're getting blamed when someone else erred while using their credentials.
Ideally, each user would manage his/her own password, but that would imply adding a user name to the UDT so that the person knows it
their password.
Do you have multiple HMIs so that two people can be logged on at the same time? If so, how do you enable features on HMI #1 when one user is logged onto it, but no one is on HMI #2 and so the features should be disabled there?
And so on.