10/14/2013 3:22 PM | |
Posts: 57 Rating: (8) |
Hi Pegaia, I think I have a similar conceptual problem using S7-1200, SCL and pointers. Imagine I defined an UDT to access Analog Inputs: AI_UDT: AI_man bool (offset 00.0) AI_per word (offset 02) AI_scaled real real (offset 04) AI_man_val real (offset 08) Imagine I defined a DB with multiple AI_UDT DB_AI: AI_00 AI_UDT AI_01 AI_UDT AI_02 AI_UDT Imaginethat DB_AI is 300/400 style,so that I can use direct addressing. Imagine that I want to handle each AI with a SCL functioncalled _AI_single_read that will recive as a variantthe DB element pointer: _AI_single_read("DB_AI".AI.00); _AI_single_read("DB_AI".AI.01); I did it, and everything works But now I've to write the SCL code for _AI_single_read andd I really don't know how to use offset inside the function. I defined the input parameter as "v_pointer" (variant). Now I should access v_pointer+00.0 as bool v_pointer+02 as word v_pointer+04 as real v_pointer+08 as real Any hint on how to do it? thanks a lot AttachmentSCL_pointer_example.zip (522 Downloads) |
Last edited by: salrandazzo at: 10/15/2013 2:18 PMNo need for variant pointer. I just used an "in/out" variable defined as AI_UDT. I still don''t know how to use a variant variable, using SCL with a 1200 PLC. Last edited by: O_Moderator at: 10/15/2013 1:25 PMnew subject after splitting from /tf/WW/en/Posts/68078#top Last edited by: salrandazzo at: 10/14/2013 4:36 PMUploaded my little project. the block where I don''''''''''''''''t know how to preceed is FC9 __AI_single_read |
|
10/15/2013 4:13 PM | |
Joined: 7/7/2010 Last visit: 1/17/2025 Posts: 15541 Rating: (2465)
|
I think if you change this [code]_AI_single_read("DB_AI".AI.00); _AI_single_read("DB_AI".AI.01);[/code] to read like this: [code]_AI_single_read("DB_AI".AI.00.AI_man); _AI_single_read("DB_AI".AI.01.AI_man);[/code] the portal compiler will success at compiling the calling routine with a variant. Now how to use the variant is another matter as even v12 is unclear on how to use it in SCL. Perhaps this is enough to get you on the right path. Please post your solution. May need to submit a Support Requestfor proper usage. The In/Out as a UDT is definitely better than using a pointer though. |
science guy |
|
Follow us on