Arrays and Buffers

Manage a Tray Stack

medium

Stores up to four tray IDs and removes the most recently added tray first.

What it teaches

Trays go on the top of the pile and come off the top, so the last one loaded is the first one out. Reuse the request and capacity rules from Queue Parts for Processing, but now the newest tray leaves and nothing has to shift down. Peek shows the tray on top without removing it.

Parameters

TagDirectionTypeDefaultDescription
In_LoadInputBOOL0Request to add an ID
In_UnloadInputBOOL0Request to remove an ID
In_PartIdInputDINT101ID to add; every DINT value, including 0, is valid
In_ResetInputBOOL0Clear storage and results
Out_PartIdOutputDINT0Last successfully removed ID
Out_PeekOutputDINT0Next ID to remove, or 0 when empty
Out_CountOutputDINT0Number of stored IDs
Sts_EmptyOutputBOOL01 when no IDs are stored
Sts_FullOutputBOOL01 when four IDs are stored
Ref_PartsInOutDINT[4]Four IDs in loading order, oldest at index 0; unused slots are 0

Required behavior