First Scan Subroutine question

Join Date
Jul 2011
Location
OC
Posts
3
Hey guys, I'm learning how to program a CLX in RSLogix5000.

In my MainRoutine I want to run through a subroutine one time, that checks some conditions in order to proceed through the rest of the MainRoutine when the first scan bit is set, and only when it is set.

The first scan subroutine is a single rung with conditionals and one Output Energize. Something like this ----[/]---[ ]-----[LES]---[EQU]-----( )----

If all conditionals are met(if the output energize from the first scan subroutine is set), then proceed through the MainRoutine, else don't go through the rest of it which consists of JSRs and flag an alarm bit which will be XIO by another subroutine which will stop all operation.

I guess the question I have is then how do I make a conditional JSR, I'm quite confused on how to only JSR when the F:SC bit is set.

My best guess is ----| |----[JSR]----

Would that only run the JSR if the XIO condition is met?
 
Last edited:
I guess the question I have is then how do I make a conditional JSR, I'm quite confused on how to only JSR when the F:SC bit is set.

My best guess is ----| |----[JSR]----

Would that only run the JSR if the XIO condition is met?

well, sort of ...

first of all, you've misspelled "S:FS" ...

next, the "open contact looking thing" is known as an XIC – not an XIO ... but all-in-all you've got the right idea ...

tip: to try out your code, install a "test" rung in the subroutine ...

make it an unconditional rung with just an ADD instruction ... sort of like this:

Source A is a new tag "My_Test" ...
Source B is the value 1 ...
Destination is the same new tag "My_Test" ...

now each time the processor goes through the subroutine, the value stored in My_Test will increment by 1 ... this will tell you for sure whether the subroutine is being scanned or not – and how often ...
 
If all conditionals are met(if the output energize from the first scan subroutine is set), then proceed through the MainRoutine, else don't go through the rest of it which consists of JSRs and flag an alarm bit which will be XIO by another subroutine which will stop all operation.
...
My best guess is ----| |----[JSR]----

Yes, for all of the routines, only examine the first_scan bit for the one which has exclusive control, and use a global binary element (BOOLEAN tag or member of a DINT). XIC that global tag before JSR-ing to the other routines.

What you are doing is like a user fault routine. (You may want to read up on doing it that way so actions later like altering the task schedule don't break your method.)

You want to XIC the First_Scan bit and JSR to the First_Scan routine (or whatever you name it...) but you want that routine to have exclusive control until it is satisfied, using a global binary tag, so each of the subsequent JSRs from your Main routine would XIC your System_Ready bit (or whatever you christen it).

Paul
 
Last edited:

Similar Topics

Hi everyone, I'm trying to simulate any program in control expert and see a register in Modscan32 or any software to do that (Like ModbusPoll). I...
Replies
0
Views
62
I am not sure if this is possible but if there is a way, you guys would be the ones to know. I am currently working on a project where we are...
Replies
7
Views
187
I have a Type C to RS485 adapter connect to my Siemens RWF55. I use modscan to scan it to get a value from the Siemens controller. In the...
Replies
4
Views
75
Hi, I'm new to PLCs and learning about PLC Scan times for Schneider PLCs I've derived the PLC scan time using the free running blocks. The PLC...
Replies
7
Views
583
Hello. Does anyone know the equivalent of the first scan bit in a L32ER compactlogix? Do o need to obtain it via GSV? I’m looking to regain...
Replies
3
Views
401
Back
Top Bottom