Sign in to follow this  
Followers 0
gruntstripe

Help Required with S7 STL

4 posts in this topic

Hi, If somebody could help me here I would be very grateful. I'm attempting to get to grips with STL code and I am making progress slowly, very slowly. With reference to the code (which is used in control / communication of an ABB ACS800 Inverter) in the screenshot: As I understand it, we LOAD PIW [AR1,P#0.0] // in this case PIW = 256 then TRANSFER this word to both #SW and #Stat_Word then LOAD PIW [AR1,P#6.0] // i.e. add 6 bytes to the start address 256 then TRANSFER the contents of this address to #PZD4 NOW I GET STUCK, what does 'A L 1.2' do? It's an AND instruction followed by a LOAD. What does the 1.2 do? I'd be grateful for any help, thanks in advance.

Share this post


Link to post
Share on other sites
Hi From the info thats given I would assume that #SW or Stat_word is declared as the first word in the TEMP area of the interface (LW0), the value of PIW256 is transferred to this word, A L1.2 accesses bit 2 of the second byte of this word and then copies the value of that bit to #running, similarly AN l1.3 copies the NOT value of bit 3 of the seconf byte to #common_alarm, and A L0.1 copies the value of bit 1 of the first byte to #drive_in_remote Edited by malc cope

Share this post


Link to post
Share on other sites
A L 1.2 is boolean AND, A and AN is statement list version of Normally Open and Normally Closed contacts, so A L 1.2 = Running indicates that the 3rd bit in the drive status word is the running status bit. The L area of data is the TEMP storage area in blocks, OB's, FC's and FB's, each block starts at LB0 (Local Byte 0), the actual data area is offset by the system. Using direct L are addressing can be seen as bad programming as it can lead to problems later on if someone makes a modification and changes the TEMP area structure. A better method would have been to have created 16 boolean bits in the temp area which would mimic the drive status word bits and then create a pointer using the first bit as a marker, this would protect the block against future modifications.

Share this post


Link to post
Share on other sites
Just wanted to say thanks to you two. Helped me get a better understanding of things. Cheers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0