Made ordered cyclic pwm functional

Fixed minor issues and tested code. Generates correct signals for motor
and pwm.