Instructions: To play a sound file in WinCC flexible you need an external program that is started from WinCC flexible.
Often an acoustic signal is to be sounded in addition to a visual display on the operator panel when certain error messages are triggered. This permits operators who are otherwise occupied to clear the fault or faults so that the automatic process can continue.
Requirements:
- WinCC flexible PC Runtime
- Windows 2000 or Windows XP
- Microsoft Media Player (mplay32.exe)
The "mplay32.exe" program is already included in both operating systems Windows 2000 and Windows XP. This program is located in the Window installation path in the folder "System32". Use the Search function of the operating system to find the program.
| No. |
Procedure |
| 1 |
Create a new project
- Create a new project and select the WinCC flexible PC Runtime.
  Fig. 01
|
| 2 |
Create a script
- Create a new script.
- Use the source code that is in Fig. 02 and add it to the script.
- If necessary, change the path of the sound file and the executable file "mplay32.exe" on your system.
  Fig. 02
|
| 3 |
Create a variable
- Insert the tag "Tag_1" of the "INT" type as the internal tag.
- Link the script created to the "Change value" event of the "Tag_1" tag.
Note:
If you want to have an acoustic signal sounded only for specific alarms, then you can also link the script to the "Activate" event of each of the messages.
  Fig. 03
|
| 4 |
Configure bit messages
- Create at least one discrete alarm.
- Link the bit message or bit messages to the "Tag_1" tag.
  Fig. 04
|
| 5 |
Add objects
- Add a text field, an IO field and an Alarm View.
- Change the name of the text field to "malfunction message 1-8", for example.
- Link the IO field to the "Tag_1" tag and set the format type to "Binary".
- If necessary, extend the format pattern to "11111111".
- In the settings of the message class you mark the "Alarm events" selection field.
- In addition you also activate the two message classes "Error" and "System".
Note:
It is recommended to add a button with which you can test the sound file. You can also call the external program without script, because all you need is the system function "Start Program".
  Fig. 05
|
| 6 |
Start runtime
- Start the WinCC flexible Runtime.
- In order to simulate the error message you enter the number "00000001", for example, in the IO field and press the Enter button.
Note:
If no sound is emitted, check the volume and if necessary check the sound card settings. Also check the path and file names in the script.
- Terminate the WinCC flexible Runtime.
  Fig. 06
|
Download: The download Attachment 1 contains the sample project described above without the executable file "mplay32.exe".
Attachment 1: WinCC_flexible_Sound_via_Script.zip ( 1661 KB )
Runnability and test environment: The following table lists the components that have been used to create this entry and verify the functions described.
| Components |
Product and version designation |
| PC operating system |
Microsoft Windows XP SP2 |
Microsoft Windows XP SP2 |
Microsoft Windows XP SP3 |
| Standard tools |
- |
|
|
| Engineering tool |
- |
|
|
| HMI software |
WinCC flexible 2005 SP1 HF7 |
WinCC flexible 2007 HF4 |
WinCC flexible 2008 SP1 |
| HMI system |
WinCC flexible PC Runtime |
WinCC flexible PC Runtime |
WinCC flexible PC Runtime |
Keywords:
WAVE file, WAV, MIDI file, MID, Signal, Acoustic, Sound
|