analog program

Join Date
May 2009
Location
egypt
Posts
43
I need an analog program for level control with S7-300
I try to do it and this is the program
L PIW 256
ITD
DTR
T DB1.DBD0
L DB1.DBD0
L 27648.0
/R
T DB1.DBD2
L DB1.DBD2
L 10.0
<R
= M0.0
L DB1.DBD2
L 90.0
>R
= M0.1
A M0.0
S Q4.0
A M0.1
R Q4.1




But I can know if this program is true or not I want your help

thanks
Adel
 
Hello Adel;
At teh beginning of your function you are taking the analog input value from the analog channel, converting it to a REAL value, and dividing it by the maximum value that an analog input should have, 27648 (as a REAL). This is all basically OK.
Let's say you have 20 mA on the input, the analog value will be 27648.0. Divided by 27648.0, the result will be 1. Any other value will give the result of the division as smaller than 1, so M0,0 will always be true; M0.1 cannot ever become true.
If what you are trying to do is obtain a percentage, you should multiply the result of the division by 100.0. That way your comparisons will work.

Another point: your function does not take into account what happens when the values of the analog channel are not whithin their appropriate ranges. What happens if the signal is 20.4 mA (and overrange/underrange does happen, due to noise or miscalibration, for example) or the channel sends an error message, (hex)FFFF?
You might want to react differently than when the signals are within normal, expected range.

Hope this helps,
Daniel Chartier

P.S. I encourage you to develop your own functions for you own needs, of course. But have you looked at FC105 "SCALE", in the TI-S7 converting library?
Regards, D.C.
 
Last edited:
Just one little point, there is no need for the following:

T DB1.DBD0
L DB1.DBD0

when you transfer a value from the accumulator to a data store, the value remains in the accumulator as well, so the 'L' instruction is unnecessary.
 

Similar Topics

Hello, the PLC in question is 1769-L30ER. I have a local 4-20mA Analog Output module (1769-OF4CI), and also a remote ethernet PointIO analog...
Replies
0
Views
397
Curious, is it common to program in offsets to calibrate/correct analog sensor readings in certain applications? As an example, I have a couple...
Replies
11
Views
3,112
Hi Guys, How is Analog 4-20mA Level sensor Programmed in CLICK software of Automation Direct? Which Instruction set.
Replies
5
Views
2,230
this is my first time using the analog programming . i want to take the input from the thermocouple and display it, I'm using step7 and plc...
Replies
0
Views
1,122
Help with a program setup. I am using a micrologix 1400 and inputting a 0-10VDC analog signal. My application is a part width measurement. The...
Replies
3
Views
1,878
Back
Top Bottom