I can suggest the following approch:

Read cycle and ontime word variables
Compare the the two variables and adjust ontime to cycle if ontime is greater then cycle

IF ONTIME>CYCLE THEN...