News:

  • September 28, 2026, 09:02:04 PM

Login with username, password and session length

Author Topic: C bit staying on with no program code execution.  (Read 34961 times)

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
C bit staying on with no program code execution.
« on: January 19, 2022, 11:45:39 AM »
My boss came in this morning and asked why a blower was running that was not needed after I installed a BRX36 to replace an AB1400 in a scrap grinder.  I hooked up a PC and looked at program code and could see a C9 bit turned on driving the output for the blower.  No programs were running except Main and Top and Bottom of scan.  I use indirect addressing for all I/O.  There are just two programs and neither one was running.  In the program with stages all the stages were off.  Yet that bit stayed on.  I was able to force it off and when I unforced it stayed off.  Then I ran the program again and this time 3 bits stayed on after stopping execution, leaving 3 big motors running!

I was taught back in the days of the TI405 about using OUT in stages instead of SET and turning on the same bits as you jump stage to stage to keep them on as needed or they just go off.  I have dozens of programs over 30 years that work that way, this is the first time I have seen a failure like this.  It could be hazardous.

I cleared the PLC completely and reloaded the program and so far it seems to work correctly over the past hour.

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: C bit staying on with no program code execution.
« Reply #1 on: January 19, 2022, 12:07:53 PM »
No HMIs talking to this BRX36? Is the REST API feature ON? Could another PC be doing this? You might consider whitelisting valid IP addresses that have access to the BRX36's network.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: C bit staying on with no program code execution.
« Reply #2 on: January 19, 2022, 12:30:20 PM »
No HMIs talking to this BRX36? Is the REST API feature ON? Could another PC be doing this? You might consider whitelisting valid IP addresses that have access to the BRX36's network.

The only way to write C bits remotely is through the native Do-more protocol, so unless it is an HMI or some other PLC doing it through RX/WX, it isn't possible through REST, Modbus, or DL RX/WX.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: C bit staying on with no program code execution.
« Reply #3 on: January 19, 2022, 12:43:07 PM »
My boss came in this morning and asked why a blower was running that was not needed after I installed a BRX36 to replace an AB1400 in a scrap grinder.  I hooked up a PC and looked at program code and could see a C9 bit turned on driving the output for the blower.  No programs were running except Main and Top and Bottom of scan.  I use indirect addressing for all I/O.  There are just two programs and neither one was running.  In the program with stages all the stages were off.  Yet that bit stayed on.  I was able to force it off and when I unforced it stayed off.  Then I ran the program again and this time 3 bits stayed on after stopping execution, leaving 3 big motors running!

I was taught back in the days of the TI405 about using OUT in stages instead of SET and turning on the same bits as you jump stage to stage to keep them on as needed or they just go off.  I have dozens of programs over 30 years that work that way, this is the first time I have seen a failure like this.  It could be hazardous.

I cleared the PLC completely and reloaded the program and so far it seems to work correctly over the past hour.

That's concerning. SET leaves the state active, OUT gets shut off through termination. If you have an example of a program that is leaving OUT coils enabled after termination of the stage, program, or task, I would really like to have the code.

One major thing happening when you cleared and reloaded the PLC is the clearing of all retentive memory. I have seen cases where stuff was just a little off until image register was cleared, and then everything was fine. I have had my suspicions as to why it might be, but I've never been able to prove anything, things related to how run mode edits try very hard to not bump things. If it were to happen again, please use the retentive memory manager to make a snapshot of the entire image register.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: C bit staying on with no program code execution.
« Reply #4 on: January 19, 2022, 01:11:36 PM »
...it isn't possible through REST...
Oops. Yeah, I keep forgetting that.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: C bit staying on with no program code execution.
« Reply #5 on: January 19, 2022, 01:14:22 PM »
Bob,
No HMI, No networking, just my PC to the ethernet port, no switch.  I'll send you the program.

This all started because the grinder manufacturer built the machine with 5 start and stop buttons to start 5 motors.  You had to start in one sequence and stop in reverse, and you had to wait several minutes for chips to clear out.  Stop quickly or in wrong sequence and bad stuff happens, at least 5 times so far!  Manufacturer wanted $6000 to come out and reprogram.  AB wanted $700 for software to talk to AB1400, only one in the plant.  Manufacturer wouldn't give us the program, it was "proprietary"  With just the wiring diagram I wrote a new program in one day, two days to install a BRX36 and 3 input modules and convert outputs to 24vdc.  $620 for the BRX and modules, sell the AB1400 and two modules for $600 on Ebay.  I no longer need an oddball spare PLC for like $1100.   Win Win Win!!! 

We now have 8 BRX36 plcs in the plant and one spare, with 3 more coming soon.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: C bit staying on with no program code execution.
« Reply #6 on: January 19, 2022, 01:22:43 PM »
Nothing you are doing should be sensitive to known issues, but for reference, what firmware version are you running?
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: C bit staying on with no program code execution.
« Reply #7 on: January 20, 2022, 12:21:55 PM »
We now have 8 BRX36 plcs in the plant and one spare, with 3 more coming soon.

Do the other 8 BRX36 PLCs have a similar function as this one that is failing? If so, do they leave C-bits ON as well?
There are two types of people in the world; those that can extrapolate from incomplete data sets.

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: C bit staying on with no program code execution.
« Reply #8 on: January 20, 2022, 04:01:35 PM »
All programmed in the same way and no problem.  It got worse last night, 4 bits stayed on, even through a power cycle, and tripped a 200amp 480 volt breaker when 4 large motors started at once.  I have another PLC here,  I am thinking replace this one with another and see if the problem goes away.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3847
    • Host Engineering
Re: C bit staying on with no program code execution.
« Reply #9 on: January 20, 2022, 04:51:20 PM »
All programmed in the same way and no problem.  It got worse last night, 4 bits stayed on, even through a power cycle, and tripped a 200amp 480 volt breaker when 4 large motors started at once.  I have another PLC here,  I am thinking replace this one with another and see if the problem goes away.

If they're retentive, they will stay ON.  If you expect them to turn OFF after a power cycle, make them NON-retentive.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: C bit staying on with no program code execution.
« Reply #10 on: January 20, 2022, 05:49:19 PM »
Which instructions are you using to turn the bits on? OUT I assume. If you're using something other than OUT, the termination behavior could be doing this.

Greg

  • HostTech
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 702
  • Hmmm...
    • Host Engineering, Inc.
Re: C bit staying on with no program code execution.
« Reply #11 on: January 20, 2022, 07:19:44 PM »
All programmed in the same way and no problem.  It got worse last night, 4 bits stayed on, even through a power cycle, and tripped a 200amp 480 volt breaker when 4 large motors started at once.  I have another PLC here,  I am thinking replace this one with another and see if the problem goes away.
Sorry about that. I tried being very mean to your program and test programs in attempt to duplicate your issue. I was running some things by BobO and he had a look at your program too. He noticed your AUTO Program code block was set to non-retentive. If it so happens that the BRX power cycles, or better yet, reboots for some reason, while AUTO is running, it could possibly leave the C-bits on the OUTs in the ON state when it comes back up. So, you might check your System Log to see if there have been any PLC reboots, or you might want to set AUTO to retentive and try again, or you might want to at least utilize the $tFirstScan System Task to reset those C-bits to zero on first scan.
There are two types of people in the world; those that can extrapolate from incomplete data sets.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: C bit staying on with no program code execution.
« Reply #12 on: January 20, 2022, 07:47:41 PM »
Quote
while AUTO is running, it could possibly leave the C-bits on the OUTs in the ON state when it comes back up

Not seeing the code, are you saying C-bits would potentially be active when controller comes back up? How would this be possible if they're non-retentive?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: C bit staying on with no program code execution.
« Reply #13 on: January 20, 2022, 08:17:17 PM »
Quote
while AUTO is running, it could possibly leave the C-bits on the OUTs in the ON state when it comes back up

Not seeing the code, are you saying C-bits would potentially be active when controller comes back up? How would this be possible if they're non-retentive?

He sent it to us.

No. AUTO is his program block that is driving the C bits. It is marked as non-retentive, which means if it was running when the PLC rebooted or power-cycled, it will be off when the PLC restarts. C bits are retentive by default, so since the program block ends (by restarting the PLC) without clearing the bits, they will still be on at startup. Either mark AUTO as retentive, set the C bits to non-retentive, or clear the associated C bits in $tFirstScan.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: C bit staying on with no program code execution.
« Reply #14 on: January 21, 2022, 07:25:57 AM »
After reading through the help file, I can't determine how setting the AUTO Program to retentive would solve the issue.