Somachine V3.0: M238 PLC Diagnostic PLC - Diagnoctic - Project Example Guide
Somachine V3.0: M238 PLC Diagnostic PLC - Diagnoctic - Project Example Guide
0
M238 PLC Diagnostic
PLC_Diagnoctic.project
Example Guide
04/2011 Basic
Intermediate
Expert
EIO0000000901.00
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or
technical characteristics of the performance of the products contained herein. This
documentation is not intended as a substitute for and is not to be used for
determining suitability or reliability of these products for specific user applications. It
is the duty of any such user or integrator to perform the appropriate and complete
risk analysis, evaluation and testing of the products with respect to the relevant
specific application or use thereof. Neither Schneider Electric nor any of its affiliates
or subsidiaries shall be responsible or liable for misuse of the information contained
herein. If you have any suggestions for improvements or amendments or have
found errors in this publication, please notify us.
All pertinent state, regional, and local safety regulations must be observed when
installing and using this product. For reasons of safety and to help ensure
compliance with documented system data, only the manufacturer should perform
repairs to components.
When devices are used for applications with technical safety requirements, the
relevant instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware
products may result in injury, harm, or improper operating results.
2 EIO0000000901.00 04/2011
Table of Contents
1. DESCRIPTION·············································································································13
1.1. Presentation ······························································································································· 13
EIO0000000901.00 04/2011 3
4 EIO0000000901.00 04/2011
Safety Information
Safety Information
Important Information
NOTICE
Read these instructions carefully, and look at the equipment to become familiar with the
device before trying to install, operate, or maintain it. The following special messages
may appear throughout this documentation or on the equipment to warn of potential
hazards or to call attention to information that clarifies or simplifies a procedure.
The addition of this symbol to a Danger or Warning safety label
indicates that an electrical hazard exists, which will result in personal
injury if the instructions are not followed.
DANGER
DANGER indicates an imminently hazardous situation which, if not avoided,
will result in death or serious injury.
WARNING
WARNING indicates a potentially hazardous situation which, if not avoided, can
result in death or serious injury.
CAUTION
CAUTION indicates a potentially hazardous situation which, if not avoided, can
result in minor or moderate injury.
CAUTION
CAUTION, used without the safety alert symbol, indicates a potentially
hazardous situation which, if not avoided, can result in equipment damage.
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by
qualified personnel. No responsibility is assumed by Schneider Electric for any
consequences arising out of the use of this material.
A qualified person is one who has skills and knowledge related to the construction
and operation of electrical equipment and the installation, and has received safety
training to recognize and avoid the hazards involved.
EIO0000000901.00 04/2011 5
Safety Information
6 EIO0000000901.00 04/2011
About the Book
At a Glance
Document Scope
This document describes one of the SoMachine examples.
Since the example described in this document is intended for learning purposes
only, it must not be run, nor tested, on products that are part of a machine or
process.
Validity Note
This document has been updated with the release of SoMachine V3.0.
The technical characteristics of the device(s) described in this manual also appear
online. To access this information online:
Step Action
1 Go to www.schneider-electric.com
2 In the Search box on the home page, type a model number. Do not type any blank
spaces in the model number. To get information on a grouping of similar modules, you
can use the characters **; do not use dots or xx's.
3 Under All, click Products → Product Datasheets and select the model number that
interests you.
4 To save or print a data sheet as a .pdf file, click Export to PDF.
The characteristics presented in this manual should be the same as those that
appear online. In line with our policy of constant improvement we may revise
content over time to improve clarity and accuracy. In the event that you see a
difference between the manual and online information, use the online information as
your reference.
Related Documents
Title of Documentation Reference Number
Modicon M238 Logic Controller Hardware Guide EIO0000000016 (ENG);
EIO0000000017 (FRE);
EIO0000000018 (GER);
EIO0000000019 (SPA);
EIO0000000020 (ITA);
EIO0000000021 (CHS)
EIO0000000901.00 04/2011 7
About the Book
WARNING
UNINTENDED EQUIPMENT OPERATION
Only use software approved by Schneider Electric for use with this equipment.
Update your application program every time you change the physical hardware
configuration.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
8 EIO0000000901.00 04/2011
About the Book
WARNING
LOSS OF CONTROL
The designer of any control scheme must consider the potential failure modes
of control paths and, for certain critical control functions, provide a means to
achieve a safe state during and after a path failure. Examples of critical control
functions are emergency stop and overtravel stop, power outage and restart.
Separate or redundant control paths must be provided for critical control
functions.
System control paths may include communication links. Consideration must be
given to the implications of unanticipated transmission delays or failures of the
link.
Observe all accident prevention regulations and local safety guidelines.1
Each implementation of this equipment must be individually and thoroughly
tested for proper operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
1
For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety
Guidelines for the Application, Installation, and Maintenance of Solid State Control"
and to NEMA ICS 7.1 (latest edition), "Safety Standards for Construction and Guide
for Selection, Installation and Operation of Adjustable-Speed Drive Systems" or
their equivalent governing your particular location.
WARNING
REGULATORY INCOMPATIBILITY
Be sure that all equipment applied and systems designed comply with all
applicable local, regional and national regulations and standards.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.
The use and application of the information contained herein require expertise in the
design and programming of automated control systems. Only the user or integrator
can be aware of all the conditions and factors present during installation and setup,
operation, and maintenance of the machine or process, and can therefore
determine the automation and associated equipment and the related safeties and
interlocks which can be effectively and properly used. When selecting automation
EIO0000000901.00 04/2011 9
About the Book
and control equipment, and any other related equipment or software, for a particular
application, the user or integrator must also consider any applicable local, regional
or national standards and/or regulations.
Some of the major software functions and/or hardware components used in the
proposed architectures and examples described in this document cannot be
substituted without significantly compromising the performance of your application.
Further, any such substitutions or alterations may completely invalidate any
proposed architectures, descriptions, examples, instructions, wiring diagrams and/or
compatibilities between the various hardware components and software functions
specified herein and in related documentation. You must be aware of the
consequences of any modifications, additions or substitutions. A residual risk, as
defined by EN/ISO 12100-1, Article 5, will remain if:
it is necessary to modify the recommended logic and if the added or modified
components are not properly integrated in the control circuit.
you do not follow the required standards applicable to the operation of the
machine, or if the adjustments to and the maintenance of the machine are
not properly made (it is essential to strictly follow the prescribed machine
maintenance schedule).
the devices connected to any safety outputs do not have mechanically-linked
contacts.
CAUTION
EQUIPMENT INCOMPATIBILITY
Read and thoroughly understand all device and software documentation before
attempting any component substitutions or other changes related to the
application examples provided in this document.
Failure to follow these instructions can result in injury or equipment
damage.
10 EIO0000000901.00 04/2011
About the Book
CAUTION
EQUIPMENT OPERATION HAZARD
Verify that all installation and set up procedures have been completed.
Before operational tests are performed, remove all blocks or other temporary
holding means used for shipment from all component devices.
Remove tools, meters and debris from equipment.
Failure to follow these instructions can result in injury or equipment
damage.
Verify that the completed system, including the functional safety system, is free from
all short circuits and grounds, except those grounds installed according to local
regulations. If high-potential voltage testing is necessary, follow the
recommendations in equipment documentation to help prevent injury or equipment
damage.
WARNING
UNGUARDED MACHINERY CAN CAUSE SERIOUS INJURY
Do not use this software and related automation equipment on equipment
which does not have point-of-operation protection.
Do not reach into machinery during operation.
EIO0000000901.00 04/2011 11
About the Book
User Comments
We welcome your comments about this document. You can reach us by e-mail at
[email protected].
12 EIO0000000901.00 04/2011
1. Description
1. Description
1.1. Presentation
This example presents the system functions of the M238 logic controller. These
functions are located in the M238 PLCSystem library.
The controller’s program is created using SoMachine software.
In this example, these system functions are used to diagnose the status a M238
controller in normal operation mode.
Download
& Monitoring
Note: Because system functions of the controller are used in this example’s
program, do not run this example in SIMULATION mode.
EIO0000000901.00 04/2011 13
1. Description
Note: The other functions of the M238 PLCSystem library are used in the example
described in the SoMachine V3.0 PLC Time Example Guide.
14 EIO0000000901.00 04/2011
1. Description
To install these libraries in your own project, please refer to Library Manager (see
page 25).
EIO0000000901.00 04/2011 15
1. Description
1
USB 3
2a Controller
or Prg.
2b Port
Please refer to the Modicon M238 Logic Controller Hardware Guide for the
hardware setup of this device.
16 EIO0000000901.00 04/2011
2. Description of the Example’s Content
EIO0000000901.00 04/2011 17
3. Creation of the Project
Note: Details on the selected controller are displayed in the Information section of
SoMachine.
SoMachine controller version: Defines the version of the selected controller; it is
displayed in the Information section of SoMachine.
Target controller firmware version: Defines the firmware version of your controller. This
version is shown when you select your controller’s node, as shown in Downloading the
Example to the Controller (see page 51).
For compatibility purposes between a SoMachine controller version and a target
controller firmware version, only the first three numbers of a version must be identical. In
the preceding picture, the 2.0.30.13 SoMachine controller version is compatible with any
2.0.30.•• target controller firmware version.
For each controller model, SoMachine only presents the latest available version. If you
check the Display all versions (for expert only) option, SoMachine will list all
supported controller firmware versions. However, a good practice consists in using the
latest available version and updating the firmware of your controller, if required. Please
refer to the M238 ExecLoader User Guide.
18 EIO0000000901.00 04/2011
3. Creation of the Project
Step Action
3 Rename this controller to M238_Controller.
EIO0000000901.00 04/2011 19
4. Event Task Creation and Configuration
20 EIO0000000901.00 04/2011
4. Event Task Creation and Configuration
Step Action
4 Click on the IO Summarize… button located in the lower right corner of the central
panel.
The IO Summary window that appears shows that the I0 input of the controller has been
affected to an Event.
EIO0000000901.00 04/2011 21
4. Event Task Creation and Configuration
Step Action
8 Create a new task:
Expand the contents of the M238_Controller (TM238LFDC24DT) item.
Right-click on the Task Configuration item.
In the Add Object part of the contextual menu that appears, select the Task…
command.
In the Add Task window that appears, write the Name of this new task:
EVENT_TASK.
Click on OK to validate the creation of this new task.
22 EIO0000000901.00 04/2011
4. Event Task Creation and Configuration
Step Action
9 Double-click on the EVENT_TASK task and configure it as follows:
EIO0000000901.00 04/2011 23
5. Wiring the Controller’s I0 Fast Input
In this diagram, the push-button wired to the I0 fast input is used to generate pulses.
Each rising or falling edge of these pulses will be transformed into an I0 external
event.
24 EIO0000000901.00 04/2011
6. Library Manager
6. Library Manager
The steps listed in the following table describe how to add and/or check the list of
the libraries linked to this example.
Step Action
1 Select the Program tab.
In the Devices tree view, double-click on the Library Manager to open the list of the
libraries linked to the Application software of this example.
2 Check that the M238 PLCSystem library is already linked, as shown below:
Note: This library is grayed to inform that it has been automatically linked to the program
upon addition of the M238 Controller to the project and that it cannot be removed.
EIO0000000901.00 04/2011 25
7. CFC, LD, or ST Program
In addition, each of these three chapters begins with explanations on the difficulties
you may face, if any, in the form of optional steps.
26 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Note: If you want to remove these EN/ENO pins, select the EN/ENO command again.
EIO0000000901.00 04/2011 27
7. CFC, LD, or ST Program
Step Action
2 Optional step
How to use a Selector element to display structure components
In this example, the Selector element is used to access the three components of a
variable whose type is the FIRMWARE_VERSION structure: FwVersion, BootVersion,
and AsicVersion.
This optional step indicates how to use a Selector element. Its input is a variable whose
type must be a structure. The number of its outputs depends on the number of
components of this structure: the Selector element has one output per component of the
input structure. Please refer to the SoMachine online help: search for Selector.
In the following steps, a Selector element is used to access the various components of
the structured output of the GetFirmwareVersion Function (output type =
FIRMWARE_VERSION structure):
From the ToolBox panel, create a Selector element into the central worksheet.
Determine the name of the structure you want to use for this Selector element. In
the given example, this element will be used with the GetFirmwareVersion output
of the GetFirmwareVersion Function. The type of this output is a structure whose
name is FIRMWARE_VERSION.
28 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
In the Input Assistant, select the FIRMWARE_VERSION data type.
EIO0000000901.00 04/2011 29
7. CFC, LD, or ST Program
Step Action
3 Creation of the POU: Create a new POU in CFC language, called PLC_Diag_CFC.
30 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
4 CFC variables: In the upper part of the CFC editor, declare the following variables:
PROGRAM PLC_Diag_CFC
VAR
(*First Mast Cycle Functions*)
q_xIsFirstMastCycle : BOOL;
q_xIsFirstMastWarmCycle : BOOL;
q_xIsFirstMastColdCycle : BOOL;
(*Battery Functions*)
q_wBatteryLevel : WORD;
i_xInhibitBatLowLed : BOOL := FALSE;
q_wResultInhibitBattLed : WORD;
(*Event Functions*)
q_dwEventNumber : DWORD;
v_xResetEventsNumber : BOOL := FALSE;
q_xResetEventsNumber : BOOL;
EIO0000000901.00 04/2011 31
7. CFC, LD, or ST Program
Step Action
5 CFC program: In the lower part of the CFC editor, implement the following program:
32 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
EIO0000000901.00 04/2011 33
7. CFC, LD, or ST Program
7.2. LD Program
Before instructing you how to write down the LD program used in this example, the
following table presents optional steps that give you information on how to program
in LD language.
Step Action
1 Optional step
How to display titles and comments in LD language
Select the Options… command of the Tools menu.
Select, in the Options window, the FBD, LD and IL editor section.
If you wish to add a title and/or a comment for each LD network, check the
Show network title and/or the Show network comment options, as shown
below:
34 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
2 Optional step
How to add the EN/ENO pins on a Function Block
In this example, these pins are used on three functions: IsFirstMastWarmCycle,
IsFirstMastColdCycle, and ResetEventsNumber.
This optional step indicates how to append the additional Boolean enable input EN and
Boolean output ENO (Enable Out) to any Function or Function Block. These two pins are
used to enable (TRUE) or disable (FALSE) the execution of the Functions or Function
Blocks on which they are used. Please refer to the SoMachine online help: search for
additional Boolean ENO.
In the View part of the FBD/LD/IL menu, select the View as function block
diagram mode.
EIO0000000901.00 04/2011 35
7. CFC, LD, or ST Program
Step Action
Select, in your LD program, the LD network where you want to add a Function
Block (or a Function).
In the FBD/LD/IL menu, execute the Insert Box with EN/ENO command.
36 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
In the Input Assistant window that appears, select the Function blocks
category, if you wish to add a Function Block, or the Module Calls category, if
you wish to add a Function.
Select the Function Block (or the Function) you wish to add in your program.
In the following picture, the ResetEventsNumber Function of the
M238 PLCSystem library is selected. The location of this Function is given in
Functions Used in this Example (see page 14):
Click on OK.
This adds the selected Function Block (or Function) to your program, with the two
EN and ENO pins.
In the View part of the FBD/LD/IL menu, you can now select the View as ladder
logic mode to return to the default view mode.
EIO0000000901.00 04/2011 37
7. CFC, LD, or ST Program
Step Action
3 Optional step
How to use the Insert Empty Box Command
Sometimes, the Empty Box created by the Insert Empty Box command does not work
with a Function or Function Block.
In this example, the Empty Box is not compatible with the GetRightBusStatus and the
InhibitBatLowLed Functions.
In this case, you must use the Insert Box command, instead of the Insert Empty Box
command.
Select, in your LD program, the LD network where you want to add a Function
Block (or a Function).
In the FBD/LD/IL menu, execute the Insert Box command.
38 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
In the Input Assistant window that appears, select the Function blocks
category, if you wish to add a Function Block, or the Module Calls category, if
you wish to add a Function.
Select the Function Block (or the Function) you wish to add in your program.
In the following picture, the GetRightBusStatus Function of the
M238 PLCSystem library is selected:
Click on OK.
This adds the selected Function Block (or Function) to your program.
EIO0000000901.00 04/2011 39
7. CFC, LD, or ST Program
Step Action
4 Creation of the POU: Create a new POU in LD language, called PLC_Diag_LD.
40 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
5 LD variables: In the upper part of the LD editor, declare the following variables:
PROGRAM PLC_Diag_LD
VAR
(*First Mast Cycle Functions*)
q_xIsFirstMastCycle : BOOL;
q_xIsFirstMastWarmCycle : BOOL;
q_xIsFirstMastColdCycle : BOOL;
(*Battery Functions*)
q_wBatteryLevel : WORD;
i_xInhibitBatLowLed : BOOL := FALSE;
q_wResultInhibitBattLed : WORD;
(*Event Functions*)
q_dwEventNumber : DWORD;
v_xResetEventsNumber : BOOL := FALSE;
q_xResetEventsNumber : BOOL;
EIO0000000901.00 04/2011 41
7. CFC, LD, or ST Program
Step Action
6 LD program: In the lower part of the LD editor, implement the following program:
42 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
EIO0000000901.00 04/2011 43
7. CFC, LD, or ST Program
Step Action
44 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
7.3. ST Program
Step Action
1 Creation of the POU: Create a new POU in ST language, called PLC_Diag_ST.
EIO0000000901.00 04/2011 45
7. CFC, LD, or ST Program
Step Action
2 ST variables: In the upper part of the ST editor, declare the following variables:
PROGRAM PLC_Diag_ST
VAR
(*First Mast Cycle Functions*)
q_xIsFirstMastCycle : BOOL;
q_xIsFirstMastWarmCycle : BOOL;
q_xIsFirstMastColdCycle : BOOL;
(*Battery Functions*)
q_wBatteryLevel : WORD;
i_xInhibitBatLowLed : BOOL := FALSE;
q_wResultInhibitBattLed : WORD;
(*Event Functions*)
q_dwEventNumber : DWORD;
v_xResetEventsNumber : BOOL := FALSE;
q_xResetEventsNumber : BOOL;
46 EIO0000000901.00 04/2011
7. CFC, LD, or ST Program
Step Action
3 ST program: In the lower part of the ST editor, implement the following program:
(*First Mast Cycle Functions*)
q_xIsFirstMastCycle := IsFirstMastCycle();
IF q_xIsFirstMastCycle THEN
q_xIsFirstMastWarmCycle := IsFirstMastWarmCycle();
q_xIsFirstMastColdCycle := IsFirstMastColdCycle();
END_IF
(*Battery Functions*)
(*Battery Voltage Function*)
q_wBatteryLevel := GetBatteryLevel();
(*Disables or re-enables the display of the Low Battery LED indicator (Batt)*)
q_wResultInhibitBattLed := InhibitBatLowLed(Inhibit := i_xInhibitBatLowLed);
(*Event Functions*)
(*Get Events Number Function*)
q_dwEventNumber := GetEventsNumber();
(*Reset Events Number Function*)
IF v_xResetEventsNumber THEN
q_xResetEventsNumber := ResetEventsNumber();
v_xResetEventsNumber := FALSE;
END_IF
EIO0000000901.00 04/2011 47
8. Running the Example
Step Action
1 In the Devices tree view:
Expand the contents of the M238_Controller (TM238LFDC24DT) item.
Double-click on the MAST task of the Task Configuration item.
Click on the Add POU command.
48 EIO0000000901.00 04/2011
8. Running the Example
Step Action
2 In the Input Assistant window that appears:
Select your program.
In the following picture, the CFC program described in CFC Program (see page 27),
PLC_Diag_CFC, is selected:
3 Click on OK.
This adds the selected POU to the list of programs run by the MAST task of the
controller.
EIO0000000901.00 04/2011 49
8. Running the Example
50 EIO0000000901.00 04/2011
8. Running the Example
Step Action
4 Select this controller’s node and click on the Set active path button.
EIO0000000901.00 04/2011 51
8. Running the Example
Step Action
6 Click on the Login button of the toolbar to establish a connection from SoMachine to
the controller.
7a If you download the current project to the controller for the first time and if there is no
project on the controller, the following window appears:
52 EIO0000000901.00 04/2011
8. Running the Example
2 Detecting the first cycle of the MAST task using the IsFirstMastCycle ,
IsFirstMastWarmCycle and IsFirstMastColdCycle Functions:
In this example, these three Functions are used in the following manner:
The IsFirstMastCycle Function is continuously called to detect the first cycle of
the MAST task. This Function updates the q_xIsFirstMastCycle variable: it is
set to TRUE only during the first cycle of the MAST task, then it is reset to FALSE.
The IsFirstMastWarmCycle Function is only called during the first cycle of the
MAST task (the previous q_xIsFirstMastCycle variable is used to enable or
disable its call). This Function updates the q_xIsFirstMastWarmCycle
variable: it is set to TRUE if the controller started in warm start mode.
Likewise, the IsFirstMastColdCycle Function is only called during the first cycle
of the MAST task. This Function updates the q_xIsFirstMastColdCycle
variable: it is set to TRUE if the controller started in cold start mode.
EIO0000000901.00 04/2011 53
8. Running the Example
Step Action
To test these functions, proceed as follows:
Check that the value of q_xIsFirstMastWarmCycle is equal to FALSE.
Check that the value of q_xIsFirstMastColdCycle is equal to TRUE: the
controller started in cold start mode (normal behavior after a download operation).
Click on the Stop button of the toolbar to stop the Application software on the
controller.
In the Online menu, click on the Reset warm command to force a warm start of the
controller.
Click on the Start button of the toolbar to run the Application software on the
controller.
Check that the value of q_xIsFirstMastWarmCycle is equal to TRUE: the
controller started in warm start mode because of the Reset warm command.
Check that the value of q_xIsFirstMastColdCycle is equal to FALSE.
For a description of the cold start and warm start modes, please refer to the SoMachine
online help: search for Reset Warm, Reset Cold, or Commanding State Transitions.
54 EIO0000000901.00 04/2011
8. Running the Example
Step Action
3 Getting the controller’s firmware, boot, coprocessor, and hardware versions using
the GetFirmwareVersion and GetHardwareVersion Functions:
To test these functions, proceed as follows:
In the Debug/Watch menu, execute the Hexadecimal command to switch the
numeric display mode from Decimal to Hexadecimal.
Split the value of the v_dwFwVersion DWORD variable (32-bit) into four BYTE
data (4 × 8-bit).
Convert each of these bytes in Decimal to get the controller’s firmware version. An
example is given below:
v_dwFwVersion ...............16#02001E0D
4-byte data .........................16#02 / 16#00 / 16#1E / 16#0D
4-byte version.....................2 / 0 / 30 / 13
Firmware version................v2.0.30.13
Note: Compare this version with the firmware version displayed when you select
your controller’s node, as shown in Downloading the Example to the Controller (see
page 51). They are identical.
Split the value of the v_wBootVersion WORD variable (16-bit) into two BYTE data
(2 × 8-bit).
Convert each of these bytes in Decimal to get the controller’s boot version. An
example is given below:
v_wBootVersion .............16#0104
2-byte data .........................16#01 / 16#04
2-byte version.....................1 / 4
Boot version .......................v1.4
EIO0000000901.00 04/2011 55
8. Running the Example
Step Action
The value of v_wCoProcVersion indicates the controller’s coprocessor version.
Example: 16#0058.
The value of q_wHardwareVersion indicates the controller’s Hardware Version.
Example: 16#0200.
4 Getting the controller’s Serial Number using the GetSerialNumber Function:
To test this function, proceed as follows:
In the Debug/Watch menu, execute the Hexadecimal command to switch back the
numeric display mode from Hexadecimal to Decimal.
56 EIO0000000901.00 04/2011
8. Running the Example
Step Action
6 Disabling and re-enabling the Batt LED using the InhibitBatLowLed Function:
If an external backup battery is installed on your controller, remove it as instructed below:
Click on the Logout button of the toolbar to disconnect SoMachine from the
controller.
Power off the controller.
Read the hazard message given in the Installing and Replacing the External
backup battery section of the Modicon M238 Logic Controller Hardware Guide.
Remove the external backup battery as instructed in this very same section of the
Modicon M238 Logic Controller Hardware Guide.
Power on the controller.
Click on the Login button of the toolbar to establish a connection from
SoMachine to the controller.
To test this function, proceed as follows:
Check that the red Batt LED of the controller is ON.
Change the value of i_xInhibitBatLowLed from FALSE to TRUE.
Check that the red Batt LED of the controller is OFF.
Check that the value of q_wResultInhibitBattLed is equal to TRUE (operation
successful).
Change the value of i_xInhibitBatLowLed from TRUE to FALSE.
Check that the red Batt LED of the controller is ON.
Check that the value of q_wResultInhibitBattLed is equal to TRUE (operation
successful).
If you previously removed an external backup battery from your controller, install it as
instructed below:
Click on the Logout button.
Power off the controller.
Install the external backup battery as instructed in the Installing and Replacing the
External backup battery section of the Modicon M238 Logic Controller Hardware
Guide.
Power on the controller.
Click on the Login button.
EIO0000000901.00 04/2011 57
8. Running the Example
Step Action
7 Reading and resetting the number of events using the GetEventsNumber and
ResetEventsNumber Functions:
To test these functions, proceed as follows:
Using the push-button connected to the I0 fast input of the controller, generate a few
pulses on this input.
Note: This push-button is described in Wiring the Controller’s I0 Fast Input (see
page 24).
Observe the value of q_dwEventNumber: each pulse increased this value by two
(+1 for the rising edge of the pulse and +1 for its falling edge).
Set the v_xResetEventsNumber variable to TRUE.
Since this variable is connected to the EN (enable) pin of the ResetEventsNumber
Function, this Function is now called.
Then, this variable resets the v_xResetEventsNumber variable to FALSE.
Note: In the case of the CFC program described in CFC Program (see page 27), this
variable is transmitted through the ENO (enable output) pin before resetting
v_xResetEventsNumber. This is intended to obtain an execution order in which
the ResetEventsNumber Function is called before the reset of
v_xResetEventsNumber, provided that the Order By Data Flow command (see
page 33) has been performed.
Because v_xResetEventsNumber is reset, the ResetEventsNumber Function is
called during only one task cycle.
Check that the value of q_dwEventNumber is equal to 0.
8 Reading the cause of the last stop using the GetLastStopCause Function:
To test this function, proceed as follows:
Click on the Stop button of the toolbar.
58 EIO0000000901.00 04/2011
8. Running the Example
Step Action
9 Reading the status of the boot project using the GetBootProjectStatus Function:
To test this function, proceed as follows:
Check that the value of q_BootProjectStatus is equal to
VALID_BOOT_PROJECT.
10 Reading the short-circuit (or overload) diagnostic on the controller’s embedded
outputs using the GetShortCutStatus Function:
To test this function, proceed as follows:
Check that the value of q_wShortCutStatus is equal to 0: bits 0, 1, and 2 of this
WORD are equal to FALSE because there is no short-circuit on the controller’s
embedded outputs.
Note: Please refer to the Regular Output Wiring Diagram (or Transistor Output
Wiring Diagram) and Short-circuit or Over-current on Outputs sections of the
Modicon M238 Logic Controller Hardware Guide. These sections contain several hazard
messages and instructions that you must read concerning the M238 controller’s
protections against short-circuits and overloads.
11 Reading the status of the controller’s expansion bus using the
GetRightBusStatus Function:
To test this function for a configuration diagnostic of the expansion bus
(RIGHTBUS_GET_GEN_STATUS), proceed as follows:
Check the value of q_wRightBusStatusGen: it is equal to 0 (bits 1 to 7 are equal
to FALSE) because there is no expansion bus configuration mismatch.
Note: In the case of this example, no TM2 module has been configured in
SoMachine and no TM2 module has been physically installed on the controller.
To test this function for a diagnostic of the first (analog) expansion module
(RIGHTBUS_GET_STATUS1), proceed as follows:
Check the value of q_wRightBusStatus: it is equal to 0 because no diagnostic is
available for this analog expansion module.
Note: In the case of this example, no analog module has been physically installed
on the controller.
12 Detecting errors on the controller I/O using the GetPlcFault Function:
To test this function, proceed as follows:
Check the value of v_xErrorIOExpansionBus (bit 0 of q_wPlcFault): it is equal
to FALSE because the I/O expansion bus is healthy.
Check the value of v_xErrorEmbeddedIO (bit 1 of q_wPlcFault): it is equal to
FALSE because the embedded I/O of the controller are healthy.
Note: As pointed out in the SoMachine online help, these two data could be used as
conditions for calling the GetRightBusStatus and the GetLocalIOStatus Functions.
Please refer to the SoMachine online help: search for GetPlcFault.
13 Reading the status of the controller’s embedded I/O using the GetLocalIOStatus
Function:
To test this function, proceed as follows:
Check the value of q_IOStatus: it is equal to LOCAL_IO_OK because the inputs /
outputs of the controller are operational.
EIO0000000901.00 04/2011 59