Sie sind auf Seite 1von 3

Siemens S7-1200 Analog IO

Page 1 of 3

About Us

Services

Case Studies

Blog

Knowledge

Employment

About You

Contact

Home > Blog

Categories:
Front Page (137) General Topics (185) Software (71) ..LabVIEW (66) ..MS Visual Studio/.NET (40) ..Embedded Design (20) ..Dot Net Nuke (5) ...NET Micro Framework (8) ..Java (3) ..ASP.NET (8) ..HTML and CSS (5) ..SharePoint (39) Hardware (23) ..DAQ Hardware (31) ..PLC Hardware (35) ..Robotics (11) ..GHI Embedded Master and EMX (7) ..Vision Inspection (15) ..PC (8) Special Events (49) Announcements (42) Just Plain Fun (96) Customer Service (31) Geek Challenge (17) DMC Consulting (58)

Current Blogs | Archives

Archives:
December 2011 (6) November 2011 (7) October 2011 (9) September 2011 (6)

Siemens S7-1200 Analog IO


Nick Shea posted on June 16, 2011 15:18

If you find yourself working with Analog IO on the Siemens S7-1200 for the first time, you may wonder how and where to start. Here are some basic tips for working with Analog IO on this PLC platform. For the purposes of this blog, I will focus on implementing 420mA inputs and outputs, but the concepts should apply to other signal types as well. Configuring Analog Input/Output Models: Open the Device Configuration for the PLC. Add your module, then configure each channel's properties. Not that for current-based signals, the only range available is 0-20mA. If your signal is 4-20mA, still configure it as 0-20mA and scale the input value as demonstrated below.

August 2011 (15) July 2011 (8) June 2011 (12) May 2011 (9) April 2011 (8) March 2011 (11) February 2011 (7) January 2011 (9) December 2010 (8) November 2010 (6) October 2010 (9) September 2010 (10) August 2010 (7) July 2010 (9) June 2010 (8) May 2010 (5) April 2010 (16) March 2010 (20) February 2010 (8) January 2010 (9) December 2009 (12) November 2009 (5) October 2009 (14) September 2009 (15) August 2009 (11) July 2009 (23) June 2009 (15) May 2009 (13) April 2009 (3) February 2009 (1) January 2009 (1)

Reading an Analog Input Value: Since DMC engineers are biased toward modular, flexible code, I wrote my own function block to process a 4-20mA analog input that I can re-use within the project and for future projects.

I pass in all the unique values for that sensor that are required for scaling, and pass out my scaled, engineering value along with an error indicator. Inside my function block, I first test to make sure that the raw input value from the analog input channel is within the normal operating range and set the error output if it is not. The raw input value ranges are listed in section A.6 of the S7-1200 Easy Book located on the Siemens website. For the sake of convenience, here are the value ranges: Overflow = 32512 to 32767 Undershoot = 0 to -4864 Underflow = -4865 to -32768

http://www.dmcinfo.com/Blog/articleType/ArticleView/articleId/328/Siemens-S7-1200-An...

1/6/2012

Siemens S7-1200 Analog IO

Page 2 of 3

Decimal Range: 0.0 - 27648.0 Wire break limits: 4mA = 5529.6 3mA = 4147.2 2mA = 2764.8 1mA = 1382.4 After the input validity test, it's time to convert the raw input to a meaningful engineering value. For 4-20mA input signals, Siemens supplies a library function to convert the 0-20mA to a 4-20mA range. The library functions are available on the Siemens website with instructions here: Using the Siemens 0-20mA / 420mA conversion blocks. Note: I highly recommend modifying the standard library function "Scale_current_input" as shown below to handle a negative input value before the value is converted to a real number.

Once you have an accurate 4-20mA raw value range, perform the linear scaling math to generate your meaningful engineering value. For example: Output = Input((Max-Min) / Range) + Min Writing an Analog Output Value: Writing an analog output is a bit simpler than reading the analog input. Simply convert your analog output value to a percentage (0-100) and input that percentage into the "Scale_analog_output" library function provided by Siemens (see link above). The resulting word value can be sent directly to the analog output address.

In Summary: With a little help from the Siemens library blocks for converting 0-20mA signals to 4-20mA signals, analog IO on an S7-1200 controller is mostly straightforward. Ive tried to cover all the main points, but if there are any additional details that youd like covered, feel free to leave me a comment. Posted in: PLC Hardware, General Topics Actions: E-mail | Permalink | Comments (1) | Kick it! | DZone it! | del.icio.us

Comments
--> # Meuris Tom Saturday, November 12, 2011 4:49 AM dear Nick, Can you mail me the FB that you made? I use the scale current input block now As im new withe programming i have no idee what to do to scale the AI to eg 0200 Please help me

Post Comment
Name (required) Email (required) Website

http://www.dmcinfo.com/Blog/articleType/ArticleView/articleId/328/Siemens-S7-1200-An...

1/6/2012

Siemens S7-1200 Analog IO

Page 3 of 3

Enter the code shown above in the box below

Add Comment
Notify me of followup comments via e-mail

About Us | Services | Case Studies | Blog | Knowledge | Employment | About You | Contact Copyright 2011 by DMC, Inc. Terms Of Use | Privacy Statement

http://www.dmcinfo.com/Blog/articleType/ArticleView/articleId/328/Siemens-S7-1200-An...

1/6/2012

Das könnte Ihnen auch gefallen