thanks Crossbow It is my high school project so the number of pulse per revolution of the encoder 512 and it will connect to the gear of motor and the gear ratio is approximately 20 ,when the motor is started the encoder will pulse from back of the gear to plc ,if possible I want you to get a sample plc program thanks