text: <s>[INST] Motion Control Bit Evaluation When Using Motion Instructions in Structured Text I am using some motion instructions in structured text and trying to get a good handle on when the .ER and .DN bits get set and how they need to be processed differently than in ladder. Does anyone have a good reference or any sample code (good code) from rockwell (or others) on how we should correctly look at the motion control bit status when used in structured text? (the structured text programming guide is a bit vague and lacks examples related to motion instructions) For example, the code below the intent is to: 1. check to see if registration needs to be disarmed 2. disarm registration 3. check for error 4. continue on... ***************** if (Ax_Infd1XfrBelt.RegEvent2ArmedStatus OR Ax_Infd1XfrBelt.RegEvent2Status) Then MDR(Ax_Infd1XfrBelt,MI_I1TBReg2MDR[0],2); if (MI_I1TBReg2MDR[0].ER) then EM_Infeed.I1TB.ShtTrack.Val_MtnInstrErr:=MI_I1TBReg2MDR[0].ERR; EM_Infeed.I1TB.ShtTrack.Val_MtnInstrExErr:=MI_I1TBReg2MDR[0].EXERR; end_if; end_if; ************* But questions come up... like 1. When does .ER bit get set? Before leaving line with MDR so it can be checked write after? or some other time later? 2. When does .DN bit get set? In ladder it says it may take a few scans... is it the same in structured text? Does that mean I need to set motion instruction and then go wait for either .DN or .ER before continuing? Is there any cases where neither get set in a reasonable time... If anyone has done a lot of motion instructions in Structured text and has a guide or best practices, I would appreciate some feedback Thanks [/INST] Hello Eric Bryant, 1st you should find details for each motion instructions in this manual. Those tags are part of the motion control tag that is associated with each Motion instruction. it's a status of the instruction. they are not mandatory to use, but they can help a lot in your application. The .ER is for the instruction Error status tag, and comes with the extended error code .ERR. So if you have a fault on your instruction (.ER) it means that your instruction have not been executed correctly (state, configuration...etc), that does not mean that you axis is in fault. so Monitor this tag to make sure that all works perfectly in your code. Them if .ER occurs monitor .ERR , the tag value is a code for fault description (all details in the like that I provided)... but once again this is not required, but can be very handy for maintenance. Regarding the .DN it tells you that the instruction have been executed , does not mean that your action is finish, this is why you also have the .IP or .PC... The .DN can be used like an interlock, you can also reset it when needed , this way you can easily manage the start of the your motion instruction, if you interlock it with a .DN. again all details in the link that i have provided. So what ever the type of language you use, the usage of those tag is the same. if you understand the meaning of those tag and how the behave , you can decide to use them in your code to achieve your goal. but there no general rules about those tags. Let me know if you need more detail Maybe someone will add some additional details regards Vincent \\n </s>