b_carlton

MrPLC Member
  • Content count

    1207
  • Joined

  • Last visited

Posts posted by b_carlton


  1. Search the manual for your CPU for the GTS and SBR instructions. The subroutine is inserted after the main program END instruction. The subroutine is started with the SBR instruction and ended with an RT (return)  instruction. You may use a RTC (return conditional) if your subroutine requires it) Unlike many other programming languages there is no structure for passing or returning values, The subroutine is identified by a constant provided as an argument to the SBR instruction. You invoke the subroutine from within the main program using the GTS instruction with the same numeric argument as the target subroutine. I don't remember if you can use the GTS from inside another subroutine. Otherwise the operation is similar to other language subroutines. On invocation the main code stops, the code within the subroutine is executed, then the processing of the main program continues from the instruction immediately after the GTS.


  2. Yes, timers and counters in the SLC500 and Micrologix worlds consist of 3 16 bit words One contains the preset time/count. Another contains the current time/count. The third is used as individual bits and, at least in the timer, a small numeric section to compare with the system real-time clock. Refer to chapter 8 in this manual for more info.

     

    https://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1766-rm001_-en-p.pdf

     


  3. I found it easiest in a similar application to just do the ADD and SUB blocks and not use a counter at all. Actually mine was 4 separate Up counts and one Down count input. With the complexity it was more understandable to group the 5 rungs together with 4 up counts followed by the one down count.

    2 people like this

  4. Mainly make sure the reset of the timer is last because resetting it resets the done bit. And of course the move of the counter's accumulator has to come before it is reset.