S7 -> TIA (SCL code)

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Hi,

I have something like this in S7 Classic in a FB200 that I wanna use in TIA Portal:

Code:
#FIRST_BEAM:= PIB[#HW_ADDR];

HW_ADDR is a integer input on the block. But, this does not work in TIA. Is this replacable with an easy peace of code ?

Thanks,
Kind regards,
Combo
 
Peek

Thanks Thomas,

Would these replacements work:

// INLEZEN SICK DATA + OP VOLGORDE BRENGEN
// #FIRST_BEAM := PIB[#HW_ADDR];
#FIRST_BEAM := PEEK(area := 16#1, dbNumber := 0, byteOffset := #HW_ADDR);
// #LAST_BEAM := PIB[#HW_ADDR + 1];
#LAST_BEAM := PEEK(area := 16#1, dbNumber := 0, byteOffset := #HW_ADDR + 1);
// #STATUS := PIB[#HW_ADDR + 2];
#STATUS := PEEK(area := 16#1, dbNumber := 0, byteOffset := #HW_ADDR + 2);

FOR #i := 1 TO 12 DO
// #BEAM_BYTES[#i] := PIB[#HW_ADDR + 2 + #i];
#BEAM_BYTES[#i] := PEEK(area := 16#1, dbNumber := 0, byteOffset := #HW_ADDR + 2 +#i);
END_FOR;





Thanks,
Kind regards,
Combo

Like this:
Code:
#FIRST_BEAM := PEEK(area := 16#1, dbNumber := 0, byteOffset := #HW_ADDR);
 
Would these replacements work:
I'd say yes.

But with a S7-1500 you have another option: You can create a PLC datatype (UDT) with your structure, and assign a variable in the variable table to this UDT.

I'm using this for example for frequency inverters, where I create a UDT (STW : WORD; MAV : INT) and assign the UDT to the address in the input area. You can also split down the STW into the single bits.
Then my drive FB has a Parameter with this UDT, and another UDT parameter for output area. You have much better cross reference data with this access type.
 
I'd say yes.

But with a S7-1500 you have another option: You can create a PLC datatype (UDT) with your structure, and assign a variable in the variable table to this UDT.

I'm using this for example for frequency inverters, where I create a UDT (STW : WORD; MAV : INT) and assign the UDT to the address in the input area. You can also split down the STW into the single bits.
Then my drive FB has a Parameter with this UDT, and another UDT parameter for output area. You have much better cross reference data with this access type.

I'll 2nd this; it's one of my favorite hidden tricks with the new CPUs. It works great for things like drive telegrams.

You need one PLC Data Type for the inputs and one PLC data type for the Outputs, then you assign it to the first bit of the IO address. Example: if your drive was IW200-210, you'd declare a tag of type "Combo's Custom Drive Status UDT" at I200.0.
 
Hi

Great tip, thanks guys !! 🍻

I'll 2nd this; it's one of my favorite hidden tricks with the new CPUs. It works great for things like drive telegrams.

You need one PLC Data Type for the inputs and one PLC data type for the Outputs, then you assign it to the first bit of the IO address. Example: if your drive was IW200-210, you'd declare a tag of type "Combo's Custom Drive Status UDT" at I200.0.
 

Similar Topics

Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
314
Hi all, I'm currently trying to convert code written in STL for a S7-300 to SCL for an S7-1200. I'm getting stuck trying to address inputs in...
Replies
4
Views
2,641
Hello, In step7 I would be able to access FB has been created by SCL and after assigning an associated instance DB i can monitor to debug the...
Replies
3
Views
2,306
Hi all, I hope everyone is well, I am in need of something so simple, I have made a small program in SCL and want to monitor some loops in...
Replies
5
Views
4,393
I have a ramp function which is using Time data type for calculation , I have converted the time to DINT and divided these values and saved in a...
Replies
9
Views
5,315
Back
Top Bottom