VSD and Profibus

shahmirous

Member
Join Date
Nov 2007
Location
Perth
Posts
17
Hello everybody ,

I have a STL program which I am trying to analyse but there are afew things that I? don't understand and I couldn't find them anywhere.here is a part of the program :

L #PZD_Q_P
L 8
*I
T #INT_TEMP
ITD
T #P_TEMP1

L P#Q 0.0
T #P_TEMP2

L #P_TEMP1
L #P_TEMP2
+D
T #P_TEMP

L LW 0
T PQW [#P_TEMP]
NOP 0

The program is sending the command word to the VSD. the PZD address of the VSD is starting from 308 to 311 acodring to the hardware configuration. so the PZD_Q_P=308 , and it's multiplied by 8 which becomes 2464 and then it's converted to Double int.
Can some body tell me what exactly ( L P#Q 0.0 ) means?
what is being loaded to ACC1??
Also I don't understand what ( L LW 0 ) means?
what is LW?? and what is that 0?
also if somebody can tell me what is the address for sending control word to the VSD at the end? is the any manual that describes the VSD communication with S7 PLC via profibus?

Thanks alot
 
Also I don't understand what ( L LW 0 ) means

LW --is local data word. You can see it top of your editor.In/OUT,In-Out/temp..variables are Local variable.

possibly you suppose to supply command data to LW 0 , and this will move to VSD profibus memory. and
L #PZD_Q_P
L 8
*I
T #INT_TEMP
ITD
T #P_TEMP1


This is counting Bits- total no.of bits to point after Q0.0.
 
shahmirous said:
Hello everybody ,

I have a STL program which I am trying to analyse but there are afew things that I? don't understand and I couldn't find them anywhere.here is a part of the program :

L #PZD_Q_P
L 8
*I
T #INT_TEMP
ITD
T #P_TEMP1

L P#Q 0.0
T #P_TEMP2

L #P_TEMP1
L #P_TEMP2
+D
T #P_TEMP

L LW 0
T PQW [#P_TEMP]
NOP 0

The program is sending the command word to the VSD. the PZD address of the VSD is starting from 308 to 311 acodring to the hardware configuration. so the PZD_Q_P=308 , and it's multiplied by 8 which becomes 2464 and then it's converted to Double int.

This is to get the offset for address 308 into the form that the pointer needs

Can some body tell me what exactly ( L P#Q 0.0 ) means?

Loads a pointer to Q0.0

Which is then added to the offset created above.

And then transfered to the PQW by the T PQW [#P_TEMP] instruction.

The [....] mean that the address is contained in the variable i.e. a pointer

what is being loaded to ACC1??
Also I don't understand what ( L LW 0 ) means?
what is LW?? and what is that 0?
also if somebody can tell me what is the address for sending control word to the VSD at the end? is the any manual that describes the VSD communication with S7 PLC via profibus?

Thanks alot

mike
 
Hi Mike and thanks for your time ,
When you say load a pointer to Q0.0 is that mean that the memory address that Q0.0 is located will be loaded to ACC1?
Also what do you mean by offset for address 308?
is this possible for you to answer this with analysing an example.
My problem is I don't understand pointers!!!? and the reason we use them?

thanks to Apel I got the answer for that part of my question.

Thanks alot
 
Last edited:
Basically yes L P#Q0.0 loads the start address of the Q area.

You then load 308 and multiply by 8, this is because the first 3 bits of the pointer are the bit adresses, but we are not interested in them because we are accessing whole bytes. (You still use Q0.0 even when you are going to access complete bytes)

So having multiplied 308 * 8 and added it to P#Q0.0 using 32 bit integer arithmetic (because in S7 pointers are 32 bit) you have the address of 308 in #P_TEMP

The command T PQW[#P_TEMP] transfers the accu 1 value (i.e. LW0) to the address held in #P_TEMP, which in this case is 308.

Rather than multiplying by 8 many programmers use the SLD 3 command (Shift left 3 bits) as this is quicker, the result is the same.

Pointers are used where you dont want to explicitly define the address, for example where a standard block is used in several different projects, and to increment address in loop of code, for example when copying a block of data from one place to another
 
(y)Mike,
Thanks alot I have all my answers now .Your answer is very clear.
🍻
Kind Regards
Shahmir
 
Last edited:
The loading of P#Q0.0 is erroneous and should be removed, the code should be corrected as below:

Code:
L #PZD_Q_P	 // if PZD_Q_P = 308 then....
sld 3
T #P_TEMP
L LW 0
T PQW [#P_TEMP]  ///this is the equivilant of  T PQW 308
 
Confused about Local Data

Thanks for your replys guys,
I couln't find LW area on the top of my editor like Apel mentioned??!!!
What is this local data?
Can you tell me again what L LW 0 means?
where is this LW or LW 0 located in memory ?
What is it's value?
I just realized we may have LW 2 , 3 or...

Regards
Shahmir
 
The 'L' area is an area of local memory made available to a block each time it is called.

Think of it as a scratchpad area where you store things for use further on in the block.

It is not persistant, i.e. if you place a value into the L area during the processing of the block it will not be there the next time you call the block. If you want persistant data then you need to use an instance data block with an FB but that is whole new subject.

S7 manages its memory and makes a chunck available everytime a block is called. Depending upon the CPU the max size of this chunck varies.

Normally when you declare the parameters for a block anything which is 'temp' will be allocated into the L area, if you are also accessing the L area directly you need to be carefull as its possible to get into a muddle. Best to to declare all your temporary variables in the block header and let S7 sort it out.
 
Hi Mike '
Can You please tell me in the sample program I gave ,where the LW is getting it's value from?? because it seems that the program is not changing LW in any line , but just at the end it is loading (L LW 0) it and transferring it to the PQW [#P_Temp].
So it seems it is transferring the LW 0 vaule to the PQW [#P_temp].

thanks
 
If what you mean by the header is the following picture I couldn't find it there! there is no temporary variable named LW in the header(in , out,in/out and...)
header.JPG


another queston is can you possibly tell me how a pointer value looks like? because you already said that the first 3 bits of the pointer are bit addresses , what are the rest of them? or you might be able to tell me where can I find these information.
what I understand from the program is we have the address 308 then we are doing some calculations and at the end we are loading the PQW[#P_temp] which is again equal to PQW[308]:rolleyes:why ?
sorry my friend the more I concentrate on these the more confused I become.
Thanks for you help
 
LW x

Can You please tell me in the sample program I gave ,where the LW is getting it's value from??

can you send me printscreen of your editor...just for example...detail Local variable --




bye
 
Last edited:
Thats the area I want to see, what IN OUT IN/OUT and TEMP parameters are there.

I do not have them in front of me but I know there is a description of pointer in the S7 manuals, I will look tonight when I get home I and post some places to look tomorrow (Its 7.30 am in the UK)

Basically the pointer contains the byte and bit number plus the memory area (I Q M etc) all wrapped up into one 32 bit INT
 
Mike and Apel,
As I said I looked at all of them (in,out,temp,return ...)but I didn't find any thing named LW or LW 0 , that's why I was thinking LW should be a general name.
The program is comissioned and working well in the facotry so I am sure there is nothing rung with it.Also as you see in the screen shot this a part of a FC so there is no instant DB defined for it.
That would be great if you can send me those information tomorrow.


editor.JPG
 

Similar Topics

Hi , has any one encoumtered the following problems when working with simovert masterdrive connected through profibus to compactlogix using...
Replies
3
Views
3,329
Hi to everyone, I am trying to control a Micromaster 440 by a S7-300 PLC. I read some documentation about the Micomasters and tried to setup my...
Replies
4
Views
3,655
Hi hoping someone can assist me with current issue I am experiencing with an ABB drive. Problem I’m experiencing is a ABB drive supply a large...
Replies
4
Views
194
We have an existing VSD where a three phase circuit breaker feeds the drive, and two phases also tee off to a contactor, which is energised to...
Replies
12
Views
1,478
Hi all, We have an fr a740 inverter that is displaying a warning on the fr pu04 operator panel. Everything seem to be fine with the inverter but...
Replies
5
Views
1,406
Back
Top Bottom