Micrologix 1200 JSR not working

Ayrond

Member
Join Date
May 2012
Location
Atlanta
Posts
16
Hi Guys.

I have attached my program if this is not an easy answer. I have been working on this for days, so I might have missed something, but I don't see any mistakes.

My problem is that I am using JSR in the main ladder and pointing to my subroutines. U:3-U:8. For some reason, none of the subroutines are working. I have a separate JSR for each subroutine, and each one has an END. The JSR's are not conditional, but the subroutines aren't working. I originally had them all in the main program, and they were working. I wanted to make the program more organized, and look more like I am an actual programmer:rolleyes:

I know that different PLC's have different limitations, so I was wondering if this is possible on Micrologix, or if I am just doing it wrong...
 
My problem is that I am using JSR in the main ladder and pointing to my subroutines. U:3-U:8. For some reason, none of the subroutines are working.

I originally had them all in the main program, and they were working.

The above seems to contradict.

The program you posted should work. What indication is there that tells you the subroutines are not working?
 
Sorry if I wasn't clear. When all of the subroutines were were just part of the main ladder, it was working. To make things more organized, I cut and pasted sections of the program to separate ladders. Then I added the JSR blocks to point them to the new subroutines.

Before, I separated them I could toggle on/off bits and make things work. Now I cant get any thing to toggle in the subroutines. For instance, I was able to toggle on the timers in the Oven timer section of the program and test my logic. Now that I have separated them It no longer works.
 
I don't have time right now to look at your program ...

but ... (in simplest terms) ...

the JSRs MUST be located in Ladder File #2 in order to work ... put them there and see if that fixes your problem ...

there ARE exceptions to the "rule" above - but for now just put all of the JSR rungs in Ladder File #2 ... we'll get to the finer points later ...
 
Last edited:
To make things more organized, I cut and pasted sections of the program to separate ladders. Then I added the JSR blocks to point them to the new subroutines.

Post that program.
 
Thanks Ron.
I do have all of my JSR's in ladder 2. I first wanted to make sure that there wasn't maybe a different way I had to do for my PLC. If not, then I must have messed something up in the cutting and pasting.
 
Before, I separated them I could toggle on/off bits and make things work. Now I cant get any thing to toggle in the subroutines. For instance, I was able to toggle on the timers in the Oven timer section of the program and test my logic. Now that I have separated them It no longer works.

What exactly are you trying to toggle? (Address please) You can't toggle an address if somewhere else in your program that address is being written to.
 
What exactly are you trying to toggle? (Address please) You can't toggle an address if somewhere else in your program that address is being written to.

Ok. Before the separation, I could test the oven timer by toggling on B3:1/8, B3:1/9, or B3:1/10. Now they won't toggle. I also tried some random bits, just see if the JSR's were working, and they wouldn't work either.
 
here's a handy "scan tester" that you can insert (temporarily if you like) just to see if a section of code is being scanned ...

use an UNconditional rung with an ADD instruction ... make Source A an otherwise UNused Floating Point location (example: F8:0) ... make Source B the number "1" ... make the Destination the same address that you used for Source A ...

this should increment each time the processor scans the rung ... if the number is changing, you're scanning ...

note that if the value ever gets up above 16,000,000 (and change) then the value will freeze ... just type a number "0" at the Destination to reset it again ...
 
Last edited:
Ok. Before the separation, I could test the oven timer by toggling on B3:1/8, B3:1/9, or B3:1/10. Now they won't toggle. I also tried some random bits, just see if the JSR's were working, and they wouldn't work either.


B3:1/8 has a OTE instruction in LAD 4 rung 7

B3:1/9 has a OTE instruction in LAD 5 rung 7

B3:1/10 has a OTE instruction in LAD 6 rung 7

The OTE instruction will turn the bits false if it's rung conditions are false,true if the rung condition are true.
You will not be able to toggle those bits. The program has control.

My guess is the other program was not scanning the ladders with the rungs with the OTE instructions, allowing you to toggle the bits.
 
Last edited:
B3:1/8 has a OTE instruction in LAD 4 rung 7

B3:1/9 has a OTE instruction in LAD 5 rung 7

B3:1/10 has a OTE instruction in LAD 6 rung 7

The OTE instruction will turn the bits false if it's rung conditions are false,true if the rung condition are true.
You will not be able to toggle those bits. The program has control.

My guess is the other program was not scanning the ladders with the rungs with the OTE instructions, allowing you to toggle the bits.

Thanks Mickey! I guess I jumped the gun, it looks like the subroutines are working. What is an OTE instruction?

This is my first large program from scratch, in RSLogix, how does it look?
 
Hello Ayrond, if you want to know what an OTE is just highlight the instruction and press F1 on your keyboard it will tell you what it is, you can do the same for other instruction as well
 

Similar Topics

Hi everyone, I'm working on a project where I need to exchange data between a Siemens S7-1200 PLC and an Allen-Bradley MicroLogix 1400 PLC. The...
Replies
8
Views
602
I have a MicroLogix 1200 that has an 8 input and a 16 output. Every 6 months-year I get a fault and when online go to error it is something like...
Replies
3
Views
490
Have a bad output on a Micrologix 1200. Moved wire over to an available output, changed program to associate with new output. downloaded program...
Replies
8
Views
748
I need help achieving the following task: ML1200 sending 4 to 20 mA thru analog output ch0 to a DC speed controller analog input(4 to 20 mA) my...
Replies
3
Views
667
Hi there I am new with this thing and i don't know how to connect Allen Bradley Micrologix 1200 PLC to Raspberry Pi using USB to RS485 in NodeRED...
Replies
3
Views
2,264
Back
Top Bottom