Status word help...

Matchu04

Lifetime Supporting Member
Join Date
Mar 2013
Location
Northampton
Posts
287
Afternoon Guys / girls

Im not sure if this is seiemens specific but today I was going through some code in S7 trying to determine how a beer flow was measured on this machine and I stumbled across a instruction that I dont understand what its doing. I cant post the code as I forgot to get a screen shot but I can explain.

The instruction in question was;
L STW
I understand that its loading the status word into the ACCUM but then its shifting 4 places, which normally is to convert to a pointer, but am I missing something here?? I was under the inpression the status word was a status not an adress.. Could someone clarify this for me.

Regards

Matt
 
The S5 to S7 converter generates code for the DO instruction that loads the status word and saves it in a temp variable before then loading the indirect address and shifting it left 4 bits. Post the code to confirm what you have.
 
Apologies for taking a few days getting back to you guys. This is the code of what I was taking about, I believe LD has hit the nail on the head but I would like to understand why you would want to load the STW.

Code:
      AN    #RES                        // JUMP PAST RESET IF NOT
      JC    M001
      L     0
      R     #S2CU
      R     #S3CU
//;
M001: OPN   DB   135                    // CALL COUNTER MODULE DB
      L     #DW
      T     DBW    0
// GET COUNTER DW NUMBER
      T     #conv_akku1
      L     STW
      T     #conv_stw
      L     DBB    1
      SLW   4
      LAR1  
      L     #conv_stw
      T     STW
      L     #conv_akku1
      L     DBW [AR1,P#0.0]             // READ VALUE
      T     MW   250                    // COUNT STORE FOR THIS FB
//;
      OPN   DB   130                    // ??
      L     #S3V                        // GET FINAL TRIP VALUE
      L     #S2V                        // GET STAGE 2 OFFSET
      -I                                // SUBTRACT TO GET S2 VALUE
      OPN   DB   135
      L     MW   250                    // RECALL ACTUAL COUNT
      <I                                // STAGE 2 COUNT REACHED
      =     #S2CU                       // SET STAGE 2 REACHED FLAG
      AN    #S2CU                       // IF NOT STAGE 2 COUNT REACHED
      R     #S3CU                       // THEN ALSO RESET STAGE 3.
//;
      BEC                               // STAGE 2 COUNT REACHED
//;
//;                      // RECALL ACTUAL COUNT
      OPN   DB   130                    // ??
      L     #S3V                        // GET STAGE 3 VALUE
      >=I   
      =     #S3CU                       // SET STAGE 3 FLAG
 
As this code is a conversion from Step5, the accumulator and status word have to be stored because they get modified by the load and shift instructions prior to setting up the address register. Notice that they are restored immediately before the data is read from the indirect address using AR1
 
I think the penny has dropped. The area pointer for the is stored in DBB 1 but in order not to lose the staus word prior this instruction it is stored temp in #conv_akkul. This is then restored as mentioned...



Code:
M001: OPN   DB   135                    // CALL COUNTER MODULE DB
      L     #DW
      T     DBW    0
// GET COUNTER DW NUMBER
      T     #conv_akku1
      L     STW
      T     #conv_stw
      L     DBB    1
      SLW   4
      LAR1  
      L     #conv_stw
      T     STW
      L     #conv_akku1
      L     DBW [AR1,P#0.0]             // READ VALUE
      T     "VARW0"
 

Similar Topics

Hi I am working with sinamics starter software with CU310DP. Being a learner, i am trying to find one of the status bit (Status word 3), What...
Replies
4
Views
1,476
Hello, I hoping someone can provide clarification on PF525 Status word, namely the .AtReference and .Active bits. I cannot find anything from...
Replies
2
Views
2,642
What is the following Image suggesting ? Thanks
Replies
5
Views
1,658
Hi, I'm trying to decipher some Statement List code written for a Siemens S7-300 in the late '90s. I've come across an AN instruction, which I...
Replies
6
Views
3,527
Today while tracking down a 4-20 mA loop problem for old project since 2005. mA for loop is OK but channel give me -1 on scada i found rung...
Replies
5
Views
2,799
Back
Top Bottom