Try this.
The wait at the bottom is the scan time.
Line 50 Contains the actual calculation.
10 if ctrlint < 1 then ctrlint = 1
20 ctrlerr = sp - rmtmp
30 if 90 < 1 then maxout_o = umax - umin else maxout_o = ( umax - umin ) * ctrlint / stk_t
40 if 50 > 0 then goto 50 else goto 70
50 calcout = P * -1 * ( ctrlerr - lsterror + 1 * ctrlerr / I )
60 if calcout > 0 then thispid = min ( calcout , 100 ) + tsig else thispid = max ( calcout , -100 ) + tsig
70 calcout = 10 * -1 * ctrlerr + ( 100 - 0 ) / 2
80 lsterror = ctrlerr
90 tsig = thispid
100 wait 00:00:01