
martinav (Customer) asked a question.
Pretty simple situation here. However, it just doesnt work. I know its just me having a mental block on the order of operations. Like with math, there is a concrete order of operations. I feel like with this stuff, its a crapshoot what happens. Its not a left to right top to bottom kind of thing. That would be too simple. It seems like all operations on rung 15 happen at once, but if MC4 resets before MC2 sets, or if JMP to S4 happens then MC2 nor MC4 get operated on.
What seems to be happening here is.. when MC4 is closed, MC4 resets, and JMP to S0 happens, but MC2 does not set. So, i think the logic of what I want this to do would be left to right top to bottom. So, how would I write this to actually make it work?
MC 2 being reset again by communication?
seems i need ta make that a C-bit then.
MC2 it is a normally open-momentary button that takes a pressure reading from a gauge. If I push the MC4 button (set to on) to change gauge units, I want it to trigger a pressure reading, then disable the units button. Thats what it is actually doing. I'm guessing I need a different location to communicate this... via a C-bit.. maybe?
@bcarlton (Customer)
nope... same diff...
ok, is there a debug mode where you can step through the scan?
Nothing is going to work until I can see the flow. increment counters arent enough.
There is a debug mode on the Do-More Designer Software.
https://accautomation.ca/brx-plc-online-editing-and-debug-mode/
As you mentioned, you can single-step through the logic.
Regards,
Garry
https://accautomation.ca/series/brx-do-more-plc/
MC is a Modbus (Slave) COIL - that means that a CLIENT (Master) is WRITING to it? You have 2 "Masters" of MC2 - this code block (SET) along with the HMI (i.e. Modbus Master)? You are asking why MC2 is changing - what is the other Master doing? Is it constantly updating the value of MC2?
Is this expected behavior? Typically, you implement multiple masters using 3 bits (Master1, Master 2, and then merge them intelligently to the actual bit that the rest of your logic uses, e.g. based on an Auto vs. Manual mode you drive the actual bit with either Master1 or Master2, for example). If you try to do this using a single bit, you get strange behavior like you are seeing.
@HOST_franji1 (HOST Engineering)
"3 bits (Master1, Master 2, and then merge them intelligently to the actual bit that the rest of your logic uses, e.g. based on an Auto vs. Manual mode"
You have an example of this?
Say you have X0 is a physical momentary push button. Modbus Coil 00042 (MC42) is a logical momentary push button being written by an HMI to the PLC (HMI turns it ON for 1 second then turns it OFF). C1 is the ACTUAL STATE used by the rest of the logic.
You have X100 is a DI specifying the Master: X100 OFF means X0 is the control, X100 ON means MC42 is the control. I don't necessarily want to call it Manual vs. Auto, but the point being there are 2 different sources for the same input - the rest of the logic only cares about C1.
Typically, you would process this in $tTopOfScan, to resolve X0, MC42, and X100 to C1. You use C1 in the rest of your program:
@HOST_franji1 (HOST Engineering)
So are you saying this?
SG0
MC1 ----||--------------------------------------(set)---C1
MC2 ----||--------------------------------------(set)---C2
MC3 ----||--------------------------------------(set)---C3
Pass all these modbus coils from he HMI into C-bits?? for example? Then use the C-bits in my program?
It appeared you have 2 sources for the state of a button? I may have this wrong - I apologize.
You are using MC2 as an OUTPUT in your logic. You also have a Modbus Master WRITING to MC2? Please answer that question first.
Buttons in my HMI drive MCx bits. Most are momentary. A couple are set 'on'. Which I (rst) in my logic. Unless I need to do that different.