' -------------------------------------------------------------- ' INITIALIZE & WAIT FOR INVERTER TO GET READY ' -------------------------------------------------------------- autostart 'this program automatically starts on powerup/reset task goto BlinkLights 'start a thread to blink a light InitLoop DRIVE(1)=0 SPEED(1)=0 DRIVECLEAR(1) IF DRIVEERROR(1) THEN GOTO InitLoop ' -------------------------------------------------------------- ' LOOP FOREVER, STARTING & STOPPING MOTOR ' -------------------------------------------------------------- MainLoop ' ACCELERATE TO 1500 RPM, THEN WAIT 5 SECONDS PRINT "STARTING" DRIVE(1)=1 SPEED(1)=1500 GOSUB WaitForAtSpeedSub WAIT 5000 ' STOP, WAIT 5 SECONDS, THEN START WHOLE SEQUENCE AGAIN PRINT "STOPPING" SPEED(1)=0 GOSUB WaitForAtSpeedSub WAIT 5000 GOTO MainLoop ' -------------------------------------------------------------- ' SUBROUTINE TO WAIT UNTIL AT-SPEED, THEN PRINT A MESSAGE & RETURN ' -------------------------------------------------------------- WaitForAtSpeedSub LoopingUntilAtSpeed IF DRIVEATSPEED(1)=0 THEN GOTO LoopingUntilAtSpeed PRINT "AT-SPEED ", SPEED(1) RETURN ' -------------------------------------------------------------- ' TASK TO BLINK A LIGHT ' -------------------------------------------------------------- BlinkLights T#=100 'time-on & time-off is this many milliseconds L#=32 'this output controls the light loopBlinkLights TURNON L# WAIT T# TURNOFF L# WAIT T# goto loopBlinkLights