Dear friends please help me to solve this tasks. Thanks a lot for helping
1. Write BG LOGIC program which, when changing the input state DI  from OFF to ON, will increase the register value R  by 1.
2. Write a program that would be used to measure the stack height of the inserts. A sensor attached to RI  is mounted on the robot head, the robot moves past the stack and detects the signal from the sensor, saving the current robot height, and then the robot points to the saved TCP altitude.
3.Write a program for stacking cartons on a pallet. A robot with a 1400mm conveyor takes two cartons and places it on a pallet lying on a 400mm conveyor in the same pattern as below. Head height 600mm, carton dimensions 385x200x285mm (lx w x h), interlayer every layer and on the bottom of the pallet, we lay 4 layers of product.