Hello Henrik, All,

I have read through this thread regarding servo PID motor control that Henrik wrote. I need to modify the code for the direction part of the code. My h-bridge has 3 i/o. PWM drive, Portd.0 and Portd.1.

The allowable states are:
portd.0 = 1 and portd.1 = 0
portd.1 = 0 and portd.1 = 1

I see that Henrik uses 1 bit to control direction. can I simply replace his code
"Direction = pid_Out.15 'Set direction pin accordning to sign"

with.....

if pid_out.15 = 1 then
portd.0 = 1
portd.1 = 0
else
portd.0 = 0
portd.1 = 1
endif

I am concerned about messing up timing by introducing these lines of code. Will this affect the integrity of the original code?

Best Regards,
Nick