component toolchanger.comp "refrence to project" //HAL IO Control for ToolChange pin in bit ToolChange "from hal subsystem toolchange request"; pin out bit ToolChanged "pin out to hal subsystem tool change was sucessful"; pin out bit ToolPrepared "send signal to HAL that the next requested tool is avaiable and ready not sure if implemtning in first go round"; pin out bit Estop = false "fatal fault condition disable toolchanger and stop machine"; pin out bit ToolChangerFault = false "IoControlV2 offers toolchanger fault path will investigae for use"; pin in bit s32 ToolNumber "Requested Tool Number from HAL and RS247NGC intepreter"; pin in bit s32 CurrentToolNumber "injection of Current Tool Number in Spindle From Hal"; pin in bit s32 PrepareToolNumber "Tool to have ready next should only be allowable if no tool in spindle not sure f implementing first go round"; // Single Shot Start Flags pin out bit OneShotStart = true "Set to true to be cleared, this prevents fall through execution later on"; pin out bit ToolChanger = false "Contol flag to enable and disable toolchange, we set this true when ToolChange is sent by hal and use it to enable/disable after that"; pin out bit ErrorState = true "Errors allowable only in certain states IE not when carousel is moving etc, mostly used for tool number and pocket errors at start up"; // other warning and error flags to stop message go here // Spindle Orient IO and Timer Functions Here //inputs pin in bit SpindleEnable = false "spinde input MUST be disabled, leave disconncted if your spindle require enabling to stay oriented" pin in bit SpindleBrake = false " use some kind of input to set this pin to true when spindle not moving or locked etc " pin in bit s32 SpindleOrientTimeLimit = 10 "set time limit for spindle orient before faulting out"; pin in bit SpindleOriented = false "input from hal to make sure spindle oriented before starting tool change manuevers"; //outputs pin out bit SpindleTimedOutError = true "Spindle time out error flag and message suppresion"; pin out bit SpindleOrient = false "out to HAL to command spindle to orient"; // inputs for carousel or belt style tool storage along with important things like spinlde commands to lock unlock etc the tool // chose encoding system pin in bit IndexType = false "index encoding schemce 1 pulse per pocket"; pin in bit EncoderType false " sets counting logic to encoder type" // inputs for Index and Home switch style carousel pin in bit IndexPulse = false "index pulse input to count pockets 1 per pocket"; pin in bit IndexHome = false "secondary input to home carousel assembly, ON when pocket 1 is centered in opening etc" // inputs for Encoder with Index feature pin in bit s32 EncoderInput = 0 "encoder input from hal to figure position based on pulse count per pocket"; pin in bit EncoderHome = false "encoder index (home point for pocket 1) input from hal " pin in bit s32 PulsePerPocket = 0 "input divisor to gets pulse per pocket" // external carousel controls pin in bit JogFwd = false "jog forward function"; pin in bit JogRev = false "jog backwar function"; // external control to home the carousel pin in bit HomeCarousel = false "input to home carousel"; pin out bit HomeSensor = false "output for home sensor status"; //decoder outputs from carousel sensors param rw s32 PocketCount = 0 "store the pocket count here and output to hal"; param rw s32 Pocket = 0 "this is the actual value of the pocket output to hal"; param rw s32 PocketRequest = 0 "store this variable here and output to hal for diagnostics"; // carousel motor controls pin out bit MotorFwd = false "carousel motor fwd outpt"; pin out bit MotorRev = false "carousel motor rev output" // will be adding steps and pwm in near future for stepper and other motors types //tool in spindle lock input pin in bit ToolLocked = false "input sensor tool clamp locked"; pin in bit ToolUnlocked = false "input sensor tool clamp unlocked"; //User Adjustable Timer Values Input from Hal File. //Runtime Watchdog clock adjustment for error detection pin in bit float Block01TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block02TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block03TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block04TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block05TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block06TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block07TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block08TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block09TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; pin in bit float Block10TimeOut01Setting = 0 " sets maximum time a function may run before faulting and activating fault codes, and other safety interlocks"; // function wait and delay timers used to manage the mechanics of the machine, you often need to wait for a mechanical response becuase machine is slower than Computer MUCH MUCH MUCH SLOWER pin in bit float Block01Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block02Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block03Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block04Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block05Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block06Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block07Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block08Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block09Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; pin in bit float Block10Timer01Setting = 0 " if the output is requested on, before checking to see if the next move can be made, the program stops and waits before moving forward and triggering faults for out of bounds conditions"; // Block monitoring system for execution. these are the BIG cases,these blocks start and end executions blocks. B1count variable operates inside Block 1, etc and so forth. // this is where we will implement the goto and jump logic for different control needs. only need 3 blocks of executiuon, use 3 blocks etc. pin out bit Block01 = false "Logic Control Flag"; pin out bit Block02 = false "Logic Control Flag"; pin out bit Block03 = false "Logic Control Flag"; pin out bit Block04 = false "Logic Control Flag"; pin out bit Block05 = false "Logic Control Flag"; pin out bit Block06 = false "Logic Control Flag"; pin out bit Block07 = false "Logic Control Flag"; pin out bit Block08 = false "Logic Control Flag"; pin out bit Block09 = false "Logic Control Flag"; pin out bit Block10 = false "Logic Control Flag"; // bypass flags to jump over Big Block cases pin in bit JumpBlock01 = false "Logic Control Flag"; pin in bit JumpBlock02 = false "Logic Control Flag"; pin in bit JumpBlock03 = false "Logic Control Flag"; pin in bit JumpBlock04 = false "Logic Control Flag"; pin in bit JumpBlock05 = false "Logic Control Flag"; pin in bit JumpBlock06 = false "Logic Control Flag"; pin in bit JumpBlock07 = false "Logic Control Flag"; pin in bit JumpBlock08 = false "Logic Control Flag"; pin in bit JumpBlock09 = false "Logic Control Flag"; pin in bit JumpBlock10 = false "Logic Control Flag"; //Program Flow Control for inside the blocks and racking System these turn on and off with each execution step to prevnent fall through execution // and to sequence the logic properly. All viewable in hal to debug execution hangs // Block01 control flags pin out bit B1Count01 = false "Logic Control Flag"; pin out bit B1Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B1Count02 = false "Logic Control Flag"; pin out bit B1Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B1Count03 = false "Logic Control Flag"; pin out bit B1Count04 = false "Activates Carousel Motion"; // Block02 control flags pin out bit B2Count01 = false "Logic Control Flag"; pin out bit B2Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B2Count02 = false "Logic Control Flag"; pin out bit B2Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B2Count03 = false "Logic Control Flag"; pin out bit B2Count04 = false "Activates Carousel Motion"; // Block03 control flags pin out bit B3Count01 = false "Logic Control Flag"; pin out bit B3Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B3Count02 = false "Logic Control Flag"; pin out bit B3Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B3Count03 = false "Logic Control Flag"; pin out bit B3Count04 = false "Activates Carousel Motion"; // Block04 control flags pin out bit B4Count01 = false "Logic Control Flag"; pin out bit B4Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B4Count02 = false "Logic Control Flag"; pin out bit B4Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B4Count03 = false "Logic Control Flag"; pin out bit B4Count04 = false "Activates Carousel Motion"; // Block05 control flags pin out bit B5Count01 = false "Logic Control Flag"; pin out bit B5Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B5Count02 = false "Logic Control Flag"; pin out bit B5Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B5Count03 = false "Logic Control Flag"; pin out bit B5Count04 = false "Activates Carousel Motion"; // Block06 control flags pin out bit B6Count01 = false "Logic Control Flag"; pin out bit B6Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B6Count02 = false "Logic Control Flag"; pin out bit B6Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B6Count03 = false "Logic Control Flag"; pin out bit B6Count04 = false "Activates Carousel Motion"; // Block07 control flags pin out bit B7Count01 = false "Logic Control Flag"; pin out bit B7Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B7Count02 = false "Logic Control Flag"; pin out bit B7Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B7Count03 = false "Logic Control Flag"; pin out bit B7Count04 = false "Activates Carousel Motion"; // Block08 control flags pin out bit B8Count01 = false "Logic Control Flag"; pin out bit B8Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B8Count02 = false "Logic Control Flag"; pin out bit B8Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B8Count03 = false "Logic Control Flag"; pin out bit B8Count04 = false "Activates Carousel Motion"; // Block09 control flags pin out bit B9Count01 = false "Logic Control Flag"; pin out bit B9Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B9Count02 = false "Logic Control Flag"; pin out bit B9Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B9Count03 = false "Logic Control Flag"; pin out bit B9Count04 = false "Activates Carousel Motion"; // Block10 control flags pin out bit B10Count01 = false "Logic Control Flag"; pin out bit B10Count01_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B10Count02 = false "Logic Control Flag"; pin out bit B10Count02_5 = false "Half steps are used to turn the Watchdog Timers on and off"; pin out bit B10Count03 = false "Logic Control Flag"; pin out bit B10Count04 = false "Activates Carousel Motion"; // Digital IO from LogicalBlocks pin out bit Block01OutPut01 "output to turn on of off something digital"; pin out bit Block01OutPut02 "output to turn on of off something digital"; pin in bit Block01InPut01 "output to turn on of off something digital"; pin in bit Block01InPut02 "output to turn on of off something digital"; pin out bit Block02OutPut01 "output to turn on of off something digital"; pin out bit Block02OutPut02 "output to turn on of off something digital"; pin in bit Block02InPut02 "output to turn on of off something digital"; pin in bit Block02InPut02 "output to turn on of off something digital"; pin out bit Block03OutPut01 "output to turn on of off something digital"; pin out bit Block03OutPut02 "output to turn on of off something digital"; pin in bit Block03InPut01 "output to turn on of off something digital"; pin in bit Block03InPut02 "output to turn on of off something digital"; pin out bit Block04OutPut01 "output to turn on of off something digital"; pin out bit Block04OutPut02 "output to turn on of off something digital"; pin in bit Block04InPut01 "output to turn on of off something digital"; pin in bit Block04InPut02 "output to turn on of off something digital"; pin out bit Block05OutPut01 "output to turn on of off something digital"; pin out bit Block05OutPut02 "output to turn on of off something digital"; pin in bit Block05kInPut01 "output to turn on of off something digital"; pin in bit Block05InPut02 "output to turn on of off something digital"; pin out bit Block06OutPut01 "output to turn on of off something digital"; pin out bit Block06OutPut02 "output to turn on of off something digital"; pin in bit Block06InPut01 "output to turn on of off something digital"; pin in bit Block06InPut02 "output to turn on of off something digital"; pin out bit Block07OutPut01 "output to turn on of off something digital"; pin out bit Block07OutPut02 "output to turn on of off something digital"; pin in bit Block07InPut01 "output to turn on of off something digital"; pin in bit Block07InPut02 "output to turn on of off something digital"; pin out bit Block08OutPut01 "output to turn on of off something digital"; pin out bit Block08OutPut02 "output to turn on of off something digital"; pin in bit Block08InPut01 "output to turn on of off something digital"; pin in bit Block08InPut02 "output to turn on of off something digital"; pin out bit Block09OutPut01 "output to turn on of off something digital"; pin out bit Block09OutPut02 "output to turn on of off something digital"; pin in bit Block09InPut01 "output to turn on of off something digital"; pin in bit Block09InPut02 "output to turn on of off something digital"; pin out bit Block10OutPut01 "output to turn on of off something digital"; pin out bit Block10OutPut02 "output to turn on of off something digital"; pin in bit Block10InPut01 "output to turn on of off something digital"; pin in bit Block10InPut02 "output to turn on of off something digital"; // Block Timer Variables in use these are watchable // Timer Variables use for Motion Timing and Diganostics param rw float Block01Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block01TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block02Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block02TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block03Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block03TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block04Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block04TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block05Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block05TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block06Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block07TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block08Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block08TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block09Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block09TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block10Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block10TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block01Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block01TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block01Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block01TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; param rw float Block01Timer01 = 0 "Timer delay variable initialization watchable in HAL uised internally"; param rw float Block01TimeOut01 = 0 "TimeOUT delay variable initialization watchable in HAL uised internally"; // output message flood prevention flags pin out bit Block01FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block02FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block03FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block04FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block05FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block06FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block07FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block08FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block09FloodFlag = false " flag to stop message flooding once error condition met"; pin out bit Block10FloodFlag = false " flag to stop message flooding once error condition met"; // misc error flag flood prevention pin out bit SpindleNotAlignedError = false "message flooding is annoying prevent it here"; Author everybody interested function_;; // declare variable renaming here to stop confusion later !!! Toolchanger = Toolchange; // this is renamed here becuase the incoming pin is not cancelable from the component program PocketRequest = toolnumber; // setup the tool change enviroment in a safe way, we don't wan to crash the machine. if(toolchange == true ){ SpindleOrient = true; } if ( SpindleOrient == true){ SpindleOrientTimer += fperiod; } if (SpindleOrientTimer > SpindleOrientTimeLimit && SpindleOrient == true && toolchange == true ){ Block01 = false; Block01DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; if (SpindleTimedOutError == false ){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault 000 Spindle Took To long to Align For ToolChange ESTOP ON"); SpindleTimedOutError = true; // set flag to block prinint excesive error messages } }else{ if (SpindleOrientTimer < SpindleOrientTimeLimit && SPindleOriented == true) Block1 = true; ToolChanger = false; SpindleOrient = false; } // really demand that all these things are true PRIOR to starting the toolchange MASSIVE IMPORTANCE FOR SAFETY !!!!!!! if (SpindleOriented == true && Toolchange == true && SpindleEnable == false && SpindleBrake == true && Block1 == true ){ SpindleOrient = false; SpindleOrientTimer = 0; Block1 = true }else{ if (SpindleOriented == false && Toolchange == true && Block1 == true ){ Block01DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (SpindleNotAlignedError == false ){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault 001 Spindle Not Aligned For ToolChange ESTOP ON"); SpindleNotAlignedError = true; // set flag to block prinint excesive error messages } } } // pocket counting logic here to decode pocket position // pocket counting logic, determines count direction from motor command // will implement encoder logic soon if (IndexType == true){ if (MotorFwd) { if (IndexPulse) { Pocket += 1; } }else{ if (MotorRev) { if (IndexPulse) { Pocket -= 1; } } } } if (EncoderType == true){ if (MotorFwd) { if (EncoderInput / PulsePerPocket) { Pocket += 1; } }else{ if (MotorRev) { if (EncoderInput / PulsePerPocket) { Pocket -= 1; } } } } //Carousel Command Code to get desired pocket if (Pocket > PocketRequest && ActivateCarousel == true && toolchanger == true) { // Move tool changer backwards MotorFwd = false; MotorRev = true; } else if (Pocket < PocketRequest && ActivateCarousel == true ToolChanger == true)) { // Move tool changer forwards MotorFwd = true; MotorRev = false; }else if (Pocket == PocketRequest){ // Tool changer is at the correct pocket MotorFwd = false; MotorRev = false; ActivateCarousel = false; } // home carousel function if (IndexHome == true || EncoderHome == true) { HomeSensor = true; } if (HomeCarousel == true && Block1 == false && SpindleEnable == false) { MotorFwd = true; if (HomeSensor == true && CarouselHome == true) { MotorFwd = false; Pocket = 1; } } // logic for jogging the carousel if (JogFwd == true && Block1 == false && SpindleEnable == false) { // input from hal to increment pocekt PocketRequest += 1; } if (JogRev == true&& Block1 == false && SpindleEnable == false ) { // input from hal to decerment pocket PocketRequest -= 1; } if ((pocket > pocket_request) && (caoursel_down == true) && (carousel_out == true)) { // Move tool changer backwards motor_fwd = false; motor_rev = true; } else if ((pocket < pocket_request) && (caoursel_down == true) && (carousel_out == true)) { // Move tool changer forwards motor_fwd = true; motor_rev = false; } else if (pocket == pocket_request){ // Tool changer is already at the correct pocket motor_fwd = false; motor_rev = false; } //Start of tool Changer Moves Setup the Flow Control system and go forward if (Toolchanger == true && OneStartShot == true && Block1 == true){ // getting the execution chain started B1Count01 = true; // first execution step }else{ if (Toolchanger == true && OneStartShot == true && JumpBlock01 == true){ Block02 = true; } } // beginging of Block1 if (B1Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block01Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block01TimeOut01 += fperoid; B1Count01_5; = true; // enable timer for BlockWatchDog Block01OutPut01 = true; // enable a pin out to make a move } if (Block01Timer01 > Block01Timer01Setting && ToolChanger == true){ // 1 second unlock pause B1Count02 = true; // move flow control forward B1Count01 = false; // flow control rest at start of routine Block01Timer01 = 0; // clear timer to clean up } // Block 01 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B1Count01_5 == true && Block01OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block01TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block01TimeOut01 > Block01TimeOut01Setting && Block01DigitalOut01 == true && Block01Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B1Count02_5 = true; // flow control reset at start of routine }else{ if (Block01TimeOut01 > Block01TimeOut01Setting && Block01DigitalOut01 == true && Block01Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block01FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block01FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block01TimeOut01 < Block01TimeOut01Setting && Block01DigitalOut01 == true && Block01Input01 == true ){ B1Count03 = true; // progress to next execution block }else{ if (B1Count02_5 == true && Block01TimeOut01 > Block01TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block01DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B1Count02_5= false; // cancel timer if (Block01FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block01FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B1Count03 == true && Block01Input01 == true ){ B1Count01 = false; B1Count02 = false; B1Count01_5 = false; B1Count02_5 = false; Block02 = true; } if (B1Coun0t3 == true && Block01Input01 == true && B1Count04 == true){ ActivateCarousel = true; } // end of Block 1, we are going to reuse this code over and over. if (Toolchanger == true = && Block2 == true){ // getting the execution chain started B2Count01 = true; // first execution step }else{ if (Toolchanger == true == true && JumpBlock02 == true){ Block03 = true; } } // beginging of Block2 if (B2Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block02Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block02TimeOut01 += fperoid; B2Count01_5; = true; // enable timer for BlockWatchDog B2ock01OutPut01 = true; // enable a pin out to make a move } if (Block02Timer01 > Block02Timer01Setting && ToolChanger == true){ // 1 second unlock pause B2Count02 = true; // move flow control forward B2Count01 = false; // flow control rest at start of routine Block02Timer01 = 0; // clear timer to clean up } // Block 2 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B2Count01_5 == true && Block02OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block02TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block02TimeOut01 > Block02TimeOut01Setting && Block02DigitalOut01 == true && Block02Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B2Count02_5 = true; // flow control reset at start of routine }else{ if (Block02TimeOut01 > Block02TimeOut01Setting && Block02DigitalOut01 == true && Block02Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block02FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block02FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block02TimeOut01 < Block02TimeOut01Setting && Block02DigitalOut01 == true && Block02Input01 == true ){ B1Count03 = true; // progress to next execution block }else{ if (B2Count02_5 == true && Block02TimeOut01 > Block02TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block02DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B2Count02_5= false; // cancel timer if (Block02FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block02FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B2Count03 == true && Block02Input01 == true ){ B2Count01 = false; B2Count02 = false; B2Count01_5 = false; B2Count02_5 = false; Block03 = true; } if (B2Coun0t3 == true && Block02Input01 == true && B2Count04 == true){ ActivateCarousel = true; } // end of Block 2, we are going to reuse this code over and over. if (Toolchanger == true = && Block3 == true){ // getting the execution chain started B3Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock03 == true){ Block04 = true; } } // beginging of Block3 if (B3Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block03Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block03TimeOut01 += fperoid; B3Count01_5; = true; // enable timer for BlockWatchDog Block03OutPut01 = true; // enable a pin out to make a move } if (Block03Timer01 > Block03Timer01Setting && ToolChanger == true){ // 1 second unlock pause B3Count02 = true; // move flow control forward B3Count01 = false; // flow control rest at start of routine Block03Timer01 = 0; // clear timer to clean up } // Block 3 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B3Count01_5 == true && Block03OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block03TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block03TimeOut01 > Block03TimeOut01Setting && Block03DigitalOut01 == true && Block03Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B3Count02_5 = true; // flow control reset at start of routine }else{ if (Block03TimeOut01 > Block03TimeOut01Setting && Block03DigitalOut01 == true && Block03Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block03FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block03FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block03TimeOut01 < Block03TimeOut01Setting && Block03DigitalOut01 == true && Block03Input01 == true ){ B3Count03 = true; // progress to next execution block }else{ if (B3Count02_5 == true && Block03TimeOut01 > Block03TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block03DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B3Count02_5= false; // cancel timer if (Block03FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block03FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B3Count03 == true && Block03Input01 == true ){ B3Count01 = false; B3Count02 = false; B3Count01_5 = false; B3Count02_5 = false; Block04 = true; } if (Block04 == true && Block03Input01 == true && B3Count04 == true){ ActivateCarousel = true; } // end of Block 3, we are going to reuse this code over and over. if (Toolchanger == true = && Block4 == true){ // getting the execution chain started B4Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock04 == true){ Block05 = true; } } // beginging of Block4 if (B4Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block04Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block04TimeOut01 += fperoid; B4Count01_5; = true; // enable timer for BlockWatchDog Block04OutPut01 = true; // enable a pin out to make a move } if (Block04Timer01 > Block01Timer04Setting && ToolChanger == true){ // 1 second unlock pause B4Count02 = true; // move flow control forward B4Count01 = false; // flow control rest at start of routine Block04Timer01 = 0; // clear timer to clean up } // Block 04 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B4Count01_5 == true && Block04OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block04TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block04TimeOut01 > Block04TimeOut01Setting && Block04DigitalOut01 == true && Block04Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B4Count02_5 = true; // flow control reset at start of routine }else{ if (Block04TimeOut01 > Block04TimeOut01Setting && Block04DigitalOut01 == true && Block04Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block04FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block04FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block04TimeOut01 < Block04TimeOut01Setting && Block04DigitalOut01 == true && Block04Input01 == true ){ B4Count03 = true; // progress to next execution block }else{ if (B4Count02_5 == true && Block04TimeOut01 > Block04TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block04DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B1Count02_5= false; // cancel timer if (Block04FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block04FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B4Count03 == true && Block01Input01 == true ){ B4Count01 = false; B4Count02 = false; B4Count01_5 = false; B4Count02_5 = false; Block05 = true; } if (B4Coun0t3 == true && Block04Input01 == true && B4Count04 == true){ ActivateCarousel = true; } // end of Block 4, we are going to reuse this code over and over. if (Toolchanger == true = && Block5 == true){ // getting the execution chain started B5Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock05 == true){ Block06 = true; } } // beginging of Block5 if (B5Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block05Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block05TimeOut01 += fperoid; B5Count01_5; = true; // enable timer for BlockWatchDog Block05OutPut01 = true; // enable a pin out to make a move } if (Block05Timer01 > Block05Timer01Setting && ToolChanger == true){ // 1 second unlock pause B5Count02 = true; // move flow control forward B5Count01 = false; // flow control rest at start of routine Block05Timer01 = 0; // clear timer to clean up } // Block 5 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B5Count01_5 == true && Block05OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block05TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block05TimeOut01 > Block05TimeOut01Setting && Block05DigitalOut01 == true && Block05Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B5Count02_5 = true; // flow control reset at start of routine }else{ if (Block05TimeOut01 > Block05TimeOut01Setting && Block05DigitalOut01 == true && Block05Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block05FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block05FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block05TimeOut01 < Block05TimeOut01Setting && Block05DigitalOut01 == true && Block05Input01 == true ){ B5Count03 = true; // progress to next execution block }else{ if (B5Count02_5 == true && Block05TimeOut01 > Block05TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block05DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B5Count02_5= false; // cancel timer if (Block05FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block05FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B5Count03 == true && Block05Input01 == true ){ B5Count01 = false; B5Count02 = false; B5Count01_5 = false; B5Count02_5 = false; Block06 = true; } if (B5Coun0t3 == true && Block05Input01 == true && B5Count04 == true){ ActivateCarousel = true; } // end of Block 5, we are going to reuse this code over and over. if (Toolchanger == true = && Block6 == true){ // getting the execution chain started B6Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock07 == true){ Block07 = true; } } // beginging of Block6 if (B6Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block01Timer06 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block01TimeOut06 += fperoid; B6Count01_5; = true; // enable timer for BlockWatchDog Block06OutPut01 = true; // enable a pin out to make a move } if (Block06Timer01 > Block06Timer01Setting && ToolChanger == true){ // 1 second unlock pause B6Count02 = true; // move flow control forward B6Count01 = false; // flow control rest at start of routine Block06Timer01 = 0; // clear timer to clean up } // Block 6 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B6Count01_5 == true && Block06OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block06TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block06TimeOut01 > Block06TimeOut01Setting && Block06DigitalOut01 == true && Block06Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B6Count02_5 = true; // flow control reset at start of routine }else{ if (Block01TimeOut01 > Block01TimeOut01Setting && Block01DigitalOut01 == true && Block01Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block06FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block06FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block06TimeOut01 < Block06TimeOut01Setting && Block06DigitalOut01 == true && Block06Input01 == true ){ B6Count03 = true; // progress to next execution block }else{ if (B6Count02_5 == true && Block06TimeOut01 > Block06TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block06DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B6Count02_5= false; // cancel timer if (Block06FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block06FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B6Count03 == true && Block06Input01 == true ){ B6Count01 = false; B6Count02 = false; B6Count01_5 = false; B6Count02_5 = false; Block07 = true; } if (B6Coun0t3 == true && Block06Input01 == true && B6Count04 == true){ ActivateCarousel = true; } // end of Block 6, we are going to reuse this code over and over. if (Toolchanger == true = && Block7 == true){ // getting the execution chain started B7Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock06 == true){ Block08 = true; } } // beginging of Block7 if (B7Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block07Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block07TimeOut01 += fperoid; B7Count01_5; = true; // enable timer for BlockWatchDog Block07OutPut01 = true; // enable a pin out to make a move } if (Block07Timer01 > Block07Timer01Setting && ToolChanger == true){ // 1 second unlock pause B7Count02 = true; // move flow control forward B7Count01 = false; // flow control rest at start of routine Block07Timer01 = 0; // clear timer to clean up } // Block 7 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B7Count01_5 == true && Block07OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block07TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block07TimeOut01 > Block07TimeOut01Setting && Block01DigitalOut01 == true && Block07Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B7Count02_5 = true; // flow control reset at start of routine }else{ if (Block07TimeOut01 > Block07TimeOut01Setting && Block07DigitalOut01 == true && Block07Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block07FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block07FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block07TimeOut01 < Block07TimeOut01Setting && Block07DigitalOut01 == true && Block07Input01 == true ){ B7Count03 = true; // progress to next execution block }else{ if (B7Count02_5 == true && Block07TimeOut01 > Block07TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block07DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B7Count02_5= false; // cancel timer if (Block07FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block07FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B7Count03 == true && Block01Input01 == true ){ B7Count01 = false; B7Count02 = false; B7Count01_5 = false; B7Count02_5 = false; Block08 = true; } if (B7Coun0t3 == true && Block07Input01 == true && B7Count04 == true){ ActivateCarousel = true; } // end of Block 7, we are going to reuse this code over and over. if (Toolchanger == true = && Block8 == true){ // getting the execution chain started B8Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock08 == true){ Block09 = true; } } // beginging of Block8 if (B8Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block08Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block08TimeOut01 += fperoid; B8Count01_5; = true; // enable timer for BlockWatchDog Block08OutPut01 = true; // enable a pin out to make a move } if (Block08Timer01 > Block08Timer01Setting && ToolChanger == true){ // 1 second unlock pause B8Count02 = true; // move flow control forward B8Count01 = false; // flow control rest at start of routine Block01Timer08 = 0; // clear timer to clean up } // Block 8 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B8Count01_5 == true && Block08OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block08TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block08TimeOut01 > Block08TimeOut01Setting && Block08DigitalOut01 == true && Block08Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B8Count02_5 = true; // flow control reset at start of routine }else{ if (Block08TimeOut01 > Block08TimeOut01Setting && Block08DigitalOut01 == true && Block08Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block08FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block08FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block08TimeOut01 < Block08TimeOut01Setting && Block08DigitalOut01 == true && Block08Input01 == true ){ B8Count03 = true; // progress to next execution block }else{ if (B8Count02_5 == true && Block08TimeOut01 > Block01TimeOut08Setting) { // just changing the timer name, becuase memory leaks Block08DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B8Count02_5= false; // cancel timer if (Block08FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block08FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B8Count03 == true && Block08Input01 == true ){ B8Count01 = false; B8Count02 = false; B8Count01_5 = false; B8Count02_5 = false; Block09 = true; } if (B8Coun0t3 == true && Block08Input01 == true && B8Count04 == true){ ActivateCarousel = true; } // end of Block 8, we are going to reuse this code over and over. if (Toolchanger == true = && Block9 == true){ // getting the execution chain started B9Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock09 == true){ Block10 = true; } } // beginging of Block9 if (B9Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block09Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block09TimeOut01 += fperoid; B9Count01_5; = true; // enable timer for BlockWatchDog Block09OutPut01 = true; // enable a pin out to make a move } if (Block09Timer01 > Block09Timer01Setting && ToolChanger == true){ // 1 second unlock pause B9Count02 = true; // move flow control forward B9Count01 = false; // flow control rest at start of routine Block09Timer01 = 0; // clear timer to clean up } // Block 9 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B9Count01_5 == true && Block09OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block09TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block09TimeOut01 > Block09TimeOut01Setting && Block09DigitalOut01 == true && Block09Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B9Count02_5 = true; // flow control reset at start of routine }else{ if (Block09TimeOut01 > Block09TimeOut01Setting && Block09DigitalOut01 == true && Block09Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block09FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block09FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block09TimeOut01 < Block09TimeOut01Setting && Block09DigitalOut01 == true && Block09Input01 == true ){ B9Count03 = true; // progress to next execution block }else{ if (B9Count02_5 == true && Block09TimeOut01 > Block09TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block09DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B9Count02_5= false; // cancel timer if (Block09FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block09FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B9Count03 == true && Block09Input01 == true ){ B9Count01 = false; B9Count02 = false; B9Count01_5 = false; B9Count02_5 = false; Block10 = true; } if (B9Coun0t3 == true && Block09Input01 == true && B9Count04 == true){ ActivateCarousel = true; } // end of Block 9, we are going to reuse this code over and over. if (Toolchanger == true = && Block10 == true){ // getting the execution chain started B10Count01 = true; // first execution step }else{ if (Toolchanger == true && JumpBlock10 == true){ Block100 = true; } } // beginging of Block10 if (B10Count01 == && Toolchanger == true){ // TurnOnOutPut01 and Block01Count0 start this timer Block10Timer01 += fperiod; // timers are incremented by fperoid in 0.001 second increments Block10TimeOut01 += fperoid; B10Count01_5; = true; // enable timer for BlockWatchDog Block10OutPut01 = true; // enable a pin out to make a move } if (Block10Timer01 > Block10Timer01Setting && ToolChanger == true){ // 1 second unlock pause B10Count02 = true; // move flow control forward B10Count01 = false; // flow control rest at start of routine Block10Timer01 = 0; // clear timer to clean up } // Block 10 WatchDog Timer to Ensure Output and Input happen within reasonabel Time period if (B10Count01_5 == true && Block10OutPut01 == true ){ // BlocKOutput1 and count2 start this timer Block10TimeOut01 += fperiod; // timer is incremented by fperoid } if (Block10TimeOut01 > Block10TimeOut01Setting && Block10DigitalOut01 == true && Block10Input01 == true){ // if timer1 is greater then unlocktimeout setting and toolchange is true B10Count02_5 = true; // flow control reset at start of routine }else{ if (Block10TimeOut01 > Block10TimeOut01Setting && Block10DigitalOut01 == true && Block10Input01 == false){ ToolChangerFault= true; // set this error flag Estop = true; // disable machine if (Block10FloodFlag01 = true;){ rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-00 Position Sensor Unresponsive after 2 Seconds"); Block10FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } } } if (Block10TimeOut01 < Block10TimeOut01Setting && Block10DigitalOut01 == true && Block10Input01 == true ){ B10Count03 = true; // progress to next execution block }else{ if (B10Count02_5 == true && Block10TimeOut01 > Block10TimeOut01Setting) { // just changing the timer name, becuase memory leaks Block10DigitalOut01= false; // disable output ToolChanger = false; // stop toolchange code flow ToolChangerFault= true; // set this error flag Estop = true; // disable machine B10Count02_5= false; // cancel timer if (Block10FloodFlag01 = false){ // block repetitive error messages they are annoying and flood the system rtapi_print_msg(RTAPI_MSG_ERR, "Fault B01-01 WatchDog Timer Limit Exceeded Check Machine for Jamming or Other Errors"); Block10FloodFlag01 = true; // set flag to block prinint excesive error messages DignosticCount = 0101; // send diagnostic count number, in attempt to find bugs etc. } // diagnosing the problem } } if (B10Count03 == true && Block10Input01 == true ){ B10Count01 = false; B10Count02 = false; B10Count01_5 = false; B10Count02_5 = false; Block10 = true; } if (B10Coun0t3 == true && Block10Input01 == true && B10Count04 == true){ ActivateCarousel = true; } // end of Block 10, we are going to reuse this code over and over.