4/5/2013 5:01 AM | |
Posts: 1064 Rating: (72) |
Helllo edsan Take a look at this link it should help you with the pointers pay attention to ibn services reply /tf/WW/en/Posts/73282 |
This contribution was helpful to1 thankful Users |
4/7/2013 3:20 PM | |
Joined: 1/28/2009 Last visit: 9/7/2024 Posts: 6846 Rating: (1365)
|
Hello, And this is the STL version,To manipulate a cell in STL, You should know the absolute address(offset) in corresponding DB. As a demo solution provided in SCL ,Check the noticeable differences. [code]ORGANIZATION_BLOCK "Cycle Execution" TITLE = "Main Program Sweep (Cycle)" AUTHOR : HD FAMILY : Forum_E NAME : Demo1 VERSION : 0.1 VAR_TEMP OB1_EV_CLASS : BYTE ; //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1) OB1_SCAN_1 : BYTE ; //1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n of OB 1) OB1_PRIORITY : BYTE ; //Priority of OB Execution OB1_OB_NUMBR : BYTE ; //1 (Organization block 1, OB1) OB1_RESERVED_1 : BYTE ; //Reserved for system OB1_RESERVED_2 : BYTE ; //Reserved for system OB1_PREV_CYCLE : INT ; //Cycle time of previous OB1 scan (milliseconds) OB1_MIN_CYCLE : INT ; //Minimum cycle time of OB1 (milliseconds) OB1_MAX_CYCLE : INT ; //Maximum cycle time of OB1 (milliseconds) OB1_DATE_TIME : DATE_AND_TIME ; //Date and time OB1 started int_lp_counter : INT ; ext_lp_counter : INT ; buffer1 : DINT ; END_VAR BEGIN NETWORK TITLE = OPN "test"; //open related db1 /////////////////EXTERNAL LOOP/////////// L 10; lp1: T #ext_lp_counter; //calculate pointer to access corresponding i,j cell //1st section ITD ; L L#1; -D ; L L#20; // 2bytes for 10 cells *D ; T #buffer1; ///////////////////INTERNAL LOOP//////// L 10; lp2: T #int_lp_counter; //calculate pointer to access corresponding i,j cell //2nd section ITD ; L L#1; -D ; L L#2; *D ; L #buffer1; +D ; SLD 3; L P#DBX 0.0; OD ; LAR1 ; //final pointer formation L #int_lp_counter; L #ext_lp_counter; *I ; T W [AR1,P#0.0]; L #int_lp_counter; LOOP lp2; ///////////////////////////////////////////////////// L #ext_lp_counter; LOOP lp1; END_ORGANIZATION_BLOCK[/code] Feel free to improve or expand this draft Best regards Hamid Hosseini Attachmentindirect_addressing.zip (1036 Downloads) |
Last edited by: hdhosseini at: 4/7/2013 3:26 PM// typo Last edited by: hdhosseini at: 8/2/2018 10:18:07 AM |
|
This contribution was helpful to3 thankful Users |
Follow us on