Enter each login as one number from 0 to 9999 and store roster IDs in the format the compare instruction reads. Verify the entry with a FOR/NEXT loop over ten slots, give every employee a fixed 40-word name record, and gate the run permit on the match flag. Log out after 15 idle minutes.
A login number earns its keep only when the controller can match it to a person on the roster. Store each employee's number as one numeric value from 0 to 9999. Keep the roster in PLC data registers and verify every entry with a FOR/NEXT loop that compares it against all ten slots and remembers which slot matched. Give each employee a fixed record, 2 words for the ID and 40 words for the two name strings, so the match index lands on exactly one name. The panel keeps handling the setting tiers through its password feature; the ladder owns identity, the run permit and the 15-minute idle logout. The numbers below use a ten-slot roster, and the same strides scale to any record count your data memory holds.
Keep setting passwords and the login roster apart
The panel's password feature is built for the tier job: three levels of settings, each screen object locked to the tier allowed to change it. Configure those as passwords and test every tier from the panel. The second job, who is running the machine today, belongs in the ladder. The roster, the compare, the logged-in bit and the run permit are PLC state. The sequence has to hold the machine idle until a valid login exists, and the idle timer lives beside the logic that obeys it. If the setting tier should follow the login, derive the tier from the ID value in its own rungs and write the resulting level to a register the panel reads.
A roster match tells you the number is assigned. It does not tell you who typed it. Log the number with a timestamp on every login, and treat a shared login as a shared identity in that log.
Store the login as a number, the names as text
Enter the login with a numeric entry object into one numeric register, and store every roster ID in the same numeric type and the same representation. Names are the only text on the roster, so keep first and last name as ASCII strings where management edits them.
The memory rule is two ASCII characters per V-memory word. A 40-character name therefore takes 20 words, two names take 40 words per employee, and ten employees take 400 words of name storage. The ID table adds 2 words per employee, so the ten-person roster occupies 420 words in total. That is small, but it belongs in the project budget beside everything else; sizing an HMI project against panel and PLC memory limits shows how to add the whole project up before you fix a layout.
Pick one numeric representation and carry it through the whole path: entry object, stored ID words, compare instruction, log. If the panel writes the entry as BCD and the compare reads plain binary, a correct 1234 sits in memory as the bit pattern 0x1234, which the compare reads as 4660, and no slot ever matches. That is the same mismatch that makes an HMI panel show nonsense numbers from a PLC BCD analog register. The check takes one minute: enter 1234, watch the raw stored word, and confirm the compare source reads 1234. On the text side, packing an ASCII string into V-memory words for an HMI tag uses the same two-characters-per-word mapping.
Lay out the roster with fixed strides
Fixed strides make the pointer arithmetic safe. Keep the IDs in one table at a 2-word stride and the names in a second block at a 40-word stride, each last name 20 words after its first name.
| Employee | ID (2 words) | First name (20 words) | Last name (20 words) |
|---|---|---|---|
| 1 | V2000 | V2100 | V2120 |
| 2 | V2002 | V2140 | V2160 |
| 3 | V2004 | V2180 | V2200 |
| 4 | V2006 | V2220 | V2240 |
| 5 | V2008 | V2260 | V2280 |
| 6 | V2010 | V2300 | V2320 |
| 7 | V2012 | V2340 | V2360 |
| 8 | V2014 | V2380 | V2400 |
| 9 | V2016 | V2420 | V2440 |
| 10 | V2018 | V2460 | V2480 |
Every address comes from one multiply: ID address = 2000 + 2 × (employee − 1), first-name base = 2100 + 40 × (employee − 1), last-name base = first-name base + 20. Employee 10's last name ends at V2499. One status word at V2020 carries an occupied bit per slot. Management sets the bit when a number is assigned, and the lookup compares only occupied slots, which leaves ID 0 free as a real assignment. The bases here are an example: keep your own free range and keep the strides.
Do not let a stride drift. If one record occupies 24 words and the next 26, one multiply no longer finds record 7, and a long first name walks into somebody else's last name. Uneven spacing is also how a For/Next pointer loop ends up writing the wrong V-memory words; one stride and one multiply, checked once, closes that door. And an address outside the range the panel project has tagged surfaces as an invalid-address error when tagging PLC memory, so keep every computed address inside the tagged blocks.
Run the compare as one FOR/NEXT loop
You need:
- a numeric entry object on the panel writing one value from 0 to 9999 into the entry register, V3000 in this layout
- the ID table, the name block and the occupied-slots word from the table above
- one working word for the entered value, one slot-index word and one match bit
- an on-delay timer for the idle logout, and a log line that takes the ID and a timestamp
The loop needs an index register or indirect addressing to walk the table; that is the standard way to process many registers with one short set of rungs.
- On each login attempt, copy the entry register into the working word, clear the match bit and zero the slot index.
- Start a FOR loop with the index running from 1 to 10. The FOR instruction takes a count and repeats the rungs between FOR and NEXT that many times, and the lookup runs once per attempt, so ten passes cost nothing measurable in scan time.
- On each pass, compute the ID address for the current index, 2000 + 2 × (index − 1), and compare the stored value with the working word using the compare instruction that matches the stored data type.
- On a match, copy the loop index into the slot-index word and set the match bit. Leave the loop early if your FOR instruction supports it; running to 10 is harmless at this size.
- After the NEXT, branch on the match bit. With a match, compute the name pointers, 2100 + 40 × (index − 1) and + 20 words for the last name, load both strings into the current-user display fields, write the ID and timestamp to the log, set the logged-in bit and start the idle timer. With no match, leave the logged-in bit off and show a rejected-login message.
- Make the sequence logic read the logged-in bit in every start condition, and let only the daily reset and the idle timer clear it.
Example: employee 6 enters 1234 on a ten-slot roster
The inputs, with their sources: employee numbers run 0 to 9999 by the plant's own numbering; the 40-character name strings are the text-entry default; two ASCII characters per V-memory word is the documented memory rule; the entry register V3000, the ID base V2000 at a 2-word stride and the name base V2100 at a 40-word stride come from the layout table; the idle logout is 15 minutes. Employee 6 holds ID 1234.
The rule in words: the loop walks slots 1 through 10, reads each ID at 2000 + 2 × (slot − 1), keeps the slot number when the stored value equals the working word, then converts the slot number into name addresses with the strides.
The arithmetic:
- ID address for slot 6: 2000 + 2 × (6 − 1) = 2000 + 10, so V2010.
- Slots 1 through 5 hold other IDs and do not match. Slot 6 holds 1234 and the working word holds 1234, so the match bit sets and the slot index takes the value 6. Later slots cannot change the result.
- First-name base: 2100 + 40 × (6 − 1) = 2100 + 200, so V2300. Last name: 2300 + 20, so V2320.
- Idle preset: 15 × 60 = 900 seconds.
The result: the match bit sets, the slot index reads 6, the panel shows the name from V2300 and V2320, the log line carries 1234 with its timestamp, the logged-in bit sets and the start conditions stay open until 900 seconds pass with no activity.
The decision, with its thresholds: ten compares make the lookup itself a non-issue, so watch the two real limits. A name longer than 40 characters overflows its 20 words into the neighboring field, so cap the entry at 40 characters or widen the stride from 40 to 44 words (22 words per 44-character string) before the roster goes live. And if the loop ends with the match bit clear while 1234 is genuinely assigned, watch the stored word: 4660 sitting where 1234 belongs is BCD written into a binary compare, and the fix is one representation on the whole path.
Set the daily login and the 15-minute idle logout
Give the ladder an explicit logged-out state and a logged-in state, and never infer the state from the machine standing still. Clear the logged-in bit at the start of each operating day from the shift clock you already trust, so the first start of the day waits for a login. While the logged-in bit is set, the idle timer runs. Decide what counts as activity, with panel key presses and machine-cycle starts the usual two, and reset the timer on each one. Set the preset to 15 minutes, which is 900 seconds on a 1-second time base or 9000 counts on a 0.1-second base, and confirm the real logout once with a watch. When the timer completes, the ladder clears the logged-in bit and the machine holds until the next login.
One safety note: this gate is ordinary control logic. Emergency stops and safety-rated protective functions stay wired and programmed independently of it, and the machine must stop safely with nobody logged in.
How to check it worked
Watch the working word, the compared slot and the final index while you test.
| What you see | What it points to | Next check |
|---|---|---|
| A known ID matches and the right name appears | Lookup path and strides correct | Log in all ten employees and confirm each name comes from its own slot |
| A known ID never matches | Representation mismatch, wrong address or compare operand type | Watch the raw entry word and the stored ID; 4660 where you expect 1234 is BCD in a binary compare |
| The ID matches but the wrong name shows | Stride or pointer arithmetic | Read the slot index and the computed name base against the layout table |
| An unassigned ID starts the machine | Match bit left set from the previous login, or an empty slot treated as occupied | Clear the match bit on every attempt and gate each compare on the occupied-slots word |
| Values right in the project but stale on the panel | Communications, not logic | Verify HMI communications with a PLC heartbeat counter before touching the lookup |
Cover the edges too: 0 and 9999, a number above every assigned ID, an unassigned number, and a login one second after a logout. Run the whole roster through one shift and read the log back; number, timestamp and name should agree on every line.
Recommendation: Keep the roster in the PLC with fixed strides, 2 words per ID and 40 words per name pair; enter the login as one number from 0 to 9999; and let a single FOR/NEXT loop find the slot, drive the current-user display and hold the run permit for a 15-minute session. Use this design up to a few hundred employees. Past about 500 records, move the roster into the platform's table storage and keep only the match gate in ladder.
Questions
How many employees can one PLC roster hold?
Speed is never the limit. The loop runs ten compare instructions once per login attempt, so the scan barely notices. Memory is the limit. Each employee uses 42 words in total, 2 for the ID and 40 for the two name strings, so 500 employees need 21,000 words of data memory. When the roster outgrows the data memory you have budgeted, move it into the platform's table storage and keep only the match gate in ladder logic.
What stops two employees from being assigned the same number?
Run the same lookup at edit time. When management saves a new number, the ladder compares it against every occupied slot before the write, and the panel rejects the save when a match comes back. With ten slots this is instant, and it also catches a typo that happens to be another employee's real login. Log the rejected attempt so a duplicate shows up the same day it is typed.
Can the login number also set the panel's access level?
Yes, by banding the values. Assign employees 0 to 5000, customers 5001 to 7000 and company staff 7001 to 9999. The PLC then writes the access level into a register the panel reads: below 5001 is level 1, 5001 to 7000 is level 2, and above 7000 is level 3. Keep that banding in its own rungs so it never mixes with the roster lookup that sets the logged-in bit.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.