Programming Question

I agree if the OP wants to use the Arduino why not do the PID in the PLC and send the CV to the Arduino, the OP has not said how he is getting the set point into the Arduino or the PV back, so much information missing, he obviously does not understand how a PID should work. if the feedback is not met then a true PID will increase or decrease it's CV until it does so if it cannot reach the desired SP then the output to the motorised valve will be at either limit, therefore the PID is either not doing it's job or the required flow cannot be achieved because the hardware is not capable.
 
@parky, thanks so much for the attached, it's of a great help. That gives the PLC a 'supervisory role' kind of. I think I can implement that. I will keep you updated on how the project goes. Thanks.
 
You will need to use "D" registers that are in the latch range
open up PLC parameters then go to device & set up the latch range there, this will keep the data valid in the event of battery failure or power down.

parameter.jpg
 
Hello, there is a little problem with my ladder logic.

After converting and scaling the raw data, I saved it in a D register and compared it to the setpoint to produce a specific output. However, when I simulated the programme, the D register displayed the correct figure at the rung where I saved the data, but its showing zero (int) at the rung where I compared it with the setpoint. What could be the issue? I've done everything I can.
 
Also, can someone kindly help with how to use a timer timing bit in GX works 2 with ladder logic. i.e, how to make the output energized for the duration of the timing and stops when the timer stops timing.
 
I am not sure how to do that in gx works ladder logic.


[Enabled] is the output rung of the timer (i.e. when the timer's input rung is True, the timer's output rung will be True as well). You could output a bit, call it [TimerEnabled], to the right of the timer on the timer's output rung. That bit will become 1 when the timer is timing and will remain 1 after the timer is done or until the timer input rung goes False.

NOT done is [NC timer.Q] or some such.

So if you ANDed (i.e. put in series) [NO TimerEnabled] and [NC timer.Q], then an output bit on the rung from those two instructions in series would be 1 while the timer was timing, and would change to 0 when either the timer was done or the input rung to the timer went False.


You may even be able to put the [NC timer.Q] on the output rung of the timer and write that TimerIsTiming bit after that.
 
Last edited:
[Enabled] is the output rung of the timer (i.e. when the timer's input rung is True, the timer's output rung will be True as well). You could output a bit, call it [TimerEnabled], to the right of the timer on the timer's output rung. That bit will become 1 when the timer is timing and will remain 1 after the timer is done or until the timer input rung goes False.

NOT done is [NC timer.Q] or some such.

So if you ANDed (i.e. put in series) [NO TimerEnabled] and [NC timer.Q], then an output bit on the rung from those two instructions in series would be 1 while the timer was timing, and would change to 0 when either the timer was done or the input rung to the timer went False.


You may even be able to put the [NC timer.Q] on the output rung of the timer and write that TimerIsTiming bit after that.

Thanks so much. I've just been able to do that. It worked.
 
Hello, there is a little problem with my ladder logic.

After converting and scaling the raw data, I saved it in a D register and compared it to the setpoint to produce a specific output. However, when I simulated the programme, the D register displayed the correct figure at the rung where I saved the data, but its showing zero (int) at the rung where I compared it with the setpoint. What could be the issue? I've done everything I can.

Can anyone help with this?? Been giving me lots of headache
 
Can you post your code for that bit, There are a couple of possibilities, you are trying to use a floating point with an integer compare etc. you have the wrong "D" register or it is being written to somewhere between the conversion & the compare, however, it is possible it could be written to elsewhere, the problem with on-line monitoring is that the communications for status are read at different times so if being written to elsewhere at one point in the scan but updated at different times (Rare but have seen it).
What instructions are you using remember doing moves to a register there are a couple of types i.e. floats (EMov), Int (MOV) Doubles (DMove) the same goes for compares & you cannot mix them you have to convert them first.
The problem is that "D" registers are 16 bit but when you use them for doubles or floats then it uses two 16 bit registers i.e. if you do a [EMOV D100 D150] then it moves D100 & D101 to D150 & D151.
Is it possible you have used floats or doubles but used the following register elsewhere for example
[EMUL D100 E2.5 D102] but then
[CMP D102 D150]---------- If you did this then CMP is 16 bit but d102 (+D103) is a float so 32 bit.
or maybe you have used D103 elsewhere thinking it is spare.
I will suggest that if using floats or doubles then you have a range for floats a range for doubles & a range for integers.
i.e.

D100 to D198 floats (100 registers but 50 floats)
D200 to D298 Doubles (100 registers but 50 doubles)
D300 to D400 integers (words) 100 registers 100 integers))
Also remember that not all D registers are retentive so power down may reset them the range can be set to retentive in the PLC Parameter.
 
Last edited:
Can you post your code for that bit, There are a couple of possibilities, you are trying to use a floating point with an integer compare etc. you have the wrong "D" register or it is being written to somewhere between the conversion & the compare, however, it is possible it could be written to elsewhere, the problem with on-line monitoring is that the communications for status are read at different times so if being written to elsewhere at one point in the scan but updated at different times (Rare but have seen it).
What instructions are you using remember doing moves to a register there are a couple of types i.e. floats (EMov), Int (MOV) Doubles (DMove) the same goes for compares & you cannot mix them you have to convert them first.
The problem is that "D" registers are 16 bit but when you use them for doubles or floats then it uses two 16 bit registers i.e. if you do a [EMOV D100 D150] then it moves D100 & D101 to D150 & D151.
Is it possible you have used floats or doubles but used the following register elsewhere for example
[EMUL D100 E2.5 D102] but then
[CMP D102 D150]---------- If you did this then CMP is 16 bit but d102 (+D103) is a float so 32 bit.
or maybe you have used D103 elsewhere thinking it is spare.
I will suggest that if using floats or doubles then you have a range for floats a range for doubles & a range for integers.
i.e.

D100 to D198 floats (100 registers but 50 floats)
D200 to D298 Doubles (100 registers but 50 doubles)
D300 to D400 integers (words) 100 registers 100 integers))
Also remember that not all D registers are retentive so power down may reset them the range can be set to retentive in the PLC Parameter.

I have just seen where I went wrong, I used < and > instead of E< and E> for floats. Thanks so much for this, you saved me a whole lot of stress.
 

Similar Topics

I'm been deciphering a program for a press here. I've gotten most of it deciphered using the manual to understand the instructions (first mitsu...
Replies
11
Views
292
Hello. Was just curious, if it is possible to load an image from an SD card on to a Compactlogix PLC that came straight out of the box brand new...
Replies
4
Views
545
Hi All, Looking for advice on programming MicroLogix 1400 with RSLogix500. Basically, I have a client who requested I make a "simple" program...
Replies
19
Views
3,216
How do you code it to when you push a button attached to X001, it turns on Y001. Then, the next time you push the button attached to X001 it...
Replies
4
Views
1,611
I am just finishing up my project, which was my first experience with PLCs. I thank everyone that has helped me work through the RIO and analog...
Replies
11
Views
2,968
Back
Top Bottom