When composing program, if you declare integer variable (INT Variable name) and assign the PIN9 Value to this variable, the previously operated pallet number will be remembered.
Compose the program with comparing pallet numbers set for this variable in the program.