S7-300 link variables......

baselch0

Member
Join Date
Jul 2010
Location
Basel
Posts
27
Hi all,

I'd like to kmow if in step7 there is an istruction or a function to give the possibility to link (not add) two variables? I no idea how to realize the code

Example:

Two variables MW100=12(INT FORMAT) and MW102=678(INT FORMAT) so I need to get in the new varaibles the follow result MW104=12678.

Pratically the "union" of the data 12 and 678

Thankd in advance
 
Thanks, correct LD, but I need realize an additional control, because in my example the data are 12 and 678 , but in other case the data could be 12 and 23 etc etc
 
Hang on, your first post suggested the result would be stored as an integer in MW104, do you want the result to be a double integer ?

What about 4523 and 0 ?
 
Hang on, your first post suggested the result would be stored as an integer in MW104, do you want the result to be a double integer ?

What about 4523 and 0 ?

4523 and 0 = 4523.

yeah... I consider to use the data format DINT type
to avoid overflow

Other things I forget to write in the post:
the data will be always positive (never negative eg -345)
 
Code:

Code:
FUNCTION FC 1 : DINT
TITLE =
VERSION : 0.1


VAR_INPUT
  iLowDigits : INT ;    
  iHighDigits : INT ;    
END_VAR
BEGIN
NETWORK
TITLE =

      L     #iLowDigits; 
      L     0; 
      ==I   ; 
      JC    d0; 
      TAK   ; 
      L     9; 
      <=D   ; 
      JC    d1; 
      TAK   ; 
      L     99; 
      <=D   ; 
      JC    d2; 
      TAK   ; 
      L     999; 
      <=D   ; 
      JC    d3; 
      TAK   ; 
      L     9999; 
      <=D   ; 
      JC    d4; 
      TAK   ; 
      L     L#99999; 
      <=D   ; 
      JC    d5; 
      JU    err; 

d0:   L     #iHighDigits; 
      JU    add; 
d1:   L     10; 
      L     #iHighDigits; 
      *D    ; 
      JU    add; 
d2:   L     100; 
      L     #iHighDigits; 
      *D    ; 
      JU    add; 
d3:   L     #iHighDigits; 
      L     1000; 
      *D    ; 
      JU    add; 
d4:   L     #iHighDigits; 
      L     10000; 
      *D    ; 
      JU    add; 
d5:   L     #iHighDigits; 
      L     10000; 
      *D    ; 
      JU    add; 

add:  L     #iLowDigits; 
      +D    ; 
      T     #RET_VAL; 
      SET   ; 
      SAVE  ; 
      BEU   ; 



err:  L     0; 
      T     #RET_VAL; 
      CLR   ; 
      SAVE  ; 
      BEU   ; 


END_FUNCTION
 

Similar Topics

Hello everyone. I have a bunch of e300s connected to a startix which is then going to the plc. All of them are showing their MS and NS lights...
Replies
12
Views
4,507
Hi all. I have been an IT worker for many years. Most of it in server support and networking. However I am VERY new to the PLC environment, but...
Replies
2
Views
2,119
Hello! I haven't worked with software redundancy before, so I was wondering if I could use the CP343-1 Lean modules (which I'm using for the...
Replies
0
Views
1,768
Does anyone know if there is a way to identify an S7-300 PLC by blinking the LEDs? I'm working in a development lab and we have a bunch of...
Replies
4
Views
1,888
Hi All, As part of a bigger project and not being too familiar with S7 I'm trying to send & receive data from datablocks over Profibus between a...
Replies
2
Views
1,725
Back
Top Bottom