Sign in to follow this  
Followers 0
waynes

Siemens CP343-1 to Mettler Toldeo Scale via Ethernet

11 posts in this topic

Hi Guys/ Gals, I want to communicate to a Mettler Toledo scale via ethernet from a Siemens CP343-1 card. Is this possible? I am sure it would be but which functions do I use? Any help is really appreciated.

Share this post


Link to post
Share on other sites
Hi guys/ gals, I have got the PLC and scale talking. I currently send it 3 bytes and get a 19 byte response. The problem is that the scale replies with 5 bytes when I am sending it a tare command. The AG_RECV block does not allow changing the receive length. Has anyone done this or is there a workaround for this issue? Any help will be appreciated!!!

Share this post


Link to post
Share on other sites
Hi waynes. A good question indeed. I dont have experience with it, so I just throw in that maybe you just configure the a RECV buffer of 19 bytes, and ignore the rest when you have 5 bytes of data. If that is not possible, thene there is a FAQ on how to receive variable data lengths with AG_RECV. (the sample project has to be paid for, but it is probably worth it) http://support.automation.siemens.com/WW/view/en/8707570

Share this post


Link to post
Share on other sites
Problem with AG Recv is that if you set the Byte length , then the buffer needs to fill up until that amount is received then the NDR bit is true. But if you just set your length to one byte than loop through the code 5 times then you can receive the scale data. sum it up 1 recieve one byte at a time 2 process the byte by putting in a scale receive buffer, increment a pointer for the receive buffer, etc for processing 2a do you need to look for framing? example: STX<scale data>ETX might be useful in processing the data 3 make a loop around these above commands to receive the whole scale data. 4 if you have variable length data come back then put a loop around the above for the longest data received. I have used AB ethernet stuff and siemens makes it very difficult. Not sure why they do it this way.

Share this post


Link to post
Share on other sites
AAARRRGGGHH! SIEMENS! 50 credits it costs you for the example! But, you first have to buy a 175 euro VAC card! I have used Mits, AB, Koyo, etc. and not one of them is this difficult! controlsdude & JesperMP: thanks for your input. You are right in saying that an example of the RECV parameter is: P#DB800.DBX1506.0 BYTE 54 Pointer to DB with starting bit and then the length of the receive data. However, if I use this the data shifts around in the DB. I understand your idea and its great but why should you even have to do this. A nice way from Siemens would have been to receive the data in a DB and give ME the data length. Now that makes sense. What we (me and another programmer) have done is come up with an ingenious idea! (Although it sucks) 1. 3 of the command always return 19 bytes (perfect) 2. 1 command returns 5 bytes - now when we send this command to the scale, we reset the buffer after about 2 seconds or so and ignore the new input from the scale until such time it is sent a new stable wight request. This is NOT the best way to do it. I hate it but it will have to work until I have developed my super powers in Siemens AG_RECV commands. Anyway, thanks to all!

Share this post


Link to post
Share on other sites
Hi again. Your last post seems to indicate that you can control how the scale sends the data. An idea: Can you setup 2 connections, one for the 19 byte data, and the other for the 5 byte data ? Then you can program two sets of AG_SEND/AG_RECV. One set is setup for 19 bytes, and the other set to 5 bytes.

Share this post


Link to post
Share on other sites
Hi JesperMP, We seem to be on a similar wavelength. I tried that but the scale only allows 1 connection.... Darn

Share this post


Link to post
Share on other sites
That is pathetic that the enet interface on the scale only lets you open one port. Maybe you can beat on Mettler instead of Siemens to make them give you more than one port. I do not think you can get siemens to change. Thats like getting a German to say he is a bad engineer. I went through this pain so there is a lot of engineer hours in reading the port that way and it will only work that way, believe me. The reason I say that is that the German's only have one way to do it and if they think outside that box, it won't work.

Share this post


Link to post
Share on other sites
The use of send-recieve means that the scale is intended to be used with Siemens way of doing ethernet. So Mettler-Toledo must already know everything necessary to make it work. Ask them for a sample project.

Share this post


Link to post
Share on other sites
JesperMP, Asking Mettler (local) for an example is like asking a nun for a f...... Do you understand? There is just no way! Anyway, will try new avenues as we go along.... Thanks for every1's help!

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