my apologies.... I tried to truncate the text to the minimum and it is wrong.....
This is the actual code used - and I think it is correct....sorry about that!
lounge_curtain_motor:
' sertxd ("lounge curtain motor","","","",""," [433]", cr,lf)
high b.0 ' pic pin 6 hi - start curtain motor
pause 1000 ' 1 sec stabilise before enabling motor load current trip
for motor_run_time = 0 to motor_max_time ' loop for time period (safeguard only to stop motor after max motor run time (15 sec) - motor will normally current trip)
readadc c.0, motor_current_trip ' pic pin 17 / c.0 - motor current trip
if motor_current_trip >=100 then
low b.0, b.3 ' motor exceeded current limit so turn it off
' pause 500 ' wait 1/2 sec before sertxd - only for debugging (ratchet) otherwise error on sertxd report
' sertxd ("motor stop (normal)","","","",""," [441]", cr,lf)
exit ' ********************************************************
endif ' ***** important.... "exit & endif" in this order ! *****
next motor_run_time ' safeguard only to stop motor after max motor run time (10 sec) - motor will normally current trip)
low b.0 ' pic pin 6 lo - stop curtain motor
low b.3 ' pic pin 9 lo - release c/o relay
return