Special Hardware Requirements:
This program example shows how you can check an EM 231 Thermocouple module for errors and then read four analog values from an error-free module into your program.
The EM 231 Thermocouple module provides a convenient, isolated interface for the S7-200 family to seven thermocouple types: J, K, E, N, S, T, and R. It allows the S7-200 to connect to low level analog signals, 80-mV range. The module is designed to work with the S7-200 CPU 222, CPU 224, CPU 226, and CPU 226XM.
You must use DIP switches to select the thermocouple type, open wire check, temperature scale, cold junction compensation, and burnout direction. Cold junction compensation must be enabled when you are using thermocouples. For the DIP switch settings to take effect, you need to power cycle the programmable logic controller and/or the user 24-V power supply.
You must connect user power to pins 1 and 2 of the power connector. You must connect pin 3 of the power connector to a nearby chassis ground.
All thermocouples attached to the module must be of the same type.
The open wire current source may interfere with signals from some low-level sources such as thermocouple simulators.
Input voltages exceeding approximately 200 mV will trigger open wire detection even when the open wire current source is disabled.
Module error may exceed specifications while the ambient temperature is changing. Exceeding the module ambient temperature range specification may cause the module cold junction to be in error.
If a thermocouple input channel is not used, you should short the unused channel inputs or connect them in parallel to another channel.
The channel data format is twos complement, 16-bit words. Temperature is presented units of 0.1 °.
(For example, if the measured temperature is 100.2 °, the reported data is 1002.) Voltage data are scaled to 27648. For example, -60.0 mV is reported as -20736 (=-60 mV/80 mV * 27648).
When you are using the thermocouple module, be sure to disable analog filtering in the controller. Analog filtering can prevent error conditions from being detected in a timely manner. Disable the analog input filtering by selecting the following commands in STEP 7-Micro/WIN:
From the View menu, choose System Block. In the System Block dialog box, select the Analog Input Filters tab. Clear the check boxes for the appropriate input points. Any changes made to the System Block will not be seen by the controller until the block is downloaded to the controller.
Program Description
Initialization
In the first program scan cycle, the program clears the variable memory area from variable memory word VW0 through variable memory word VW10. VW0 through VW6 are used for the images of the analog input values from the four input channels (TC0 through TC3) of a thermocouple module. VW10 is used to store any error information from a thermocouple module.
Check Thermocouple Module 0 for Errors
When the input for this subroutine is 0, the subroutine copies the values from the ID register and error register of the module in slot 0 into local memory word LW2. It then checks the signal state of the bits for the following types of errors: No User Power/Module, Out of Range, ID, and Configuration. After the subroutine checks for errors, it returns control to the main program.
To check an additional thermocouple module for errors, copy the instructions from Network 9 and place them in another network, such as Network 12. In the new network, change the input to the Call instruction from 0 to the number of the slot that contains the thermocouple module which you want to check, such as 3. There are seven slots available for expansion modules (slots 0 through 6). The subroutine in this program provides a network to check a module in each of the seven slots.
If There Are No Errors, Store the Analog Values
If there are no errors, the program copies the analog values from the four input channels of the thermocouple module into variable memory words VW0 through VW6.
If There Is an Error, Store the Error Information and Clear TC2 and TC3
If any of the error bits is set, the program copies the contents of memory byte MB0 and stores it in variable memory byte VB10. MB0 is the area of memory that contains the record of any errors found in the module. The program also clears the image of the inputs from thermocouple channels TC2 and TC3.
The S7-200 Programmable Controller System Manual provides additional information about the EM 231 Thermocouple module and the special memory bytes for the ID and error registers of I/O modules.
Download Program Example


















