S7-315 2DP Siemens PLC

Manoj M

Member
Join Date
Feb 2014
Location
London
Posts
59
Hello Experts
I have a little problem in dealing with addresses. I am using a profibus absolute encoder Hengstler make. This encoder is spec2:64 bit. When I had added this encoder in HW config it took address(by default) 384....391 for Input and 384....391 for output. I can read the encoder value without any problem, but there is another feature in Encoder which is called Preset and by activating this function you can define/force a value into encoder. As I said it is 64 bit encoder so its 32 bits are for input and 32 bits are for output. Now If I have to force my own preset value into encoder, I have to give rising edge at 31st bit, which activates the preset function and need to define a value in 0-31 bits. I have made a DB in software and defined the preset function in DB5.DBD4. So now I am forcing 31st bit which is DB5.dbx4.7 (MSB). My question is where should I define my preset value. Should it be at DB5.dbd7 or PQW391, but this is not a peripheral I/O so I dont think PQW is the right way of doing it. Could somebody please help me in that.

Many Thanks
Manoj
 
You shoud be using SFC14/15 to read and write data with the encoder. My advice is to make a UDT to match the send data and another UDT to match the read data. Put both of these UDTs in a DB and use SFC 14/15 to communicate with the encoder.

Good luck,

Nick
 
Thanks Nick for replying. I am already using SFC14/15 for read/write data. Like I said I dont have any problem with communication with the encoder, it is just the preset function which is driving me nuts. When I am forcing the MSB which is DB5.DBX4.7 high, the value which I have defined at 0-30 bits should get transferred to actual position of encoder but it is not. I am reading encoder value at DB5.DBD0. Below is the copy of program which I have it for Encoder reading and writing data.

CALL DPRD_DAT
LADDR :=w#16#180
RET_VAL :=MW200
RECORD :=P#DB5.DBX0.0 BYTE 4


CALL DPWR_DAT
LADDR :=w#16#180
RECORD :=P#DB5.DBX4.0 BYTE 4
RET_VAL :=MW220


Many Thanks
Manoj
 
Something is wrong here. SFC14 and SFC15 are only needed if the amount of data cannot be fitted in 1, 2 or 4 bytes. As far as I understand SFC14 and SFC15 shouldnt even work if you try with 1, 2 or 4 bytes. You should check the RET_VAL values.

If you need to pass just 4 bytes, then simply load and transfer with doubleword sized elements.
For example

L PID20
T DB5.DBD0

L DB5.DBD4
T PQD20
 
Its 64 bits input and 64 bits output
and not 32 bit for input and 32 for output
look at you config:
384....391 for Input and 384....391 for output

384-391 = 8 bytes = 64bits
 
How about posting some details of the encoder and a link to the manual for the encoder? This may help us identify where things are going wrong.

Nick
 
To eliminate all communication error sources, I would have tried to change the IO addresses to the process image area, f.x. IB/QB 120-127. If you now can read the counter value from the ID 12x, it should work if you manipulate with the preset value and the preset command bit directly in the Q-area.

When you get the wanted responses, you can alter back to the original IO area and the copying to/from the DB.

Kalle
 
Thanks to all who responded. Please find below the text from encoder manual explaining preset function. Like I said I have defined preset function in the DB5.DBD4. My concern is if I make DB5.DBX4.7 high as per preset function then how should I define my preset value in 0-30 bits (for example If I have to transfer 50000 units/counts then should I force the required bits high or is it there any easy function) so that it can be transferred to actual position without any trouble.
Thanks




7.2 Preset function
The preset function supports the adaptation of the encoder zero point to the mechanical zero point of the system. The preset function sets the current position value of the
encoder to the preset value. In the Data_Exchange function, the preset value will be
stored as default value. The preset function is used after the scaling, i. e. the preset
value is indicated in programmed measuring steps.
The MSB of the preset value controls the preset function in the following way:
Normal operating status: MSB= 0 (bit 31, optionally bit 15 or bit 63 respectively)
Preset value will not be taken on.
Preset-Mode: MSB= 1 /bit 31 (optionally bit 15 or bit 63, respectively)
With MSB=1 the encoder takes on the transferred value
(bit 0 - 30) as preset value in the binary code.
The encoder reads the current position value and calculates an offset value from the
preset value and the read in position value. The position value is replaced by the
preset value. If the default value and the preset value are identical, the preset value
may be terminated and the MSB can be reset to zero by the master. By means of the
diagnostic function, the offset value can be read. The value will be reloaded after a
mains failure and each restart.
The data exchange is configured by means of the DDLM_Chk_Cfg routine
(see Chapter 5 Configuration of the System and Device Types).
The preset function may only be used if the encoder is at standstill.
The scaling parameters have to be transferred beforehand (only if the scaling is to
be set).
 
Thanks to all who responded. Please find below the text from encoder manual explaining preset function. Like I said I have defined preset function in the DB5.DBD4. My concern is if I make DB5.DBX4.7 high as per preset function then how should I define my preset value in 0-30 bits (for example If I have to transfer 50000 units/counts then should I force the required bits high or is it there any easy function) so that it can be transferred to actual position without any trouble.
Thanks

Not sure if i understood you correctly, but just write value needed into DB5.DBD4
Code:
L 50000  //your value
T DB5.DBD4

SET
= DB5.DBX4.7 //set MSB to 1
 
Thanks to all, the program is working. I did what Marcius said and it all worked fine.
Grateful to the person who made this website. It is encyclopedia of all PLC geniuses.
Once again thanks to all of you...
 

Similar Topics

I'll preface this by saying this is the first time I've worked on a Siemens system and I'm fairly unfamiliar with them. I might mess up some of...
Replies
29
Views
735
Hi We were having a few power cuts and the CPU would not work. I had to reset the memory and he CPU would read from the memory card and start...
Replies
13
Views
3,153
Dear Sirs, I had a problem with CP 343-1 with CPU315-2DP.I had newly add the CP343-1 Ethernet module to the hardware to allow me to access this...
Replies
5
Views
2,628
Hi All, One of our clients wants to replace some obsolete VFD's on their plant. There are two S7-315-2DP plc's and drives are connected via...
Replies
2
Views
3,432
Hello everybody!! One of our machines have a Siemens 315 2DP and a Micromaster 430 drive. While powering up the drive (400V, 3 phase) the...
Replies
3
Views
3,163
Back
Top Bottom