Sign in to follow this  
Followers 0
chonghyen

Communication between Mettler Toledo ID7sx and CP341

4 posts in this topic

Hi Ladies and Gentlements, I use 315-1 CPU with CP341 to communicate with Mettler Toledo ID7sx Base via RS232. Unfortunately I cant find and useful tips in Mettler Toledo website neither User manual on how to comunicate with CP341. I would like to seek your professionality on this. I have done everything I could on Step 7 on CP341. The sending and recieving counters are running and I really have no idea on how to read and write data from the scale. If anyone of you have done this kinda communication, please email me program example and guiden. Your help will be highly appreciated. Thank you very much and have a nice day!!! chonghyen@yahoo.co.uk chonghyen

Share this post


Link to post
Share on other sites
I wrote an interface to this scale using an Allen Bradley SLC processor. I used a device net RS-232 ASC module to do the communication, so some of this ladder logic will mean nothing to you. However here are the highlights that pertain to the scale only. To query the scale, you need to send an ASCII S<CR><LF> This is the capital "S", a carriage return, then a line feed. Once the scale receives this command, it will send you the weight in string format back to you. You'll need to parse this string in your PLC I assume. In the Allen Bradley SLC PLC, I have to send a ASCII command ST18:10 (see PDF file data_file.pdf, page 25) string value to printer from PLC S^M^J ^M in Allen Bradley means = carriages return ^J in Allen Bradley means = line feed I don't know what you have to do in a Siemens PLC to make those ASCII characters. That's all you have to do to ask the scale what the weight is. I do this every 1/2 seconds in my program, because my machine cycle is every 20 seconds. Next you have to parse the data the scale just sent you. Starting at Rung 5 of my PDF I read the string from the scale (through devicenet) and begin to parse out the "data". The scale sends the PLC a string like this: ^S^JS S 0.000 lb See ST18:0 in the data_file.pdf. I begin to count characters, 20 characters I think. Then I "extract" the portion of the string I want into another ST18:1 register. You'll notice that I have a decimal point in my string. Allen Bradley doesn't support "string to real" function, so I need to extract the whole number, then extract the decimal point value into two separate strings. Once I do that, I can do a string to integer conversion. Once it's an integer format both the whole number and decimal place, I can add the two values back together like it was before as a real type format, or floating point using ladder logic to do the math. Sounds like a complicated process, but this is how ASCII is on a daily bases...I hope it helps. - scale.pdf data_files.pdf

Share this post


Link to post
Share on other sites
Hi Chakorules, Thanks for your information. I really appreciate it. I did got the communication between PLC and ID7 couples of day ago. Its a little bit different than what you have described. Here is what I do for siemens step7: Configure CP341 in hardware configuration. Set all relevant parameters. Copy all siemens CP341 standard funtion block. Change adderess of LADDR entries to 256 (based on adderess for CP341 in hardware configuration). Do not load 114 (INT) to _LEN parameter in SEND RS FC(this is the command in ASCII I will ask the scale what to do. Try to load 0 (INT) to it at initial. Set the scale to " Toledo Continueos" with CHECK SUM on. Now I am able to read the scale values continueously. This can be indicated by the RECV light on CP341 flashes contineously. I read the ASCII code in adderess of _DBB and _LEN paratemeter in "RECV RS" FC which I set earlier. Read _DBB and _LEN as CHARACTER so that I can straight away read as ASCII string. Lets say in _DBB I got read "OP" and _LED I got read "QR", the correct reading will be OP.QR kg. The unit will follow the same as it set in the ID7. Now here is the tough part. Siemens Step 7 do not have standard FB to convert ASCII to real or integer. But it do have ASCII to HEX. I converted it to a WORD which will give you reading of W#16#OPQR. Based on this reading, I can now use comparator to compare setpoint based on my process logic. As for tare the reading, I really have no idea on how to tare it. I tried to send ASCII command as per manual, it still doesnt respond. I use try and error method and get it done (But I do not know why and how it works). Load a value of 4 (INT) to _LEN parameter in SEND RS FC for couples of second and then set it back to 0. This will tare the reading in the indicator to 0.0 and will also read a value of 0 in the PLC after it. So this is all I needed so get the job done. As for others sophisticated command, I just forget it and touch nothing bout them. If anyone are interested in detail how I get this done, send me an email to get the sample program. Thanks and Cheers chonghyen@yahoo.co.uk chonghyen

Share this post


Link to post
Share on other sites
These are all the commands I know: (Commands are sent as a single uppercase character, T for Tare, followed by the ascii Characters for carriage return and linefeed) Cmd Func Description C Clear Clear target or tare value T Tare Take a pushbutton tare (always active) P Print Transmit data Z Zero Zero the scale (if within range and no-motion) S Send Transmit data U Select Switch units (if enabled in setup) X Target Take a pushbutton target (over/under mode only) FORMAT of data output in continuos mode: Char Function 1 STX (Start of text - Optional) 2 Status Word A 3 Status Word B 4 Status Word C 5 Weight MSD 6 Weight 7 Weight 8 Weight 9 Weight 10 Weight LSD 11 Tare Weight MSD 12 Tare Weight 13 Tare Weight 14 Tare Weight 15 Tare Weight 16 Tare Weight LSD 17 CR (carriage return) 18 CKSM (Checksum - Optional

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