9/11/2009 3:57 AM | |
Joined: 10/7/2005 Last visit: 5/26/2023 Posts: 2965 Rating:
|
Hello nbk Your observation that the third statement (JCslo1) will lead to a jump to label "slo1" if I 2.2.is "1" is correct and it also should do so! The reason for this is the fact that any JC instruction will do two things: 1.) It setsthe RLO (Result of Logic Operation) to "1"irrespective if the Jump takes place or not 2.) Its sets the FC (First Check bit) to "0" to create a new RLO "chain" If you click on JC and use F1 you get the context sensitive help for it which has more on this. Your logic will as such execute like this ifI 2.2. is "1": AN I 2.2 // I 2.2. = 1 --> RLO = 0 JC fas1 // Jump to label "fas1" will NOT take place, RLO is set to 1 by JC JC slo1// RLO =1 --> Jump to label "slo1" takes place Having said that, I would have used a "JU slo1" as the third statement to "improve" code readability. Last but not least, a JC is reallyquite a powerful"IF THEN ELSE" statement. As the RLO is always set italso allows you to use"S", "R" "=" commands right after it which can be very handy and the code example hopefully helps in explainedthis: [code]A I 7.7// If I 7.7 is 1 JC ON // THEN jump S M x.y// ELSE: S M x.y (RLO is set to 1 by above JC) JU CONT // and continue at Label ON: S M a.b // S M a.b (RLO is set to 1 by "JC ON") CONT:....[/code] I hope this helps |
Last edited by: fritz at: 9/11/2009 5:58 AMCorrected RLO logic comment and added FC bit info Cheers |
|
This contribution was helpful to
4 thankful Users |
9/13/2009 1:15 AM | |
Posts: 197 Rating:
|
Hello Fritz, Yes,it helps a lot. The sample STL you gave is really handy. Many thanks |
Follow us on