12/30/2016 5:33 AM | |
Posts: 57 Rating: (1) |
Hi guys I have created a function block which name is motor(FB10). It has four I/O : star,stop : bool as input & Qstart , Qstop : bool as output.(You can see that in the attachment file). I've used TIMER_P(CFC_Library \ ELEMENTA \ IMPULS \ TIMER_P) in my function block. I've defined the TIMER_P as static VAR. Now I want to assign the "start" of my func_blck to "I0" of TIMER_P & assign "Q0" of TIMER_P to "Qstart" of my func_blck in the SCL_Source. please look at the following program: FUNCTION_BLOCK FB10 TITLE = 'motor' // // Block Comment... // VERSION: '1.0' AUTHOR: Author NAME: Name FAMILY: Family // Block Parameters VAR_INPUT // Input Parameters start,stop : BOOL; END_VAR VAR_IN_OUT // I/O Parameters END_VAR VAR_OUTPUT // Output Parameters Qstart , Qstop : BOOL; END_VAR VAR_TEMP // Temporary Variables END_VAR VAR TIME_start : TIMER_P; TIME_stop : TIMER_P; END_VAR // Statement Section TIME_start( SAMPLE_T :=0.1 // IN: REAL ,TIME0 := 2.0 // IN: REAL ,MODE := 1 // IN: INT ,RESET := 0 // IN: BOOL ,I0 := start // IN: BOOL ); :=Qstart; // OUT: BOOL ; END_FUNCTION_BLOCK I don't know how to assign the timer_output to my func_blck output??? Would you help me please.??? Thank you. AttachmentMOTOR.zip (68 Downloads) |
Last edited by: yasinEncoder at: 12/30/2016 8:03:42 AMLast edited by: yasinEncoder at: 12/30/2016 8:06:14 AMLast edited by: yasinEncoder at: 12/30/2016 11:44:08 AMLast edited by: yasinEncoder at: 12/30/2016 11:45:16 AMLast edited by: yasinEncoder at: 12/30/2016 12:12:22 PM |
|
12/30/2016 12:53 PM | |
Joined: 10/26/2011 Last visit: 4/18/2024 Posts: 760 Rating: (190)
|
Hello, why did you programmed an own motor block? In the PCS 7 library you find very good motor blocks. |
SIMATIC PCS 7 - Overview |
|
12/30/2016 3:00 PM | |
Joined: 3/14/2008 Last visit: 4/18/2024 Posts: 2064 Rating: (926)
|
Hi yasinEncoder, The variables TIME_start and TIME_stop are declared as type: TIMER_P. This means you can address the variables as the TIMER_P IO. So, you can assign the command you want like this: QStart :=TIME_start.Q0;
|
If I could help you, you can use the RATE button. Thank you. |
|
12/30/2016 3:47 PM | |
Joined: 3/14/2008 Last visit: 4/18/2024 Posts: 2064 Rating: (926)
|
Hi yasinEncoder, I had some spare time so I modified your SCL source a little and added some comments. In order to use the source, you must open the symbol table and enter symbolic name: "MOTOR" and assign a FB number to it like FB5000. The source will explain why I assign symbolic names rather than FB names. I also added some attributes, so you can use this variables in WinCC. Please see the help file in SCL editor and look for: "System attributes for parameters". It will give you a full list. AttachmentFB10.zip (70 Downloads) |
If I could help you, you can use the RATE button. Thank you. |
|
This contribution was helpful to1 thankful Users |
12/31/2016 11:40 AM | |
Posts: 57 Rating: (1) |
Hi dear Oreca I compiled the SCL_Source that you sent but It had some bugs. I'm trying to fix it. |
12/31/2016 12:10 PM | |
Joined: 3/14/2008 Last visit: 4/18/2024 Posts: 2064 Rating: (926)
|
Hi yasinEncoder, I have no problem with the code...Did you insert FB5: TIMER_P to your "Blocks" folder? You can find the block under the SFC library. You are declaring TIME_start en TIME_stop as TIMER_P, so the block should be available in the "Blocks" folder. |
If I could help you, you can use the RATE button. Thank you. |
|
1/11/2017 8:06 AM | |
Joined: 2/29/2016 Last visit: 3/12/2024 Posts: 100 Rating: (1) |
Hello, Are there any other ways to use a timer_P in a SCL source? |
1/15/2017 10:36 PM | |
Posts: 57 Rating: (1) |
Yes there are. You can use it with direct address |
Follow us on