Model Instruction of GC Controller

Current models of Samkoon GC Controller:

Model |  | I/O Type | IO Point | Analog | High-speed Output | High-speed Counting | Power | Steps of ladder diagram
GC-043 | GC-043-16R | Relay | 16 | N/A | N/A | 2 Channels/80K | DC24V | 8K
 | GC-043-16T | Transistor | 16 | N/A | 2 Channels/150K | 2 Channels/80K | DC24V | 8K
 | GC-043-16M | Relay + Transistor | 16 | N/A | 2 Channels/150K | 2 Channels/80K | DC24V | 8K
 | GC-043-16RA | Relay + Analog | 16 | 2 channels/16 Bit/Precision 0.1% | N/A | 2 Channels/80K | DC24V | 8K
 | GC-043-16TA | Transistor + Analog | 16 | 2 channels/16 Bit/Precision 0.1% | 2 Channels/150K | 2 Channels/80K | DC24V | 8K
 | GC-043-16MA | Relay + Transistor + Analog | 16 | 2 channels/16 Bit/Precision 0.1% | 2 Channels/150K | 2 Channels/80K | DC24V | 8K
GC-070 | GC-070-24MAA | Transistor + Analog | 24 | 8 channels of analog input 2 channels of analog output | 2 Channels/150K | 2 Channels/80K | DC24V | 8K


Hardware Manual


Parameters

Item | Specification
Model | GC-043 | GC-070
Display Size | 4.3 Inch | 7 Inch
Resolution (Pixel) | 480x272 | 800x480
Touch Panel | Four-wire high-precision touch screen | Four-wire high-precision touch screen
Color | 262,144 |
Backlight Module | LED | LED
Contrast Ration | 400:1 | 400:1
Luminance | 400（cd/m）² | 350（cd/m）²
SD Card | N/A | N/A
Memory | DDRI 32M/FLASH 128M | DDRI 32M/FLASH 128M
FCC | FCC,CLASS A | FCC,CLASS A
Electricity Strength Test | 1000VAC/1 Min | 1000VAC/1 Min
CE Certification | EN55022&EN55024 | EN55022&EN55024
Protection Grade | Front Panel IP65 | Front Panel IP65
Shell Material | PC+ABS | PC+ABS
Power Supply | 24V | 24V
Power Dissipation | 5W | 6W
Serial Port | RS485 | RS485
USB-A | Yes/Download and Online monitor | Yes/Download and Online monitor
USB-B | N/A | N/A
Ethernet Port | N/A | N/A
CAN | N/A | N/A
WIFI | N/A | N/A
3G | N/A | N/A
RS232 | N/A | N/A
RS485 | 1 for HMI | 1 for HMI and PLC respectively
Operating Temperature | -10℃-65℃ | -10℃-65℃
Operating Humidity | 10-90%RH | 10-90%RH
Shockproof | 10-58HE(XYZ:2G/30 Min) | 10-58HE(XYZ:2G/30 Min)
External Dimension | 150x93x43.5mm | 203×145×55
Cut-out Size | 141x84mm | 192×138
DI | 8 channels | 8 channels
DO | 8 channels（4 of relay +4 of transistor） | 16 channels（Transistor）
High-speed Counting | 2 channels; up to 150KHz | 2 channels; up to 150KHz
AI | 2 channels | 8 channels（including 4 channels of Temperature input）
AO | N/A | 2 channels


Interface Diagram of GC Controller

GC-043 (eg. GC-043-16MA)

1. Back Panel

No. | Interface Function
① | DI; 24V and 0V are for internal output
② | DO
③ | AI

2. Side Panel

No. | Interface Function
① | Power Input
② | 485 COM port
③ | N/A
④ | USB COM port

GC-070 (eg. GC-070-24MAA)

1. Back Panel

No. | Interface Function
④ | DI(Only 8 channels are available); 24V and 0V are for internal output
⑤ | DO
⑥ | Voltage/Current AI
⑦ | Temperature AI
⑧ | AO
⑨ | 485 COM port (COM2)

2. Side Panel

No. | Interface Function
① | Power Input
② | 485 COM port
③ | Unavailable for now
④ | USB COM port
⑤ | N/A

A. Connection Diagram of GC Output

Connection Diagram of Relay Output

Connection Diagram of Transistor Output

B. Connection Diagram of GC Intput

Leaking Input

Source Input

Item |  | Specification
Input Impedance |  | 3.3kΩ
Current Input Signal |  | 6mA/DC24V
Input sensitivity Current: ON |  | Above 3.5mA
Input sensitivity Current: OFF |  | Below 1.5mA
Input Response Time |  | Around 10ms
Input signal form | Leakage | No-voltage Contact Input, NPN
 | Source | 无电压触点输入，PNP Open Collector Transistor
Output Circuit Isolation |  | Opto-Isolator

C. Power Requirement

GC Controller can only be powered by DC power, a predetermined range of current and voltage 24v ± 15%, which ensures the compatibility with the majority of controllers applying DC power system.

Power regulator in this product realizes its function via power switch. Please disconnect the power, check the power wiring and power it again if the display screen shows nothing when it is powered on.

It must separate main power supply from AC mains supply properly.

It requires DC24V or less for external power requirement and 47-63HZ for the frequency.


Analog Input/output specifications and external wiring example

GC-043

GC-043-16MA has two channels of AI: AI0~AI1 that have respectively three types of range:

l Analog input range of voltage: 0~5V

l Analog input range of current: 0~20mA

l Analog input of K-Thermocouple, range of temperature measurement：-200℃ ~ 1250℃；the display value is ten times of the actual temperature（eg. 254 means the current experiment temperature is 25.4℃）

2. GC-070

1) AI for Voltage/Current

GC-070-24MAA has four channels of AI for voltage and current: AI0~AI3 that have respectively three types of range:

l Analog input range of voltage: 0~5V

l Analog input range of voltage: 0~10V

l Analog input range of current: 4~20mA

2) AI for temperature

l GC-070-24MAA has four AI channels for temperature: AI4~AI7 for which “thermocouple” and “PT100” are both available; the display value is ten times of the actual temperature（eg. 254 means the current experiment temperature is 25.4℃）

Specification of Temperature measurement：

l Measurement Range of PT100：-200℃ ~ 850℃; Measurement accuracy: within ±0.2℃ under 25℃

l Measurement Range of Thermocouple：-200℃ ~ 1250℃; Measurement accuracy: within ±0.5℃ under 25℃

Note:

l It would be better to close the temperature channels that are not applied in case of interference to others;

l It needs to isolate Thermocouple and PT100 from contact with other material during installation; it should narrow as much as possible the length of non-shielded conductor in the interface, to avoid the interference to measurement accuracy due to the exposure of conductor.

3) Analog Output

GC-070-24MAA has two channels of AO: AO0~AO1that have respectively three types of range：

l Analog input range of voltage: 0~5V

l Analog input range of voltage: 0~10V

l Analog input range of current: 4~20mA


Mounting Dimension

GC-043 (mm)


 |  |  | 控制器/PLC驱动实现方式
 |  | 通信配置
新建工程
 |  | 多点连接实现方式
 | 编辑画面（组态指南）
 | 系统寄存器 |  |
 | 系统设置 |  |
 | 操作案例 |  |


SamDraw 5.0 For SA/EA HMI


SamDraw综述

About SamDraw
说明: 说明: logo.gif

SamDraw configuration software is the configuration visual development system of Samkoon SA/EA series touch screens produced by Shenzhen Samkoon Automation Technology Co., Ltd. As integrated development environment software it has abundant and powerful development functions. SamDraw adopts the advantages of Windows system, with high user interface consistency and simple interfaces. The layout of the menus is close to those of Windows system, making it easy to learn, so that project designers can easily develop suitable configurations for their projects using SamDraw. Its function and structure features can help users to shorten the process of developing automation projects and the process of system upgrading and maintenance. It provides seamless integration with third party applications, effectively enhancing the productivity.

Functions and features of SamDraw are as follows:

1. Screen

The color of Samkoon HMI reaches 260,000-pigment, and compared with the products of other manufacturers it is more vivid. Besides, SamDraw provides a richer picture library, helping designers to design their configurations more conveniently and quickly. After configuration being downloaded to the HMI, it shows the same effect as what displays on PC screen, without distortion of color or font. Meanwhile, SamDraw has very simple operation interface, and the menu layout is similar to that of Windows. It absorbs and integrates the advantages of many major visual configuration software and touch screen configuration software, helping users to configure high-performance and high-quality projects.

2. Complete functions

SamDraw is equipped with complete functions, including basic shape drawing, coloring, text preparation, system picture library, animated display, bitmap status change, trend picture display, alarm control, and so on. It adds even dynamic circle, dynamic rectangle, meter, historical data collection, address searching, off-line simulation, data transfer, macro, and multi-function button in SamDraw3.3. Designers can easily design schemes and configuration based on their own requirements and characteristics of projects, and can achieve satisfactory effects.

3. Communication

SamDraw provides drivers for communication with PLC projects of all major manufacturers in the world, such as Siemens, Mitsubishi, Omron, Fuji, Panasonic, Schneider and Emerson. Two communication drives can be loaded at the same time in SA-12.1A，SA-10.4A，SA-10.4B，SA-10.2A，SA-8A，SA-8B，SA-7A，SA-7B，SA-5.7A，SA-5.7B，SA-5.7C，SA-5.7D，SA-5.7E，SA-5.7F, EA-7.0B.

4. Resources

SamDraw provides abundant resources. The picture library of SamDraw includes 3D indicator light, 3D button, television, 3D tank, 3D pipe, electron, bars, and the like. In addition, many pictures are provided with animation properties that can be used to design vivid animation. It also allows for user-defined picture library and inserting pictures from Windows. SamDraw also provides controls with abundant functions, such as trend diagram and alarming controls and the like, meeting the requirements of various configurations.


SamDraw综述

Install SamDraw
说明: 说明: logo.gif

SamDraw is an application specially designed for Microsoft Windows systems. Before installation of this software, please confirm that the software and hardware of the computer conform to the minimum installation requirements.

Use the installation CD supplied together with the product to install HMI-TOOLS. The detailed installation steps are as follows:

·Start up Windows;

·Insert SamDraw installation CD into the appropriate driver;

If the installation CD is lost, please contact us.

Thanks for your support. We will provide sincere services for you.

·After inserting the CD, an installation program window of SamDraw will pop up. If it does not, open the CD via My Computer, double click “setup.exe” file in the CD, and the installation window will appear;

·Choose “Install SamDraw” In the installation window.

·In the Welcome window, it is also available to install USB driver, view the CD, view user manual. You may quit the installation by clicking “Quit Installation” on the bottom right corner.

·In the license agreement dialog box, choose whether to accept the clauses, and click Next

·In target folder dialog box, choose the file folder where the software will be installed by clicking Browse button, and then click Next to proceed:

·After clicking Yes, an installation folder selecting interface will appear, where you may choose the default folder or other folder. Then, click Next.

·Click “Browse” to select the installation directory; The default is C:\Program File\SamDraw5.0\

·Start to install

·Click Finish to end this guide.


SamDraw卸载组态软件

Uninstall SamDraw
说明: 说明: logo.gif

Method One:

Step I: Select "Start" in Windows - "Program" - "SamDraw", and then select the option of Uninstall.

Step II: Left click "Yes" in the pop-up dialog box, wait for Windows system to delete automatically SamDraw, and then click "Finish" to complete unloading task.

Method Two:

Step I: Select "Start" in Windows - "Settings" - "Control Panel", enter the control panel interface, and then select "Add / remove programs" to pop up the dialog box.

Step II: Select SamDraw in the left area, click "Change / Remove" button, and the system will automatically remove SamDraw configuration software and the corresponding components according to steps above in the Method One.


SamDraw综述

Run SamDraw

After installation of SamDraw.exe, it will place a shortcut on the desktop; meanwhile the Start Menu also adds the corresponding program groups of SamDraw.

Double click the desktop shortcut, or click SamDraw.exe in the program groups of SamDraw in the Start menu.


SamDraw综述

Install USB driver

For downloading configuration file to HMI, it is necessary to install USB drivers for HMI; otherwise PC will not identify the connected HMI, thus it cannot complete the downloading of projects.

According to the version of Windows system choose an installation method.

1. Install the driver under Windows7, XP, 2000,98 and other systems

Steps are as follows:

Start Windows;

Insert the CD-ROM in the appropriate drive;

Double click the file to start the installation;

The HMI can be connected to the computer via USB after this installation.

2. Install the drive in VISTA:

Follow these steps:

You should install manually the driver under VISTA.

Start Windows;

Insert the USB cable of HMI into your computer port, and then it will prompt the page:

Select "Ask me again later", and then open Device Manager to find the HMI device, right click and select Update Driver;

Select the interface prompted to install the "Browse my computer for driver software";

Then browse to select "Manual Installation", select "Next";

Choose "Install this driver software";

After the installation, connect the HMI to the PC with a USB cable. We can find a HMI serial driver named Samkoon HMI Tech Corp in "Universal Serial Bus controllers" in Device Manager.

如图4-23 驱动名称

So far the HMI can be connected to the computer normally.

After the connection of a product of Samkoon SK series to a computer, it is necessary to follow the steps above to install the USB drive. If not, downloading tasks of configuration projects will be affected.


SamDraw综述

System Demands of SamDraw

  Click the following links to learn further about operation demands of SamDraw5.0：

l Hardware Demand

l Software Demands


SamDraw综述

Software Demand of SamDraw

SamDraw configuration software can run in the following operating systems:

· Microsoft Windows NT Server 4.0 (With SP3) or higher version in Chinese or English;

· Microsoft Windows NT Workstation 4.0 (With SP3) or higher version in Chinese or English;

· Microsoft Windows 98, Me, 2000, XP (IE 5.0 is recommended for Windows 95) or higher version in Chinese or English;

·Microsoft Windows VISTA System in Chinese or English;

·Microsoft Windows 7 System in Chinese or English;

·Microsoft Windows 8/8.1 System in Chinese or English

SamDraw will refuse to install in case of any operating system that does not conform to the above version.

It is recommended to use Windows XP SP3 operating system.


SamDraw综述

Hardware Demand of SamDraw

Minimum hardware requirements for SamDraw:

* Pentium 3-800MHz or above; Pentium 4-1GHz or above is recommended;

* Memory: When employing Windows 98 system, the memory should be 64M at least; when employing Windows 2000 system, the memory should be 128M at least; when employing Windows system, the memory should be 128M at least. It is recommended a memory of 256 M or above;

* Hard disk space: SamDraw configuration software requires at least hard disk space of 100M; otherwise it cannot start the installation;

* Graphic card: Compatible with Windows system with graphic memory of 1MB or above, being able to work under 1024*768 resolution and 32-bit true color;

* Computer with USB interface;

* Two-button mouse and keyboard.

It is possible that SamDraw cannot install and run on computers whose system configuration is lower than the above.

Recommended hardware configuration

* CPU: Pentium 800 or above CPU of Intel, or equivalent CPU of other manufacturers;

* Memory: 256M or above;

* Graphic card: Compatible with Windows system with graphic memory of 1MB or above being able to work under 1024*768 resolution and 65535-color mode;

* Hard disk: 4GB or above.


SamDraw综述

Editing Interface and System Composition

Editing interface of SamDraw is simple and handy. You can learn more by clicking the following links.

l Features of SamDraw Editing Interface

l System Composition of SamDraw


Editing Interface

SamDraw configuration software, as a screen development system designed for Samkoon HMI, provides an integrated development environment and has rich and powerful development functions. Taking advantages of Windows system, SamDraw is characterized by good interface consistency, simple application, similar menu layout as Windows, and so on. Engineering designers may develop proper configurations for their projects via SamDraw. The development interface and the function areas are shown in Figure 2-24:

圆角矩形标注: 标题栏
圆角矩形标注: 菜单条

l Title Bar: Show the version number of SamDraw.

l Menu Bar: Display command menus of SamDraw that are all drop-down ones.

l Tool Buttons: Shortcut buttons of several commands, such as Display buttons of File, Edit, Draw, and so on.

l Screen Area: The area for designers to configure and edit graphic objects.

l Project Manager: A menu tree of HMI parameters consisting of communication connection, parameter setting, screen management, alarm setting, recipe setting, and historical data collector.

l Information Output Window: Display input and output information and error information during the configuration of editing.

l Status Bar: Display current status of configuration, such as type, coordinates and size of control, mouse coordinate, and so on.


File Menu

File menu consists of New Project (N), Open Project (O), Close (C), Save (S), Save as, Quit (Q), and so on. Commands displayed in grey are invalid for the current operation. To open File menu, click File (F) at the top left corner of the interface of the software, and then a dropdown tool bar will pop up, as shown in Figure 2-26:

Figure 2-26: File menu

New project: Hot key Ctrl+N; to create a new blank project.

Open project: Hot key Ctrl+O; to open a project file (.drw file) that has been created and saved in Windows.

：

Do not open configuration files with a suffixation of .drw saved by SamDraw3.1 through SamDraw 5.0; otherwise it will occur procedural errors that lead to automatic crash.

If open project file of SamDraw3.2 with SamDraw5.0, or double click it when computer has installed SamDraw3.2 and later SamDraw5.0, the project will run in the last version of the software, and the following prompt dialog box will pop up:

Click “Yes” and then a dialog box of “Converter” will pop up:

Users can convert project of SamDraw3.2 to that of SamDraw5.0 by following the above steps; it is available to open it with SamDraw5.0 after the conversion.

：

Close: Close the current project configuration screen without quitting SamDraw configuration software.

Save: Hot key Ctrl+S; save the current modification in the configuration screen, with the file name and save path remaining unchanged.

Save as: Save the current configuration screen as a file in different name and save path.


Editing Menu

Edit menu consists of a group of commands used to edit screens as well as words and graphs in screens, including Undo (U), Restore (R), Cut (T), Copy (C), Multiple Copy (D), Paste (V), Delete (D), Select All (A), Align, Layer, Group, Mirror, Zoom, Grid, Property setting, Find Address, Address Table, Reverse Select, Macro search, Macro Manager. If a command in the menu bar is gray, it means that command is unavailable in the current operation. To executive these commands, you should first select the graphic object to be edited, and then choose the corresponding command in "Edit" menu. But there are in "Edit" menu some commands that are group commands. If so, a little triangle will show on the right of the command and each command, with a drop-down menu, has a corresponding shortcut, as shown in Figure 2-27 below.

Undo: shortcut key Ctrl + Z; to cancel the last operation command and your recent action.

Restore: shortcut key Ctrl + Y, to restore the last operation command and your recent action.

Cut: shortcut key Ctrl + X, to delete your selected graphical objects and copy them into the clipboard buffer.

Copy: shortcut key Ctrl + C; to copy the selected graphic object into the paste buffer.

Multiple copy: to copy a quantity of selected graphical objects in horizontal and vertical directions, and then the address can be in ascending order of 0-255 units.

Paste: shortcut key Ctrl + V, to copy and paste buffer graphics objects into the current screen.

Delete: Del, to remove selected graphical object from the screen.

Figure 2-27: Editing menu

Select All: shortcut key Ctrl + A; to select all objects in the current frame of the project.

Align: to make selected objects (more than two) aligned according to the selected type alignment, including Top, Bottom, Vertical Center, Left, Right, Horizontal Equal Interval, Vertical Equal Interval, Make same width, Make same height, Make same width and height.

Layer: to place the selected objects to a different picture level. You can choose Bring To Top, Bring Forward, Send to Bottom or Send Backward.

Group: to combine selected objects (more than two) into one control, or split This command can be selected more than one object (two or more) are combined into a control, an object can also can split a detachable object or split combined objects into the original object.

When using Group, please be sure not to assembly objects to touch, otherwise objects can’t be touchable after being downloaded to the touch screen. Layer is recommended if it is necessary to overlay touchable objects.

Mirror: to rotate the selected object in accordance with certain rules, horizontally or vertically.

Zoom: to zoom the current screen in accordance with a certain proportion scale for a more fine control operation; zoom options are Zoom In, Zoom Fit and Zoom Out.

Grid: to place or cancel a grid with certain width in the current screen.

Grid Width: to modify grid width of the current screen between 4 and 16.

Border Scale: to add and remove scale mark in the left corner of the screen area Window.

Previous Screen: to open the screen whose serial number is right before the current one

Next Screen: to open the screen whose serial number is immediately after the current one

Open Property settings: to open the Properties window of an object (when one single object is selected) and that of a screen (when nothing is currently selected).

Information Output Window: to open and close the window of information output.

Find Address: to find the address you are using.

Address Table: to open or close the list of addresses being used. Address Table is a list of address used by objects, easy to find and replace.

Project Manager: to open and close the window of Project Manager.

Invert Selection: to select all objects not being chosen in the current screen and objects that are chosen before are not included.

Macro Search: to locate calls of the macro in the project.

Macro Manager: Execute this command to see locations of all macros used.


View Menu
说明: 说明: logo.gif

This menu is mainly used to display operation boxes in project. It consists of Standard Tool Bar, Toolbox, Debug Toolbar, Standard Status Bar, Information Output Window and Project Manager, as shown in the figure below:

说明: 说明: 006.jpg

Standard Tool Bar: Whether to display standard tool bar, i.e. the first layer tool bar of the software.

Toolbox: Whether to display tool bar, i.e. the control tool box in the right part of the interface.

Debug Toolbar: Whether to display configuration tool box, i.e. the second layer tool bar of the software.

Standard Status Bar: Whether to display standard status bar, i.e. the lowest status bar of the software.

Information Output Window: Whether to display information output window, i.e. the last but one layer of the software.

Project Manager: Whether to display project manager, i.e. the menu tree in the left part of the interface.


Draw Menu

The menu is mainly used to draw graphics on the screen. SamDraw provides Open Library (0), Build Library (C), Set Status ON (1) and Set Status OFF (0). It’s convenient for engineers to change the color, text, size and location of picture elements created by the Tools menu, which is as shown as Figure 2-28 below:

Open Library: Execute this command to open the picture library of the system.

Build Library: Execute this command to convert the image control drawn by user into a file of library; it is easy to operate next time.

Set Status OFF: Execute this command to set the status of all bit operation objects in the current screen to OFF.

Set Status ON: Execute this command to set the status of all bit operation objects in the current screen to ON


Screen Menu

"Screen (P)" menu consists of commands applied to screens, including New Screen (N), Screen Properties (P) and Delete Screen (D), as shown in Figure 2-30:

New Screen: Execute this command to create a new screen in the current project.

Screen Properties: Execute this command to open the properties of the current screen by which you can set the name and background.

Delete Screen: Execute this command to delete the current screen.

：Please make sure the current screen is the one you want to delete and whether there are needed controls before operating because it cannot be undone.


Download Menu

Applied to compile and download the configuration project, “Download” menu contains four commands, which are Compile (C), Off-line Simulation (M), Online simulation, USB download (D), Compile + Download (A), Upload, Upload HMI ID. Having connected PC to a touch screen through USB cable, the configuration project can be downloaded via USB download to the touch screen, but you have to compile it before downloading.

Compile: Execute this command to examine configuration projects created by users and prepare for download operations.

Off-line Simulation: Execution of this command can invoke the application program of SamDraw screen configuration and open the simulation interface. Users can simulate the configuration project running currently on PC to observe the effect, in order to modify the screen. Please save it Off-line simulation before you save the user first.

Online Simulation: This command can simulate the run of engineering on a PC.

USB Download: Execution of this command can download engineering configuration compiled by SamDraw software to HMI through a USB cable equipped with HMI. Before downloading, please compile and save the project.

Compile + Download: Execution of this command enables to download engineering configuration compiled by SamDraw software directly to HMI through a USB cable equipped with HMI, without executing Compile first and then Download.

Upload: Execute this command to upload the historical data, configuration, recipes, and historical alarm from the HMI to a PC through a USB cable equipped with HMI.

Upload HIM ID: Execute this command to read the ID of HMI on PC.


Setting Menu

"Setting (s)" menu contains the following commands: Preference Setting (P), Alarm Setting (A), Recipe Settings, File Protection (M), Macro, Converter, Global Macro and Initialization Macro.

Preference Setting: Execute this command to open the preference setting window, in which you can modify the HMI model, display mode, splash screen, screen saver time, flicker frequency, alarm sound, touch sound, password and settings of initial lever.

Alarm Setting: Execute this command to open the window of digital alarm and analog alarm, in which you can set its Size, Scanning time and Address.

Recipe Setting: Execute this command to open the window of recipe setting where you can set required recipe data.

File Protection: Execute this command to open the password setting window of file protection through which you can set a password to protect the file of the current project is set in the password window.

Macro: Execute this command to open the macro editor where you can add, modify, compile or delete a macro.

Global Macro: Execute this command to open a global macro setting screen, set or modify the global macros.

Initialization Macro: Execute this command to open the interface of initialization macros setting to set or modify initialization macros.


Help Menu

It can call the help document of SamDraw as well as its version number and copyright information through Help menu, as shown in Figure 2-33.

Help document is as shown as in Figure 2-34:

SamDraw’s version number and copyright information is as shown in Figure 2-35:


Popup Menu

Right click menu is set to facilitate user’s operations, which is consistent with most Windows user's operating habits and styles. Lots of configuration functions can be found here: Properties, Insert, Library, Cut, Copy, Duplicate, Paste, Delete, Select, Align, Layer, Rotary, Assemble, Image Ratio, Grid, Grid Width, Simulation Status, Screen.

Properties: Execute this command to open the properties window of a control (one single object selected) and the screen (no object selected).

Insert: Execute this command to open all of the object controls in the Object menu.

Library: Execute this command to open the gallery or generate pictures.

Cut: Shortcut Ctrl + X; this command can delete your selected graphical objects, and copy them into the clipboard buffer.

Copy: Shortcut Ctrl + C; execute this command to copy the graphic object of your choice into the paste buffer.

Duplicate: Execute this command to copy a quantity of selected graphical objects in horizontal and vertical directions, and then the address can be in ascending order of 0-255 units.

Paste: shortcut key Ctrl + V, to copy and paste buffer graphics objects into the current screen.

Delete: Del, execute this command to remove selected graphical object from the screen.

Select: shortcut key Ctrl + A; execute this command to select all objects in the current frame of the project.

Align: Execute this command to make selected objects (more than two) aligned according to the selected type alignment, including Top, Bottom, Vertical Center, Left, Right, Horizontal Equal Interval, Vertical Equal Interval, Make same width, Make same height, Make same width and height.

Layer: Execute this command to place the selected objects to a different picture level. You can choose Bring To Top, Bring Forward, Send to Bottom or Send Backward.

Assemble: to combine selected objects (more than two) into one control, or split This command can be selected more than one object (two or more) are combined into a control, an object can also can split a detachable object or split combined objects into the original object.

When employing Assemble, please be sure not to group objects to touch, otherwise objects can’t be touchable after being downloaded to the touch screen. Layer is recommended if it is necessary to overlay touchable objects.

Image Ratio: Execute this command to zoom the current screen in accordance with a certain proportion scale for a more fine control operation; zoom options are Zoom In, Zoom Fit and Zoom Out.

Grid: Execute this command to create or cancel a grid with certain width on the current screen.

Grid Width: Execute this command to modify the width of current grid; width range is 4-16.

Simulation Status: Execute this command to change the switch status of all bit operation controls; ON or OFF.

Screen: Execute this command to create new screen, open the Screen Property window and delete screen.

Please make sure the current screen is the one you want to delete and whether there are needed controls before operating because it cannot be undone.


SamDraw综述

Tool Bar

SamDraw offers a series of shortcut tool buttons, some of which are tool command buttons while some belong to editing commands. You can easily get to the needed commands here instead of seeking it in the menu bar if familiar with these buttons. Each button has tooltips that will appear when the mouse is placed on the button, which will turn gray if the If the operation is invalid in the current environment. Tool Bar is as shown in Figure 2-37:

For detailed instruction, please click the following link corresponding to the area where the button belongs.

l Standard Toolbar

l Debug Toolbar


SamDraw工程管理器

Project Manager

Project Manager Window of SamDraw is in the left of configuration software window, below the toolbar. You can here set the parameters of HMI, including Connection, Setting, Screen, Window, Historical data collector, Alarm log, Recipe, Data transmission and Ladder; Connection consists of Connection 1 and Connection 2 settings which contains HMI parameter settings, HMI state, PLC control, Clock, File protection and HMI protection. Project Manager Window is as shown as Figure2-38:


Tool Bar

Function controls:

Bit Button: Execute this command to create touch keys for performing bit manipulations to the connected device, including Set ON, Set OFF, Dot and Invert.

Word Button: Execute this command to set a touch key for performing word bit operation in the current screen to the connected device, including Add, Subtract, Increasing, Decreasing, Set Constant, Enter Value, Enter Password.

Screen Button: Execute this command to set the switching of screens, including opening screen, open the previous screen, close and Open screen, Closes screen, Open previous screen and Close open screen.

Function Button: Execute this command to set a certain function control of the operating system, including Turn off background light, Confirm alarms, Restart HMI, Set screen saver time, Write recipe to PLC, Read recipe from PLC, Set the date and time, Clear alarm, Switch to the previous recipe, Switch to the next recipe, Save the current recipe, Alarm Up, Alarm Page Up, Alarm Page Down, Coordinate Adjustment, System parameters, Change User Level, User Level Logout, Touch sound ON / OFF, Alarm sound ON / OFF, Clear all historical data, Clear alarm history and Unlock HMI protection.

Bit Lamp: Execute this command to create on the current screen a picture monitoring the bit status of one single connected device.

Multistate Switch: Execute this command to create multi-state button monitoring numerical value changes of single address of the connected device according to the change of status.

Multistate Lamp: Place a picture in the current screen to monitor the word status of multiple consecutive device addresses.

Numerical Display: This command is used to draw on the current screen a numerical display frame reflecting numerical value of certain monitored address.

Numeric Input Display: Execute this command to draw on the current screen a numerical display frame for data input and digital value display of certain monitored address.

ASCII Display: Execute this command to draw on the current screen a numerical display frame for ASCII code.

ASCII Input Display: This command is used to draw on the current screen a frame of display and output for the input of ASCII code.

Bar Graph: Execute this command to insert a columnar control on the current screen to observe the changes in the numerical value of monitored address according to the rise and fall or the right-left traverse of the columnar picture.

Time Display: Execute this command to insert the time control on the screen to show the time.

Date Display: Execute this command to insert the date control on the screen to display the date.

Week Display: Execute this command to insert a week control on the current screen to display the week.

Static Picture: Execute this command to insert a static image of the local hard disk on the current screen.

Picture Display: This command is used to draw a picture display frame on the current screen for displaying a plurality of pictures.

GIF Display: Execute this command to draw a picture display frame on the current screen to display a static or animated image suffixed by .GIF.

Trend Chart: Execute this command to create a trend chart control in the current screen to monitor the change trend of continuous address value of connection device.

XY Trend chart: Execute this command to create a XY trend chart in the current screen to monitor the change of two continuous address value of connection device.

Dynamic circle: Execute this command to create a dynamic circle in the current screen whose size and location transform according to the continuous address change of connection device.

Dynamic Rectangle: Execute this command to create a dynamic rectangle in the current screen whose size and location transform according to the continuous address change of connection device.

Alarm Bar: Execute this command to create an alert bar in the current screen to scroll display alert information.

Alarm display: Execute this command to create an alert box control in the current screen to display the date, time and message of each alert.

Historical Alarm display: Execute this command to create a display control of historical alarm record in the current screen to show historical alarm data.

Graphics Move: Execute this command to create a graph display frame in the current screen whose graphic state and location change according to the continuous address change of connection device.

Meter：Execute this command to create a meter control to present the current value of associated variables through a pointer

Historical Data Display: Execute this command to create a historical data display to present all collected historical data.

Message Display: Execute this command to display corresponding message information according to different monitoring address.

Multi-function button: Execute this command to create a multi-function button in the current screen to realize multiple functions through one key.

Flowing block: Employ this command to create a simulation control of flow state in the current screen.

Historical Data Trend: Execute this command to create a historical data trend in the current screen to show historical data.

Timer: Execute this command to create a macro timer in the current screen to control the execution of the macro.

Basic controls:

Line: Execute this command to draw a straight line in any direction within the current screen.

Polyline: Execute this command to draw a polyline in any direction within a current picture.

Curve / Arc: Execute this command to draw a line in the current screen, after finishing drawing by right button, the radian of drawings can be adjusted as needed.

Straight Link Line: Execute this command to link lines in the screen.

Curve Link Line: Execute this command to link curves in the screen.

Rectangle: Execute this command to draw a rectangle of any size in the current screen.

Circle/Ellipse: Execute this command to draw any size of circle or ellipse in the current screen.

Polygon: Execute this command to draw an arbitrary polygon in the current screen.

Text: Execute this command to create a text input on the screen.

Table: Execute this command to create a table with required ranks in the current screen.

Scale: Execute this command to draw a desired scale.


SamDraw综述

System Composition

SamDraw is the screen configuration editing software of Samkoon HMI. SamDraw allows the project designer to edit project screen configuration on PC, then download the final configuration screen and required communication driver to the storage mechanism of the touch screen through USB for operation, establish communications with PLC or other connected device through the executive body and serial port, and conduct corresponding control and monitoring. The following Figure 2-39 is the composition of HMI-TOOLS system:


SamDraw综述

Basic operation

This chapter introduces briefly operation of SamDraw configuration software, including mouse usage, hot keys and terms.

l Mouse usage and hotkeys

l Terms


SamDraw综述

Mouse usage and hotkeys

说明: 11 When employ mouse to create configuration screens in the configuration software, the mouse is as shown in Figure 2-40:

Figure 2-40

Now we introduce several frequently used operations with mouse and the application of these operations.

◎ Click left key

In this manual [click] means pressing down the key on the left and then releasing it. It is used when choosing menu, choosing object, choosing tool button, editing image and confirming settings.

◎ Double click left key

In this manual [double click] means quickly and continuously clicking the left key twice. It is used when setting attributes of objects placed, setting attributes of image/window, setting connection attributes of the screen, setting Setup attributes of the screen, and creating controls such as historical data collection/recipe/alarm. A dialog will appear after double clicking.

◎ Click left key

In this manual [right click] means pressing down the key on the right and then releasing it. It is used to call the popup menu, or cancel the image editing state and recover the mouse pointer shape.

◎ Drag

In this manual [drag] means moving the mouse while pressing down the left key. It is used to choose several objects, move objects, or move the edit window popped up.

2.8.2 Shape of Mouse pointer

When using SamDraw software, shape of mouse pointer changes with the operation of the user to distinguish operation types and provide convenience for users. Table 2-1 below lists the different shapes of mouse pointer and the corresponding operation that may be made when such shapes appear.

说明: 11 | Choosing object, clicking tool button
+ | Pasting
说明: 20090522101626367 | Drawing graphs
说明: 33 | Entering texts
说明: 20090522102318339 | Zooming in objects vertically
说明: 20090522102238822 | Zooming in objects horizontally
说明: 20090522103113602111111111 | Zooming in objects both vertically and vertically
 | Readjusting
说明: 88 | Zooming in objects both vertically and vertically
 | Rotating objects

Table 2-1: Shapes and meanings of Mouse point

2.8.3 Hot key

Table 2-2 below lists some frequently used hot keys, which provide convenience for designers during configuration.

CTRL+C | Copy
CTRL+V | Paste
CTRL+X | Cut
CTRL+drag | Copy and move chosen object
SHIFT+click (CTRL + click) | Choose several objects at the same time
←→↑↓ | Move the chosen object left/right/up/down
ESC | Cancel the command operation
DEL | Delete

Table 2-2: Hot keys


SamDraw综述

Terms

The following Table 2-3 lists some common names used in the book to introduce the project screen configuration.

Project | Abbreviation of the user's application system. Introduce the concept of project, to make the complicated computer professional technology closer to the common project users. The file generated in SamDraw configuration environment is called as the project file, with the suffix of *.drw, and can be stored at the place specified by the user.
Object | General designation of the operation target and operating environment. The window, component, data, graph and so on are called as objects.
Select object | Click the window or object with the mouse, so that it is at the operational state. The operation is called as select object, and the object selected (including window) shall also be called as the current object.
Configuration | Define, make and edit the object, and set the state characteristic (attribute) parameters. The work is called as configuration.
Attribute | General designation of the object name, type, state, performance, usage and other characteristics.
Menu | The command set to implement a certain function. For example, the "file" menu command in the system menu is used to process the executive command related with project file. The menus of HMI-TOOLS are drop-down menus, which can be divided into many levels, and each level is called as the sublevel submenu.
Command button | The button with a certain command operation. Some buttons are in the tool bar, and some are in the menu bar.
Set ON status | Switch the object with function of displaying bit status to ON.
Set OFF status | Switch the object with function of displaying bit status to OFF.
Pattern | The transition effect of the object from the foreground color to background color
Address | Memory variable related with the current object
Connection device | The device performing communication with the current project
Control | The set of objects with certain specific functions

Table 2-3 Common terms


SamDraw综述

Create New Project

This chapter introduces basic steps to create a new project.

l Create a new project with SamDraw

l Set HMI parametersSamDraw and add graphic objects

l Download a project

l Upload a project

l Converter

l Upload HMI barcodeHMI


SamDraw综述

Create New Project

This operation is necessary when engineers need to create a new project. Select New Project in the File menu or New Project button in the tool bar, then SamDraw will pop up the "New Project dialog box" where you can decide the name and storage path of the project. Select the corresponding HMI model; click OK to complete creating a new project and enter into the dialog box of Communication port settings; click Cancel to exit the dialog box.

1. SamDraw New project dialog box

Project name: Name of new project

Path: Storage path of new project file; the default is C: \

Model: Available models for projects: EAH-43A (480*272, 4.3’)

The default model is EAH-43A (480*272, 4.3’).

The maximum number of screens will appear in the last line of “Model Parameters” when choosing a different model, which means it can support up to certain quantity of screens. Thus, it is necessary to check the maximum number when creating a new project.

l Display mode: Display direction of the touch screen used by the project. Available models include:

Horizontal: Configuration with the touch screen being horizontal.

Vertical: Configuration with the touch screen being vertical.

The default mode is Horizontal.

The figure above is the New Project dialog box where engineers decide the Name, Path, Model and Display Mode, then click Next to set communication port.

All models support horizontal model while vertical mode is unavailable for now. The default mode is Horizontal.

图3-1 新建工程对话框

The figure above is the New Project dialog box where engineers decide the Name, Path, Model and Display Mode, then click Next to set communication port.

Specific model is determined by the HMI model that user has.

The name of the new project cannot contain the following characters: \ /: * "<> |?.

2. Communication Settings dialog box

Communication settings dialog box is used to set communication parameters of the communication port of HMI. Only correct communication parameters can ensure normal communication between PLC and touch screens. The specific communication parameters depend on the model of PLC to be connected.

Connection Name: The name of the communication port.

Connection Type: Communication mode.

Device Service: Selection of PLC brand and CPU type.

Connection Interface: Select COM port.

PLC Continuous Address Interval: Set PLC consecutive address space; the default value is recommended.

图3-2 通信设定对话框

The Figure 3-2 above is the dialog box of Communication settings where engineers can select corresponding service according to different connection device.

HMI of 4.3 inch has only one COM port; so it only needs to set COM1 port.

Connection ID: Internal parameters cannot be changed!

When you configure the communication properties can also be set in the Project Manager connection, the other parameters are set in the communication properties.

3. Screen Properties settings box

Click “Next” in the Communication settings dialog box to pop up a New Screen dialog box where you can set the name and the background color of screens. The default name is a screen number; the default background color is blue. When we create a new picture every time, SamDraw configuration software will assign a screen number to the new screen to indicate the screen order of the current project. Numbers start from 1, that is, the serial number of the first frame 1. No. 5 is the fifth screen. To change the background color of the new screen, just click the rectangle behind the Background Color to bring up the color selection frame. With more than two hundred kinds of colors for users to select quickly, SamDraw software provides the most extensive selection of color. If you are dissatisfied still, you can click on the lower right of the color selection box to customize color. In the Custom Colors dialog box, select the basic color first, then color in the middle of the square area; drag the mouse to adjust the desired color area; you can also type in the right vertical rectangle and drag the mouse to complete the desired color, at last click OK. You can also enter directly basic color values.

Figure 3-3 New screen dialog box

Figure 3-4 Color selection dialog box

Engineers can also choose own pictures as the screen background. Click the path icon to find the image path.

Click OK to complete the above steps, the system will immediately open the screen you just created. Preparations for new construction are done. Then it’s time to edit own configuration project.

The screen name cannot start with space or number; it cannot contain special characters.


SamDraw综述

Set HMI parameters

说明: 说明: logo.gif

Set HMI parameters

You can modify the parameter settings g in the drop-down menu Setting, or double-click the HMI Parameter Settings in Setting, Project Manager. Then a pop-up dialog box is shown as Figure 3-5 below:

Figure 3-5 General parameter setting dialog box

Please refer to dialog box of Create New Project for HMI models and Display mode.

It can also support changing the Splash screen, i.e. the start screen of HMI when powered on; screen names are listed in the drop-down menu, as shown in Figure 3-6: in HMI Model: Change the HMI model through this option.

Set Screen Saver Time, i.e. the waiting time before HMI shows the Screensavers screen; the default time is one minute that can be modified via spin button.

Command of changing screen saver time is available only when the screensaver screen is available; a touch on HMI will bring it back to the previous screen.

Flicker Frequency: Set the flicker frequency of objects or controls which can blink; you can change the speed of flicker by inputting directly a value and clicking the spin button.

Alarm sound: When the alarm occurs, the touch screen can remind users through sound; the right drop-down menu contains two cases, with or without sound reminder.

Touch sound: Options in the right drop-down menu can decide Sound reminder or No sound reminder.

Screensavers screen: Select a screen among the existing screens as screensaver screen; just touch the screen to return the former screen.

If Load Screen: If choose this option, the HMI will display the selected loading screen after power-on for a certain while, and then switch to the splash screen; thus users can give some tips or notes.

Apart from that, it can also set User Level Password here. It supports up to 8 levels and each password can reach up to eight characters. The default initial passwords of Level 1-8 are 1111-8888; the default user level is 1. Password can be user-defined.

Add graphic objects:

Having created new screens, users can add objects or controls provided by SamDraw, including Rectangle (Rounded Rectangle), Line, Ellipse, Sector (Arc), Bitmap, Polygon, Text and other basic graphic objects. It provides operations of free movement, zoom, shape change, copy, paste, delete, alignment and other editing operations, as well as operation tools designed to modifying color, line type and fill attribute. It also supports drawing via keyboard and mouse. SamDraw adopts object-oriented programming skills to facilitate the creation of screen graphical interfaces for users. Thus it is possible to develop screens with graphic objects provided by system just like the way to build blocks. In the meantime, it supports operations of copy and generation between graphic objects in screens, and reapplying former development results. SamDraw offers abundant bitmaps for choice, which saves much configuration time for users.


SamDraw综述

Download Project

When complete the editing of configuration, you need to click the button on the toolbar or employ the shortcut Ctrl + S, and then click or execute the Compile command in the Download menu to compile. During the compilation, the information output window will show the situation in real time. It can’t complete the compilation if error exists. As shown in Figure 3-8:

Figure 3-8 Prompt of compiling error

You can modify it according to the error hint in the information output window; or you can also double-click the error, then SKTOOL will automatically find the wrong object as well as select it. So engineers can double-click on the object to view its property settings, find the reason of the error and make appropriate alterations. After click the Save button to compile and execute the command again. If there is no error, the system will pop up a dialog box indicating successful compilation after a while. At last, click OK to finish it, as shown in Figure 3-10:

Figure 3-10 Information Output Window

1. It’s necessary to compile before downloading while the step of conservation is required before compiling. Otherwise it will fail to compile, as shown in Figure 3-11. After compilation, if you modify again, you need to compile again.

2. In case of the “Beyond Capacity” question during the compilation, steps of solution are as follow:

Check all sizes of files starting with “wkong” of “Folder” file under the software installation directory -> Find the screen corresponding to the largest file-> Modify the control size in the screen to make it smaller.

If it still exceeds the capacity, modify again the largest screen.

Figure 3-11 Compiling Remind

Finally, execute the command USB in Download menu to download through USB cable; engineers can also directly select the command Compile + Download in Download menu. The implementation of the operation brings up the following pop-up dialog box in Figure 3-12:

Figure 3-12 Download dialog

Click to download; the middle progress bar shows the downloading progress. After the downloading, a pop-up window shows the completion of USB download. Click OK to complete the downloading task, as shown in Figure 3-13:

Figure 3-13 Downloading completed

The next step is the connection to the PLC to see whether the configuration project runs correctly in HMI.

Please refer to Wiring for connection between PC and PLC.

Do not cut off the power of HMI, PC or USB cable and avoid other operations during the transmission process; otherwise the connection will be affected.

When it pops up the dialog box above, which means PC fails to recognize HMI, it is necessary to check the USB driver. Connect PC with HMI, power on HMI and find out whether it exists the USB driver “Samkoon HMI Tech Corp” in My computer-Attribute-Hardware-Device Manager- Universal Serial Bus controllers, as shown in Figure 3-15 (Try to pull out and plug the cable to check if PC can recognize HMI):

图3-15 查找触摸屏USB驱动


上载组态程序

Upload Project

SamDraw software supports uploading configuration program from the HMI to the hard disk. Connect HMI to PC; select the option of "Upload project file" in the pop-up dialog box, and then the operation interface will appear.

File Path: Click "Browse" to select the file in which you want to save the path.

Project Name: Set the name of the project.

Start uploading: Click Upload to start, files to be uploaded contain configuration project and also ladder diagram.

After the realization of the uploading, you can choose whether to open the project file.


转化器

Converter

Run SamDraw software; click the command button or start Converter in “Start Menu \ Program \ SamDraw5.0 \ Converter”.

Select Upload historical data to upload it from HMI to hard disk.

Storage Path: Click “Browse” to select the save path.

File Name: Set the name of uploaded file; format of file is CSV, i.e. comma-separated file that can be edited by EXCEL.

Click OK to start uploading and the file is saved in the set storage location.

Operations of uploading recipe and historical data are the same.


转化器

Upload HMI barcode

Upload HMI barcode: This function allows reading HMI barcode into PC.

First, power on HMI and connect it with PC through USB.

Secondly, run Sandraw5.0 configuration software, select “Upload HMI barcode” in “Download” menu.

It will read the barcode when the connection runs normally.

The figure above is HMI barcode.

Only HMI produced after June 2014 is equipped with this function.


SamDraw综述

Configuration Guide
说明: 说明: 说明: logo.gif

This chapter introduces configuration methods of SamDraw in detail.

l Screen Operation

l Graphic Editing Commands

l Draw basic graphs

l SamDraw Basic Controls

l SamDraw Extended Controls

l SamDraw Control Instruction


SamDraw画面操作

Screen operation

l Screen operation

l Modify screen

l Delete screen

l Copy screen


SamDraw创建新画面

New screen

“New Screen” command is used to create a new screen in the current project. Steps of creating new screens are as follows:

1. Select the “New Screen” command in the Screen menu or click the button command [image] or right click the Screen menu in the project manager, and then select “Add Screen”, as shown in Figure 4 -1 below:

Figure 4-1 New Screen

2. In the pop-up "New Screen" dialog box, set the name and background color of the new screen, then click OK. The default name of the new screen is a screen number; the default background color is blue, as shown in Figure 4-2:

Figure 4-2

Screen name cannot start with number, space or other special symbols.


SamDraw修改画面属性

Modify screen

To modify the properties of the screen, including the name, background color, you can perform the following operations:

Under the circumstances that no object or control is selected (you can click blank space in the current screen), select the command [image] on the toolbar or left click to select the screen in the project manager, and then right click on it or you can right click in the screen while on object is selected in order to bring up the context menu in which you can find "Property" command.

Figure 4-3 Screen Property settings


SamDraw删除画面

Delete screen

This command is used to delete the screen in the current project; methods are as follows:

Select " Delete Screen" in the Screen menu; or left-click to choose the screen to be delete in the project manager, then right click to select “Delete” key; or right click in the blank space in the screen while on object is selected in order to bring up the context menu in which you can find "Delete" command.

Figure 4-4 Delete screen

Click OK to complete the operation of deleting.

Once deleted, the screen cannot get back! Execute this command with caution.


复制画面

Copy screen
说明: 说明: logo.gif

This command is to copy the screen in current project; methods are as follows:

Left-click on the screen to be copy in the project manager, then right click to bring up the context menu and select "Copy", after that it will prompt to set the name and ID of the new screen (Figure 4-5), at last select "OK" to copy and list the screen; select "Cancel" to cancel the current operation.

Figure 4-5 Copy Screen


SamDraw图形编辑命令

Graphic editing commands

l Group/Ungroup

l Layer

l Rotate

l Align


SamDraw组合与取消组合命令

Group/Ungroup

The command of Group is to combine selected objects (more than two) into one. Objects can be graphs drawn by engineering designers or you, also can be that of system library or other controls, as alarm control and trend chart and so on. Combination will not maintain the properties of the original graphic object. Objects, graphs and controls are only a picture after grouping, which can be saved as a library control, in case of usage next time for timesaver. Ungroup is to decompose a combination of graphic objects into the original elements; after ungrouping, all elements can restore their original property. It’s the inverse operation of Group.

Methods of Grouping:

Ø First it needs to select multiple graphic objects, and then select the Group command in the Edit menu, or that command button in the toolbar menu, or right click to bring up the context menu and select "Group" item, before and after comparison picture is as Figure 4-5:

Figure 4-5 Contrast before and after group command

Methods of ungrouping:

Ø Select a combined graphic object from grouping, and then select the Ungroup command in the Edit menu, or in the toolbar menu, or in the context menu; before and after comparison picture is as Figure 4-6:

Figure 4-6 Contrast before and after ungroup command

Select multiple objects through Ctrl key.

Before the combination, please make sure whether each any element still needs to be responsible for touch or surveillance work, because after the combination, it will be an image object, which you cannot touch or monitor.


SamDraw层次

Layer

Layer Command is by group. It is used to adjust the display level of intersecting graphic objects. Each object SKTOOL has a graphic level; the top of the graphic objects are always displayed on top of the lower graphic objects, so you can use this command to adjust the hierarchy level. The default level of new graphic object is higher than that of original. SKTOOL Layer consists a total of four commands: Bring To Top, Bring Forward, Send to Bottom and Send Backward. To execute this command, you need first select one or more graphical objects on the current screen, and then select the corresponding command in the Edit menu or toolbar menu.

Ø Bring To Top

Execute this command to move the selected graphic object to the uppermost layer of all graphic objects, so that the selected graphic object will overwrite the intersecting part.

First choose an object in several graphs, and then choose Bring To Top command in Edit menu, or command button in the toolbar buttons, or call the right click menu and choose Bring To Top command in the Layer option. See Figure 4-7 for a comparison before and after combination.

Figure 4-7 Contrast before and after Bring To Top

Ø Send To Bottom

Execute this command to send the selected graphic object to the lowermost layer of all graphic objects, so that the intersecting part of the selected object will be invisible.

First choose an object in several graphs, and then choose Send To Bottom command in Edit menu, or command button in the toolbar buttons, or call the right click menu and choose Send To Bottom command in the Layer option. See Figure 4-8 for a comparison before and after combination.

Figure 4-8 Contrast before and after Send To Bottom

Bring Forward

Execute this command to bring the selected graphic object one level forward to the intersecting graphic objects. You first need to select one object in multiple graphic objects, and then select "Bring forward" in the Edit menu or the toolbar button, or right click to bring up the context menu containing “Bring forward” in the series commands of Layer.

First choose an object in several graphs, and then choose Bring Forward command in Edit menu, or command button in the toolbar buttons, or call the right click menu and choose Bring Forward command in the Layer option. See Figure 4-9 for a comparison before and after combination.

Figure 4-9 Contrast before and after Bring Forward

Ø Send Backward

Execute this command to send the selected graphic object one level backward to the intersecting graphic objects. You first need to select one object in multiple graphic objects, and then select " Send backward" in the Edit menu or the toolbar button, or right click to bring up the context menu containing “Send backward” in the series commands of Layer.

First choose an object in several graphs, and then choose Send Backward command in Edit menu, or command button in the toolbar buttons, or call the right click menu and choose Send Backward command in the Layer option. See Figure 4-9 for a comparison before and after combination.

Figure 4-10 Contrast before and after Send Forward


SamDraw旋转

Rotate

This command is by group. SKTOOL configuration editor software allows engineers to rotate one or more graphical objects at any angle. Graphic objects that can be rotated to contain straight lines, circles, rectangles, graphics system library, controls, a combination of graphics, and polygons.

Ø Free rotation

Free rotation allows the designer to rotate the graph around any fixed point by 0 to 360 ° C after selecting the graphic object. The rotation method is as follows:

1. Select one or more graphic objects on the screen, then click the "Free Rotation" command in the Rotate item in the Edit menu or click the Free Rotation button in the tool button [image] , or bring up the right-click menu, and then click this command.

2. At this point it appears a straight line with small green dots on the two ends in the selected graphic object; the smaller round green dot is the center of rotation. Move the mouse to the center of rotation, and then the mouse cursor will turn into [image] ; Hold down the left mouse key, drag it to the right location, and release the left mouse button.

3. Move the mouse to the larger dot, then the mouse cursor will turn into [image] ; Hold down the left mouse key and drag it to the right location to complete the rotation. If drag it When the mouse is moved, if the mouse moves clockwise, the selected graphic object rotates clockwise around the fixed point; if the mouse moves counterclockwise, the selected graphic object rotates counterclockwise around the fixed point.

The steps of free rotation are as follows: Figure 4-11:

图4-11 自由旋转步骤

Ø Flip Horizontal

“Flip horizontal” allows engineers to rotate the graphic object (may be a plurality of graphic objects) at 180°by the axis of vertical center in the horizontal plane after selecting. First select one or more graphical objects, then click “Flip Horizontal” in the Edit menu "Mirror" or click the Flip Horizontal button [image] in the Tool bar.

When a single graphic object is selected, as shown in Figure 4-12:

Figure 4-12 Contrast before and after Flip Horizontal of single graph object

图4-12 单个图像水平翻转前后对照

When a plurality of graphic objects are selected, as shown in Figure 4-13:

Figure 4-13 Contrast before and after Flip Horizontal of several graph objects

Ø Flip Vertical

“Flip Vertical” allow engineers to rotate the graphic object (may be a plurality of graphic objects) at 180°by the axis of horizontal center in the vertical plane after selecting. First select one or more graphical objects, then click “Flip Vertical” [image] in the Edit menu "Mirror" or click the Flip Vertical button in the Tool bar

When a single graphic object is selected, as shown in Figure 4-14:

Figure 4-14 Contrast before and after Flip Vertical of single graph object

When a plurality of graphic objects are selected, as shown in Figure 4-15:

Figure 4-15 Contrast before and after Flip Vertical of several graph objects

All dynamic display controls and that with text do not support the function of rotation.


SamDraw对齐

Align

This command is by group. SamDraw configuration software allows engineers to operate alignment and size operation on multiple graphical objects, but only when multiple graphic objects are selected. Users can hold down the key Ctrl to select the graphic objects to be aligned, or hold down the left mouse button and drag to delineate them. Alignment operations include a large number of editing commands: Left, Right, Vertical Center, Horizontal Center, Top, Bottom, Horizontal Equal Interval and Vertical Equal Interval, Make same width, Make same height, Make same height and width, etc.

Ø Top

The command of Top Alignment allows engineering designers to top justify multiple graphic objects (no less than two graphical objects) through clicking “Top” 说明: 22 of the Alignment in the Edit menu or through the context menu. These graphic objects will take the highest edge of graphic objects as a reference, and then make them at the same level. Comparison diagram of Top Alignment is shown in Figure 4-16:

Figure 4-16 Comparison diagram of Top Alignment

Ø Bottom

The command of Bottom Alignment allows engineering designers to bottom justify multiple graphic objects (no less than two graphical objects) through clicking “Bottom” of the Alignment in the Edit menu or through the context menu. These graphic objects will take the lowest edge of graphic objects as a reference, and then make them at the same level.

Comparison diagram of Bottom Alignment is shown in Figure 4-17:

Figure 4-17 Comparison diagram of Bottom Alignment

Ø Vertical Center

The command of Vertical center allows engineering designers to make centers of graphical objects in the same vertical line (no less than two graphical objects) through clicking “Vertical center” 说明: 21 of the Alignment in the Edit menu or through the context menu. This vertical line is the vertical centerline of the leftmost and rightmost edges.

Comparison diagram of Vertical Center Alignment is shown in Figure 4-18:

Figure 4-18 Comparison diagram of Vertical Center Alignment

Ø Left

The command of Left Alignment allows engineering designers to left justify multiple graphic objects (no less than two graphical objects) through clicking “left” 说明: 19 of the Alignment in the Edit menu or through the context menu. These graphic objects will take the leftmost edge of graphic objects as a reference, and then make the left sides of each graphic object along the same vertical line.

Comparison diagram of Left Alignment is shown in Figure 4-19:

Figure 4-19 Comparison diagram of Left Alignment

Ø Right

The command of Right Alignment allows engineering designers to right justify multiple graphic objects (no less than two graphical objects) through clicking “Right” of the Alignment in the Edit menu or through the context menu. These graphic objects will take the rightmost edge of graphic objects as a reference, and then make the right sides of each graphic object along the same vertical line.

Comparison diagram of Right Alignment is shown in Figure 4-20:

Figure 4-20 Comparison diagram of Right Alignment

Ø Make same width

This command allows engineering designers to make multiple graphic objects (no less than two graphical objects) have the same width through clicking “Make same width” of the Size in the Edit menu or through the context menu. These graphical objects will be reduced or enlarged by the upper left point while the height remains unchanged, so that the width of each graphic object is in accordance with what has been selected before (surrounded by black points while others by green points).

Comparison diagram of Make same width is shown in Figure 4-21:

Figure 4-21 Comparison diagram of Make same width

Ø Make same height

This command allows engineering designers to make multiple graphic objects (no less than two graphical objects) have the same height through clicking “Make same height” of the Size in the Edit menu or through the context menu. These graphical objects will be reduced or enlarged by the upper left point while the width remains unchanged, so that the height of each graphic object is in accordance with what has been selected before (surrounded by black points while others by green points).

Comparison diagram of Make same height is shown in Figure 4-22:

Figure 4-22 Comparison diagram of Make same height

Ø Make same height and width

This command allows engineering designers to make multiple graphic objects (no less than two graphical objects) have the same height and width through clicking “Make same height and width” of the Size in the Edit menu or through the context menu. These graphical objects will be reduced or enlarged by the upper left point, so that the height and width of each graphic object is in accordance with what has been selected before (surrounded by black points while others by green points).

Before and after comparison diagram of Make same height and width is shown in Figure 4-23:

Figure 4-23 Comparison diagram of Make same height and width

Ø Horizontal Equal Interval

This command allows engineering designers to make multiple graphic objects (no less than two graphical objects) have the equal interval horizontally through clicking “Horizontal Equal Interval” [image] of the Alignment in the Edit menu or through the context menu.

Ø Vertical Equal Interval

This command allows engineering designers to make multiple graphic objects (no less than two graphical objects) have the equal interval vertically through clicking “Vertical Equal Interval” [image] of the Alignment in the Edit menu or through the context menu.

Before executing commands of Make same width, same height, same width and height, please make sure whether the selected objects have been rotated. The height and width of rotated object also rotate with itself.


SamDraw绘制基本图形

Draw basic graphs

l Line

l Polyline

l Curve/Arc

l Straight Link Line

l Curve Link Line

l Rectangle

l Circle/Ellipse

l Polygon

l Text

l Table

l Scale

l Open Gallery

l Save to Gallery


SamDraw直线

Line

Select the “Line” command in Draw menu or left click the line button [image] in the toolbar; move the mouse in the screen editing window, and it will become a cross; click on the mouse in the view (i.e. screen), then a line is added, as shown in Figure 4-26:

图4-26 直线操作

After the above steps, the transparency of the line, the line type, width, color, the arrow and shape of end will be set by default while engineers can modify these properties in order to meet the needs of projects. Double click over a straight line, or click on the Property button [image] in the toolbar after selecting it. Line Property dialog box will pop up, as shown in Figure 4-27:

Figure 4-27 Line Property dialog box

Ø SamDraw configuration software provides up to 15 straight line types, 10 kinds of line width, and 6 straight-line end arrows, with the ability to adjust the properties using the pull-down and trimming buttons. To change the length, direction, and position of the line, select the line first, then move the mouse to the end of the line; after that hold the left button of the mouse [image] , and drag the mouse to the right position to release the left button.


SamDraw折线

Polyline

Select the Polyline command [image] in the Draw menu or click the Polyline command button in the toolbar to move the mouse to the Edit window. The mouse cursor will turn into a cross. That’s when you can draw a polyline in the Edit window.

Ø Move the mouse to a position where you want to draw the polyline. Click the left mouse button once, and then a small green dot appears in the screen editing window, which is an endpoint of the polyline.

Ø Move the mouse to other positions in the screen, the system will automatically draw a straight line; move the mouse to change the direction; left click once and the place where you click will appear a small green box. Here the line from the first endpoint to the first small green rectangle will not move with the mouse. The mouse can be moved to the next point to change the direction of the polyline, just click the left mouse button. When it needs to complete the polyline, just right click, as shown in Figure 4-28:

Figure 4-28 Polyline Operation

Ø After the above steps, the transparency, line type, line width, line color, end arrow and end point shape of the polyline will be set by default. The engineer can modify these attributes to meet the needs of the project. Move the cursor to the polyline; double-click the left button, or first select the line, and then click the toolbar property button [image] , a dialog box same as that of Line Property will pop up.

You can adjust the properties of the polyline using the pull-down and fine-tune buttons. The SKTOOL configuration software provides up to 6 straight line types, 30 kinds of line width, and 6 types of end arrow for polylines. To change the length, direction and position, select the line first, and then move the mouse to the polyline; hold down the left button of the mouse [image] , after, drag the mouse to the appropriate location to release the left button.


SamDraw曲线/圆弧

Curve/Arc

Select the Curve / Arc command in the Draw menu or click the Curve / Arc command button [image] in the toolbar menu; move the mouse to the Edit window, then the mouse cursor will change to a cross, by now you can draw a curve / arc in the Edit Window.

Ø Move the mouse to a position where you want to curve. Left click and a small green dot appears in the window. This position is the start position of the curve / arc.

Ø Move the mouse to other position in the screen, then the system will automatically draw a straight line; after click the left mouse button and release.

Ø At this time, the mouse cursor is still cross-shaped. Move the mouse to other position in the screen, which is the end of the curve / arc. Hold down the left button does and move the mouse in the screen to draw the arc; release the mouse and right click to end the operation. As shown in Figure 4-29:

Figure4-29 Curve Operation

Ø As shown above, the starting point of the graph is a green dot, and the end point is a diamond dot, here the initial curve / arc has been drawn. Move the mouse to the point and the cursor becomes the shape of [image] ; hold down the left mouse button, move the mouse to the appropriate location, and then release the mouse to draw the required curve. You can also move the start or end point to the appropriate position. As shown in Figure 4-30:

Figure4-30 Curve Operation

Ø After completing the above steps, the transparency, line type, line width, line color, end point and endpoint shape of the curve / arc will be set by the system default. The engineer can modify these attributes to meet the requirement of engineering. Move the mouse to the curve / arc; double-click the left button, or select the curve / arc first, and then click the toolbar property button [image] , a dialog box same as that of Line Property will pop up.

You can adjust the curve / arc properties through the pull-down and trimming buttons. The SamDraw configuration software provides up to 15 line types, 10 kinds of line widths, and 6 straight-line end arrows for curves / arcs.


SamDraw直线连接线

Straight Link Line

Select the right toolbar under the basic control of the straight line command button [image] , move the mouse to the screen editing window and it will turn into a cross, so that you can draw a link line in the screen editing window.

Ø Move the mouse to the point to be linked, click the left mouse button, and then it will appear a small green dot in the screen editor window, which is the starting position of the straight line.

Ø Move the mouse to other locations in the screen, and the system will automatically draw a straight connecting line, and then click the left mouse button or right button to complete the drawing of the straight line. As shown in Figure 4-32:

Figure 4-32 Polyline operation

Ø In order to change the right angle position of the straight line, you can select the straight link line first (mouse cursor turns into 说明: 20090522102318339 when it needs to move the horizontal line while turn into 说明: 20090522102238822 when it comes to vertical line. Hold down the left mouse button and drag it to the appropriate location; release it to complete the operation. As shown in Figure 4-33:

Figure 4-33 Modify the polyline operation

Ø After finishing the above steps, the transparency, type, width, line color, end arrow, and endpoint shape of the line will be set by default. Move the cursor to the link line, double click the left button or first select the free curve, and then click the toolbar properties button, a properties dialog box [image] same with that of straight line will pop up.

The pull-down and trimming buttons allow you to adjust the properties of the free curve. SamDraw configuration screen editing software provides up to 15 straight line types, 10 line widths, and 6 end arrows.


SamDraw曲线连接线

Curve Link Line

Click the “Curve link line” command button [image] under the basic control of toolbar; the mouse cursor will turn into a cross when moved to the screen editing window, so that you can draw a curve link line in the screen editing window.

Ø Move the mouse to a position where you want to connect the curve; click the left mouse button, a small green dot appears in the picture editing window, which is the starting position of the curve connecting line.

Ø Move the mouse to elsewhere, and then the system will automatically draw a straight line; left click and release the left mouse button.

Ø At this point the mouse cursor is still a cross, move the mouse to elsewhere on the screen, where is the end of the curve / arc; hold down the left mouse button and move the mouse within the screen, then release it. At this time, the mouse is still a cross-type. Repeat the above operation to draw a curve link line. Right click to complete the operation. As shown in Figure 4-34:

Ø As shown above, the starting point of the drawing is a green dot, the end point is a diamond dot and the middle node is a square green dot. Here is an initial curve link line. Move the mouse to one point, and then it appears a dotted line whose endpoint is a square dot. Move the mouse to that point, and the cursor turns into the [image] shape; hold down the left button, drag it to a certain position, and then release to draw the required curvature. You can also move the start or end point to the appropriate position.

Ø After finishing the above steps, the transparency, line type, line width, line color, end arrow and end point shape of the curve link line will be set by default. The engineer can modify these attributes to meet the needs of the project. Double click the left button on the curve link line or select the attribute button [image] in the toolbar; it will pop up a dialog box window same with that of the line properties.

The pull-down and trimming buttons allow you to adjust the properties of a curve link line. SamDraw configuration screen editing software provides up to 15 types of straight line, 10 line widths, and 6 straight-line end arrows for the curve link line.


SamDraw矩形

Rectangle

Select the Rectangle command in the Draw menu or click the Rectangle command button [image] in the toolbar button.

Ø Move the mouse to the Edit window and then the cursor will change to a cross; click on the screen to add a rectangle.

As shown in Figure 4-35:

Ø To change the size of the rectangle, select the rectangle first, and then move the mouse to the eight square green dots which appear in the rectangle. When the mouse cursor becomes or 说明: 20090522102318339 or 说明: 20090522103113602111111111 , click and hold down the left mouse button to drag the rectangle; release the left mouse button when it reaches the appropriate location. By now a required rectangular box is drawn.

说明: 20090522102238822 ：Change the width of the rectangle

说明: 20090522102318339 ：Change the height of the rectangle

说明: 20090522103113602111111111 ：Change the width and height of the rectangle

Ø After the above steps, the transparency, line type, line width, line color and fill pattern of the rectangle will be set by the system default. The engineer can modify these properties to meet the needs of the project. Move the mouse to the rectangle, double click the left button; or select the rectangle first, and then click the Property button [image] in the toolbar. The properties of the rectangle will pop up, as shown in Figure 4-36:

Figure 4-36 Rectangle properties dialog box

Ø You can adjust the properties of the rectangle through the pull-down and fine-tune buttons. SKTOOL configuration software provides up to 15 types of borderline, 10 kinds of borderline width and 21 kinds of fill patterns. As shown in Figure 4-37:

Figure 4-37 An example of a rectangle drawn


SamDraw椭圆/圆

Circle/Ellipse

Select the Circle/Ellipse command in the Draw menu or left-click the Circle/Ellipse command button [image] in the toolbar.

Ø Move the mouse to the screen editing window, and the mouse cursor will become a cross; click the left mouse button on the screen to add a circle to the screen.

As shown in Figure 4-38:

Ø To change the size of an ellipse / circle, select the Circle/Ellipse first, then move the mouse to the 8 square green dots that appear in the ellipse / circle. When the mouse cursor becomes 说明: 20090522102318339 or 说明: 20090522103113602111111111 or 说明: 20090522102238822 , click and hold down the left mouse button to an appropriate location; release the left button to complete drawing.

说明: 20090522102238822 ：Change the width of the ellipse / circle

说明: 20090522102318339 ：Change the height of the ellipse / circle

说明: 20090522103113602111111111 ：Change the width and height of the ellipse / circle

Ø After the above steps, the transparency, line type, line width, line color, and fill pattern of the ellipse / circle will be set by default. The engineer can modify these attributes to meet the needs of the project. Move the cursor to the ellipse / circle, double click the left button; or select the Circle/Ellipse first, and then click the Property button [image] in the toolbar, here a dialog box will pop up.

Ø SamDraw software provides up to 15 types of border line, 10 kinds of border line width and 21 of fill patterns for ellipse / circle. As shown in Figure 4-39:

Figure4-39 Circle/Ellipse


SamDraw多边形

Polygon

Select the Polygon command in the Draw menu or click the Polygon command button [image] in the toolbar. Move the mouse to the editing window. The mouse will change to a cross, by now you can draw a polygon in the screen.

Ø Move the mouse to a position where you want to draw a polygon, left click (or hold down the left button), then a small green dot will appear in the screen editing window, which is the start point of the polygon.

Ø Move the mouse to another position on the screen. At this time, the system will draw a straight line automatically. Move the mouse to other appropriate positions; each time you left click, a new side of polygon is drawn; right click to complete drawing. As shown in Figure 4-40:

Figure 4-40 Polygon Operation

Ø To re-shape a polygon, click it first and it will appear several green dots (depending on the number of sides of the polygon), indicating that the polygon has been selected; and then move the mouse cursor over one of them, then it will become the shape [image] ; left click and drag it to the position you prefer, so that you can change the length and location of two lines connected by this turning point. Release the left button to complete.

Ø After the above steps, the transparency, line type, line width, line color and fill pattern of the polygon will be set by the system default. The engineer can modify these attributes to meet the needs of the project. Move the mouse over the polygon, double click the left mouse button; or select the polygon first, and then click the Property button [image] in the toolbar, and a dialog box same as that of the rectangle will pop up.

Ø You can adjust the properties of polygon through the pull-down and fine-tuning buttons. SKTOOL configuration software provides up to 15 types of border line, 10 kinds of border line width and 21 kinds of fill patterns for the polygon. As shown in Figure 4-41:

Figure 4-41 Polygon


SamDraw绘制文本图形

Text

Select the Text command [image] in the Draw menu or left-click the Text command button in the toolbar to bring up the Static Text dialog box, as shown in Figure 4-42:

Figure 4-42 Static Text dialog box

Ø Input the text to be displayed in TEXT in the dialog box above.

Ø The size of the font to be displayed can be changed in the drop-down menu of Font Size. SamDraw configuration software provides the font size of 7-56 pound.

Ø Engineering designers can change the types of fonts to be displayed in the drop-down menu of Font. SamDraw configuration software provides almost all font styles. Language: For different languages, you can enter different text contents in the text box, different font and font size are also available.

图4-43 文本效果测试

Ø In the dialog box, click the left button before the Bold and Italic box to change the fond.

Ø The configuration software provides kerning and line spacing that vary from 0-15 through the fine-tuning button next to the kerning and line spacing

Ø SamDraw configuration software also provides up to 16 kinds of underline form, and can change the display position of text contents in the text box; you can also change the fill pattern and transparency. As shown in Figure 4-44:

图4-44 文本效果图

Ø When the font property is modified, click OK to close the dialog box. Move the mouse [image] to where you want to place the text in the editing window; left click the left mouse button, and the system will draw a rectangle automatically.

Ø To modify or re-input the text contents, double-click the text unit with the left mouse button, then re-enter the contents through the keyboard. You can use the Enter to change line feed when using the keyboard.

Ø To change the size of the text background box, select the text unit, and then move the mouse to its edge; when the mouse becomes 说明: 20090522102318339 or [image] or [image] , click and hold down the left mouse button to pull the text box to the appropriate location; after that release the left mouse button to complete the operation.

: Change the width of the text unit background

说明: 20090522102318339 ：Change the height of the text unit background

说明: 20090522103113602111111111 ：Change the width and height of the text unit


SamDraw绘制表格图形

Table

Select the Table command [image] in the Draw menu or the left click the command button in the toolbar, then it will appear a pop-up table dialog box, as shown in Figure 4-45:

Figure 4-45 Table dialog box

Ø In the above dialog box of the above diagram, SamDraw configuration software provides choices of the Background Color, Border, Grid and Grid lines. You can decide whether to display vertical or horizontal grid lines in the Grid option, and the type and color of lines are changeable.

Ø When the font property is modified, click OK to close the dialog box. Move the mouse [image] to where you want to place the table in the editing window; left click the left mouse button, and the system will draw a rectangle automatically. Left click after moving it to an appropriate place, as shown in Figure 4-46:

The table is just a graphic object, which means you cannot add text, data or other embedded objects to the table. The table can only be displayed as a chassis image. To display text, data, and other objects on a table, you can use Text and numeric display objects to overlay the table and set it to the top layer.


SamDraw绘制刻度图像

Scale

Select the Table command [image] in the Draw menu or the left click mouse the command button in the toolbar, then it will appear a pop-up scale dialog box, as shown in Figure 4-47:

Figure 4-47 Scale Dialog Box

Ø In the above dialog box, SamDraw configuration software provides choices of Color, Axis and Text. The color item allows to selecting the line color and text color. You can select whether to display the axes in the Axis item and decide the number of the major scale and sub scale by means of the trimming button or inputting directly. Decide whether to display text in the text item and change the maximum and minimum values of the scale, as well as the size of the text and the decimal digits of the scale value.

Ø When you have modified the scale property and click OK to close the dialog box, move the mouse [image] to the position where you want to display the scale. Click the left mouse button, and then the system will automatically draw a scale unit. As shown in Figure 4-48:

Figure 4-48 Scale effect diagram

Ø After the above steps, a scale like first from left of the figure above. If you want to change it to the form of the second left scale in the figure above, first choose the scale, move the mouse to one of the height sides, press down the left key and drag the mouse when the mouse becomes [image] , and have the mouse pass through the other height side. To change the scale to the right forms in the figure above, perform Free Rotation for it.


SamDraw打开图库

Open Gallery

Select the Open Library command in the Draw menu or click the Open Library command button [image] in the toolbar to bring up the Library List dialog box, as shown in Figure 4-49:

Figure 4-49 Library List

Ø The system library of SamDraw configuration editing software provides a wealth of graphic objects for engineering designers. SamDraw version is even added a large number of buttons, indicators and other graphic objects. Engineering designers can find a proper graphic object so as to save configuration design time.

Ø Engineers only need to click on the category of the desired graphic object in the system library on the left. Click the + sign to open the sub-category, and then select the needed graphic. Click to select the image, and then click on the screen to add graphic object when the cursor become a cross.

Click OK to close the dialog box. Move the mouse [image] to where you want to place the object in the editing window; left click the left mouse button, and the system will draw a rectangle automatically. Left click after moving it to an appropriate place, then operation of Open gallery is completed.


SamDraw生产图库

Save to Gallery

Select the Save to Library command in the Draw menu or click the Save to Library command button [image] in the toolbar to bring up the Library List dialog box, as shown in Figure 4-50:

Figure 4-50 Save to Library dialog

Ø SamDraw configuration editing software can save the completed configuration screen for engineering designers in order facilitate the next operation. After clicking Save to Library, as shown in the figure above, the graph object in the current screen will be displayed in the white area in the middle of the dialog box.

Ø Click “Save to…”, then the dialog box as below pops up,

Figure 4-51 Save path dialog box

Choose a save path in the selection box on the left. SamDraw configuration editing software provides 8 custom control library and 8 custom graphics library eight, select the saved path, then click the bottom of the "Save" to save the graphics Object, the saved graphic object is displayed in the white area on the right. Then click the OK button to complete the operation.


SamDraw基本控件

SamDraw basic controls

l Bit Button

l Word Button

l Screen Button

l Function Button

l Bit Indicator Lamp

l Multi-state Indicator Lamp

l Multi-state Button

l Numeric Display

l Numeric Input

l ASC Display

l ASC Input

l Bar Chart

l Time Display

l Date Display

l Week Display

l Static Picture

l Picture Display


SamDraw综述

Bit Button
说明: 说明: logo.gif

Bit button is used to operate and display the ON/OFF status or 1/0 status of the bit address of the device connected with the touch screen. Bit button is the most fundamental and frequently used control.

Steps to set a Bit button:

1. Click the Bit Button icon 说明: 说明: 019.jpg on the toolbar to bring up a dialog box, which is for setting the properties of Bit Button, as shown in Figure 4-52:

Figure 4-52 Bit Button dialog box

2. The dialog box includes four items, that is, General, Label, Advanced and Permission.

Ø General

Shape: Click the Shape button to select a shape for the control graph, as shown in Figure 4-53

Figure 4-53 Pop-up dialog box of Shape

Border Color: When having chosen a shape with border, click this button to select a different color for the border.

说明: 说明: 边框色

Foreground Color: When it needs to change the foreground color, click this button to choose a different foreground color on the drop-down color selection box. (Foreground color works only if the transition style is selected).

Background Color: When it needs to change the background color, click the button to select on the drop-down color selection box.

Pattern: Click the drop-down box, which contains a total of 21 kinds of patterns as shown in Figure 4-54:

图 4-54 改变外形和各项颜色值

Functions:

Set: If Set function is chosen, after the downloading to HMI, the value of the write-in address may be set to 1 by clicking the bit button. In other words, the write-in address of the device connected will be set to ON status, and the status of 1/ON will be displayed.

Reset: If Reset function is chosen, after downloading to HMI, the value of the write-in address may be set to 0 by clicking the bit button. In other words, the write-in address of the device connected will be set to OFF status, and the status of 0/OFF will be displayed.

Inching: If Inching function is chosen, either “pressing down being 1” or “pressing down being 0” may be chosen. When “pressing down being 1” is chosen, after downloading to HMI, the value of the write-in address of the device connected is set to 1/ON when the bit button is pressed down, and the status of 1/ON will be displayed; meanwhile, the value of the write-in address of the device connected is set to 0/OFF when the bit button is released, and the status of 0/OFF will be displayed. When “pressing down being 0” is chosen, after download to HMI, the value of the write-in address of the device connected is set to 0/OFF when the bit button is pressed down, and the status of 0/OFF will be displayed; Meanwhile, the value of the write-in address of the device connected is set to 1/ON when the bit button is released, and the status of 1/ON will be displayed.

Alternate: When Alternate function is chosen, after the downloading to HMI, if the current status of the bit button is 0/OFF, the value of the write-in address will be set to 1/ON when the bit button is touched, and the status of 1/ON will be displayed; If the current status of the bit button is 1/ON, the value of the write-in address will be set to 0/OFF when the bit button is touched, and the status of 0/OFF will be displayed. The status changes with the times of touching.

Write Address: Click the Keyboard button icon after "Write Address" to enter the address. SKTOOL software will distribute corresponding address symbols according to different connected devices. For example, in FX-2N series of MITSUBISHI (Mitsubishi) PLC, X represents the address of input coil; Y represents that of the output coil; M that of the intermediate relay; C that of the counter (switch status display); T that of the timer (switch Status display); D that of the data register; C * that of the counter (count value); T * represents that of the timer (count value). Another example is the series of SIEMENS (Siemens) S7-200: I represents the input address; Q on behalf of the output address; M on behalf of the intermediate relay address; V on behalf of the data register address. As shown in Figure 4-55:

So that engineers can write the current status of this bit button to the address using a different address symbol for PLC or other connected devices. The value of the write address or display address is 0 / OFF when the bit button is in the 0 / OFF state; and the value of the write or display address is 1 / ON when the control is in the state of 1 / ON.

Monitor: Select "Monitor" to display the "Monitor Address”, indicating that the "bit button" can be used to monitor the value change of "Monitor Address". The value of the Monitor address is 0 / OFF when the bit button is in the 0 / OFF state; and the value of the Monitor address is 1 / ON when the control is in the state of 1 / ON. When "Monitor Address" is chosen, the monitor address and write address can be different. For example, when it selects the Set function, touching this control makes set the write address to 1 / ON; but if the monitor address is at 0 / OFF at this time, the bit button will still display 0 / OFF state. Generally, users choose "Monitor address identical to Write address" in order to reflect or display directly the state value you write.

Macro: Chosen "Use Macro", then it will display a list of macros. User can select a macro to execute when press the bit button. Only compiled macros are displayed in the drop-down list.

When Monitor isn’t chosen, the button switch state will not change even if the control is touched.

Ø Label

When select the Label tab, the property of Status 0 Text is displayed, as shown in Figure 4-56:

Figure 4-56 Bit Button Label page

The page also has four items, "Status 0 Text", "Status 1 Text", "Status 0 Picture" and "Status 1 Picture".

Status 0 Text, Status 1 Text: Used to change the font, font size, margin, font color, and position of the state 0 or state 1 text. SamDraw also provides the copying function enabling copy one’s attributes to another’s, which is convenient and timesaving.

Status 0 Picture, Status 1 Picture: You can add picture of different formats for different states according to various "Picture source". When a picture is chosen, it will be automatically added to the "General" page. If “Fit to Object Size” is selected, the selected image will be the same size as the control.

When “Blink” is chosen, the flashing screen is on the ON / OFF status. The default flashing frequency is 1s. If you want to change the frequency, you can double click the "Project Manager" in the "HMI parameter settings". Select the "Flicker frequency" to change it.

Ø Select the "Advanced" page to display the "Advanced" properties, as shown in Figure 4-57

Figure 4-57 Bit Button Advanced page

Controlled by Bit: "Controlled by Bit" having been chosen, when the "Valid Status" selected is 1, the "Bit Button" can be effectively touched if and only if the value of the "Control Bit" is 1. When the selected "Valid Status" is 0, the "Bit Button" can only be effective if and only if the value of the "Control Bit" is set to 0. Otherwise, the "Bit Button" cannot function no matter how.

Controlled by User Level: if choosing “Controlled by User Level” and selecting an “Effective lowest level”, the current user is checked whether this user lever has the permission to active Bit button.

The default user level is Level 1, which is the lowest level. Engineering designers can change it by selecting the "Change User Level" function in the function button and entering the corresponding password.

Effective touch means actual effect generates when the control is touched, such as the success of the set, reset, inching, and alternation. Another example is the numeric input. When user touches the numeric input button, the keyboard will pop up. Meanwhile the numeric input button will not generate a notification effect, since this operation is not written to the address. If you press ESC to exit the keyboard will not produce notice. It is valid only when you enter a numeric value between the maximum and minimum values on the keyboard and press the ENTER key, and then a notification will arise.

Notification:

When this option is selected, it will write the selected status value (1 or 0) to the notify address, which means set or reset.

Enter the "Visibility" page to display the "Visibility" property, which is used to decide whether the control is displayed or hidden. As shown in Figure 4-58:

Figure 4-58 Bit Button Visibility page

Controlled by bit: When this option is checked, if the Effective State is 1, then the Bit Button can be displayed on the touch screen when and only when the value of the Control Bit is 1; If the Effective State is 0, then the Bit Button can be displayed on the touch screen when and only when the value of the Control Bit is 0.

Controlled by User Level: When User Level Controlled is chosen, the conditions will be the same as those in the User Level Controlled option in Advanced page, and only when such conditions are met the Bit Button can be displayed on the touch screen.

If neither of these two options is checked, the control will be always displayed on the touch screen.

Ø After setting of the properties, click OK button, and then the mouse shape will become [image] . Now you can draw a rectangle in the screen by clicking the mouse and thus add this control into the screen.


SamDraw综述

Word Button

Word Button can support operations of Constant, Enter Value, Increasing, Decreasing, Enter Password, Add and Subtract to the data register address of connected device.

To add a word button:

Select the Word Button icon [image] on the toolbar, then he following dialog box is displayed, as shown in Figure 4-59:

Figure 4-59 Word Button dialog box

The shape, border color, foreground color, background color and pattern can be set with reference to "Bit Button" control.

Function module:

Set constant: You can choose different data types, SamDraw software provides a variety of data types: 16/32-bit positive integer, 16/32-bit integer, 16/32-bit BCD positive integer and 32-bit floating point number. Setting a constant is to write the constant value you set to the write address. For example, if the write address is LW1 and the constant is set to 10, the value of LW1 is set to 10 every time the button is touched, regardless of its current value.

Enter value: You can select a different data type; input a value between the maximum and minimum with a keyboard popping up after the word button being touched. As shown in Figure 4-60:

Total number of digits: Number of data including that of decimal points.

Decimal digits: When the data type is not "32-bit floating point" and there are decimal digits, then the maximum value of the input value should be reduced to 10 nth powers. For example: When the selected data type is "32-bit positive integer", and the number of digits is 3, so the user can only enter the value of 0-99999.999.

Enter Password: Same as the "Enter Value" except that the "Enter Password" has no option of decimal digits.

Add: After choosing the data type, writing the address, constant and maximum value, every time you touch the "word button" control, the set value corresponding to the register value will plus the constant value based on the original value. Each time when the button is clicked, the value written to the address is incremented by a constant; however the value written to the address cannot exceed the maximum value you set. For example, the write address is LW1, the constant is 5, and the maximum value is 65535. Each time you click the Word Button control, the value of LW1 is added to the original value by 5, but the maximum value of LW1 cannot exceed 65535.

Subtract: After choosing the data type, writing the address, constant and minimum value, every time you touch the "word button" control, the set value corresponding to the register value will minus the constant value based on the original value. Each time when the button is clicked, the value written to the address is decremented by a constant; however the value written to the address cannot be less than the maximum value you set. For example, the write address is LW1, the constant is 5, and the minimum value is 0. Each time you click the Word Button control, the value of LW1 is subtracted from the original value by 5, but the value of LW1 cannot be less than 0.

The "Label" tab of the "Word Button" is similar to that of the "Bit Button" control, apart from that the Word button has no Status Text 1 neither Status Picture 1, because the Word Button has only one state.

If select the 32-bit data type for Word button, the address will occupy the length of two words. For example, write V10 to SIEMENS (Siemens) PLC data register, then the occupied data register address includes V10 and V11. If user still employs other control to monitor V11 value, it will fail to work. Pay attention to the application of 32-bit data type in case of error.

The Advanced and Permission pages of the Word Button are the same as that of the Bit Button control. You can refer to the Bit Button control and refer to Bit Switch for the use of hotkey.


SamDraw画面按钮

Screen Button
说明: 说明: logo.gif

Screen button is designed for screen switching, changing the user level, pop-up window and other operations. After being set, it can make a screen/ window jump to a certain screen / window while you can also decide whether to change the user level at the same time.

Ø Click the icon button 说明: 说明: 021.jpg on the toolbar to bring up the dialog box , as shown in Figure 4-61:

Figure 4-61 Screen Button Dialog Box

Shape, border color, foreground color, background color and pattern settings can be used with reference to "Bit Button".

Function modules:

Open Screen: It allows users to jump to the selected screen by clicking the button. This function can be employed on a screen or in a window.

Open Previous Screen: It allows users to jump to the previous screen of this page by clicking the button. This function can only be used in the screen page.

Close and Open Screen: This function can only be used in the window page. It allows closing the current window and opening another window or screen.

Close Screen: This function can only be used in the window page. This function allows closing the current window page.

Switch user level: This function enables changing user level when switching screens.

Login is required if level is insufficient:

If the user has selected the " Controlled by User Level" option on the "Advanced" page of the "Screen Button" dialog box, and has changed the "Effective Lowest Level", then the screen control is only valid if the current user level is higher than or equal to the user- If the current user level is less than the effective minimum level set by the user, the password input box will pop up when the user touches the screen control on the touch screen, as shown in Figure 4-62:

Figure 4-62 Password input keyboard

This screen can only be opened when the password entered by the user is higher than that set by the user, and the current user level is decided by the level password just entered by the user.

Macros:

"Open macros" displays a list of macros. The user can select one to execute when press the button. Only compiled macros can be displayed in the drop-down list.

The "Label" page of the Screen Button is similar to that of the "Bit Button" control. Because the Screen Button has only one state, its Label page only has Status 1 Text and Status 1 Picture. Apart from that, the functions are the same.

The "Advanced" and "Permission" pages of the "Screen Buttons" are the same as those of the "Bit Button" control, which can be used with reference to the Bit Button.

After setting all the properties, click "OK" and the mouse cursor will turn into [image] . Left click in the view area to add the control to the screen.


SamDraw多功能按钮

Function Button

Function Button is an essential control in HMI; with the Function button you can achieve a variety of functions easily and quickly. Click [image] to open the property dialog box of Function Button, as shown in Figure 4-63:

Figure 4-63 Function Button dialog box

Refer to Bit Button control for Shape, Border color, Foreground color, Background color and Pattern.

1. Turn off Background light

Choose the function of Turn off the background light. Then click the button on the screen to turn off it while HMI will still works properly. To turn on the backlight, simply touch anywhere on the touch screen.

2. Confirm Alarm

This function is unavailable now.

3. Restart

If the function button is set to System Restart, then the touch screen will be restarted by touching this button.

4. Set screen saver timeout

If the function button is set to Set Screen Saver Timeout, then a window will pop up for setting of screen saver timeout after touching this button.

5. Write recipe to the PLC

Choose this function to transmit recipe to the PLC. Click this button on the touch screen to transmit the recipe saved in the current HMI to the PLC or corresponding continuous data register of other connected devices. (The address is the write address set by engineers when set up a recipe with the software.)

6. Read recipe from the PLC

Choose this function to read recipe from the PLC. Click this button on the touch screen to read the recipe data from the PLC or corresponding continuous data register of other connected devices. (The address is the write address set by engineers when set up a recipe with the software.)

7. Set the date and time

Choose this function to set the time and date; click the button on the touch screen to set the inner time and date.

8. Clear Alarm

Choose this function to clear the alarm; click the button on the touch screen to clear the selected and confirmed alarm.

9. Previous recipe

Choose this function of the Previous Recipe to open the previous recipe of the current one after clicking this button. If the current recipe is the first one or the total number of recipe is 1, this operation does not change recipe parameters.

10. The latter recipe

Choose this function of the Latter Recipe to open the latter recipe of the current one after clicking this button. If the current recipe is the last one or the total number of recipe is 1, this operation does not change recipe parameters.

11. Save the current recipe

Choose this function for saving the current recipe by clicking the button on the touch screen to save the recipe data from corresponding continuous data register of the PLC or other connected device, which is set when engineers set up the recipe with the software.

12. Alarm Up

Choose this function to move up the selected alarm content by one in order to display specific alarm content.

13. Alarm Down

Choose this function to move down the selected alarm content by one in order to display specific alarm content.

14. Alarm Page Down

Choose this function to realize page down in order to display specific alarm content.

15. Alarm Page Up

Choose this function to realize page up in order to display specific alarm content.

16. Coordinate adjustment

Set the “Coordinate adjustment” for function button, and then it is available to enter the coordinate fine-tuning interface by clicking the button on the touch screen in order to adjust the coordinates. Method of adjusting the coordinates: Enter the fine-tuning interface and the screen will be display three icons "+"; touching on the center of "+" will automatically adjust the coordinates and restart.

17. System parameters

Set the system parameter of the function button. Click it on HMI to open the system parameter setting screen where you can modify settings, such as system time, screen saver time, background light contrast and so on.

18. Change User Level

Set the function button function to change the user level, so that it is available to change the current user's access permission by clicking the button on the touch panel.

19. Cancel user login

Choose the function of cancel a user's login; click this button on the touch screen to log out and cancel the current user's privilege so that the user's level becomes the lowest.

20. Alarm Sound (ON / OFF)

Choose the function of Alarm Sound ON / OFF to make a sound when an alarm occurs. You can set the function button to enable or disable this function. If the current state is on, the alarm sound will be shielded after user clicking this button, and vice versa

21. Touch sound (ON / OFF)

Set the function button to Touch Sound Switch, and then the touch sound may be turned on/off by touching this button. If there is touch sound at present, the touch sound will be turned off after touching this button, and vice versa.

22. Clear all historical data

The history data stored in HMI will be cleared.

23. Clear the historical alarm

The history alarm saved in HMI is cleared.

24. HMI protection unlock

Enter the password to deactivate the HMI protection.

25. Recipe Read & Save

Read and save the recipe.

26. Alternate function

Only as back-up function, it does not perform any operation.

27. Historical Alarm Control, Alarm Up

Move up the selected alarm information in the HMI.

28. Historical Alarm Control, Alarm Down

Move down the selected alarm information in the HMI.

29. Historical Alarm Control, Alarm Page Up

Page up historical alarm information

30. Historical Alarm Control, Alarm Page Down

Page down historical alarm information

31. Historical Data Up

Move up the selected historical data information in HMI

32. Historical Data Down

Move down the selected historical data information in HMI

33. Historical Data Page Up

Page up historical data information

34. Historical Data Page Down

Page up historical data information

35. Reload recipe

Reload the recipe data in flash to the corresponding RWI address.

36. Switch languages

Switch text contents of all the controls to that of another specified language

After jumping to the system screen, the system will close the current project; when return from the system screen, it will restart the project, and enter the start screen of project settings.

The "Mark" page of Function button is similar to that of the "Bit Button" control which you can refer to. Except the Mark page of Function button has no Status Text 1 neither Status Picture 1 because it has only one state.

Advanced and Permission pages of the Function Button are the same as that of the Bit Button control. You can refer to the Bit Button control.

After setting all the properties, click "OK" to add the control button to the view area (i.e., the screen)


SamDraw位指示灯

Bit Indicator Lamp

The Bit Indicator Lamp can be used to monitor the ON / OFF status of bit contact of the connected device and to display it on the HMI scree.

As shown in Figure 4-64 below:

图4-64

Create a Bit Indicator Lamp:

1. Select the Bit Indicator Lamp button icon [image] on the toolbar: The dialog box shown in Figure 4-65 will pop up:

Figure 4-65 Bit Indicator Lamp dialog box

Refer to Bit Button control for Shape, Border color, Foreground color, Background color and Pattern.

2. In the "General" Property dialog box of the bit indicator lamp, choose an address to be monitored by this indicator. Through the settings in “Mark”, you can set contents and pictures to be displayed and also choose whether to blink.

The "Mark" page of the "Bit Indicator Lamp" is the same as that of the "Bit Button" which you can refer to.

3. Data Type: The drop-down box has three options, namely: Bit, Word Bit and Double-word Bit. When the chosen data type is "Word Bit" or "Double-word Bit", the value of the monitor address (status of ON/OFF) is determined by the bit number value. It is from 0 to 15 for Word Bit and 0 to 31 for Double-word Bit.

For example, when "Word Bit" is selected, the monitor address is LW1 with a value of 23, if the bit number is 3, the state of this address value is 0 because the binary number of 23 is 10111 whose 3rd number from right to left is 0.

4. To reset the properties of this indicator, double-click it to reset it in the property dialog box.

The Permission page of the Bit Indicator Lamp is the same as that of the Bit Button control that you can refer to.

After the properties set up, click "OK" to add the control in the view area (i.e., the screen).


SamDraw多状态指示灯

Multi-state Indicator Lamp

The Multi-state indicator lamp control is mainly used to display different states according to the value of the monitor address. Up to 32 states can be displayed.

Click the Multi-state indicator button [image] on the toolbar to bring up the dialog box as shown in Figure 4-66.

Figure 4-66 Multi-state Indicator Lamp dialog box

1. General:

Refer to Bit Button for application of the border color, foreground color, background color and pattern of the control in different states.

When "Multi-state indicator lamp” selects the 32-bit data type, the stored address occupies 2 words. For example, when write data to the SIEMENS PLC's data register, and the address written is V10, then the occupied data register address includes V10 and V11; if users also use other controls to monitor the value of V11, an error will appear. Users should pay attention to the use of 32-bit data types in case of Note data and address errors.

Type: The data type of the write address and monitor (read) address

Monitor address: The read address, which is a status value to be read, and then reflects the current state selected by user in the control.

Total states: Users can set the total number of states according to individual need, which can be up to 32 states, that is from state 0 to state 31.

For example, selecting a data type of 16-bit positive integer, a total number of states of 32, when the data value stored in the monitor address is 0, the Multi-state indicator shows the text and the corresponding picture of the state 0; if the data value is 5, the Multi-state indicator will show the text and the corresponding picture of the state 5;. When the value is 60, the Multi-state indicator will still display the message of the State 31, because the total number of states up to 32 states.

2. Text:

Click the "Text" tab of the Multi-State Indicator Property box to display the text property settings screen as shown in Figure 4-67 below:

Figure 4-67 Multi-state indicator text page

This option is designed to set different texts for each state. The default texts are continuously increasing numbers from 0. Text contents can be changed for necessary. Afterwards, it can also modify the font, size, color, kerning and position of text in order to beautify the text.

3. Picture:

Click the Picture tab of the Multi-State Indicator Property box to display the attribute settings as shown in Figure 4-68:

Figure 4-68 Multi-state indicator lamp picture page

This page is mainly employed to load pictures for different states. Picture of each state is empty by default while it can be changed according to personal need.

Steps are as follows: Select the item in the list box whose picture needs to be changed, then choose the right picture either in system library or through save path on Windows. So when click on different status, corresponding pictures will be loaded below. In addition, user can also decide whether to fit to Object: if not, the margin and position of the control can also be modified, so as to beautify it.

Refer to "Bit button" control for Permission page.

Ø After setting all the properties, click "OK" and then add the control in the screen area


SamDraw多状态按钮

Multi-state Button

Functions between Multi-state button and Multi-state indicator lamp are basically the same, while the only difference is that multi-state button supports value input, rather than simple function of indicating. Specific operation is as follows:

Click the button icon [image] on the toolbar to display the dialog box shown in Figure 4-69:

Figure 4-69 Multi-state button dialog box

Functions:

Keyboard input: Three options in the "State Type" can be selected. In the simulation or screen, when click the control, it will pop up a keyboard for user to enter the value.

Increase: In the simulation or screen, when click on the control, each click means the number of state plus 1.

Decrease: In the simulation or screen, when click on the control, each click means the number of state minus 1.

Loopback increase: In the simulation or screen, when click on the control, each click means the number of state plus 1; it returns to state 0 if beyond the total number of state.

Loopback decrease: In the simulation or screen, when click the control, each click means the number of state minus 1, it will return to the maximum state in case of beyond the total number of state.

Use Macro: If this option is selected, when click on the control in the simulation or screen, the macro selected by the user is executed in this case.

Shape, border color, foreground color, background color and pattern can be used with reference to "Bit button" control.

Refer to "Multi-state indicator lamp" control for "Text" and "Picture" pages.

The "Advanced" and "Appearance" pages are referred to the "Bit Button" control. Specific hot keys can be used to refer to the bit switch.

After setting the properties, click "OK" to add the control in the view area (that is, the screen)


SamDraw数值显示

Numeric Display

Numeric display control is a commonly used control displaying values in data register stored in PLC or other connected devices, such as speed, current, pressure and so on.

Select the display icon [image] in the toolbar, and then the system will bring up a dialog box. As shown in Figure 4-70:

Figure 4-70 Numeric Display dialog box

In this dialog box, you can set the value saved in data register of PLC or other connected devices, such as the display digits, the decimal place, and font size, color, alignment and adjustment of text control.

Data type: Users can choose different data categories according to the value of the register address to be monitored.

Display Type: Users can choose different display categories according to project needs.

Monitor address: Read address. The control is applied to display the data; the monitor address is the data register address carrying data to be displayed in PLC or other connected devices.

Decimal Place: Display the number of decimal places for the data.

Font: Choose a general font or digital font.

Font size: Choose the size of the displayed font as needed.

Alignment: The default is Center.

Left: The numerical value displayed is in the left part of the display area.

Center: The numerical value displayed is at the center of the display area.

Right: The numerical value displayed is in the right part of the display area.

Justification: The default is zero-suppression.

Zero-suppression: Zero in front of the significant figure is hidden. If the value of the monitor address is 00123, a 16-bit positive integer, then the value displayed in the display box is 123.

Zero Header: Display the leading zero of the effective number of bits. If the value of the monitor address is 00123, a 16-bit positive integer, then the value displayed in the display box is 00123.

Space Header: Display the space instead of 0 in front of the significant digit. If the value of the monitor address is 00123, a 16-bit positive integer, then the value displayed in the display box is 123.

Text Color: The font color of the data displayed;

Shape, border color, foreground color, background color and style can be used with reference to "Bit button" control.

Double-click the data display box to reset the contents and properties of the data display. When the control functions in the HMI, an on-screen keyboard will pop up, giving an access to the data input for user.

The number of decimal place affects the data display. When the selected data type is 16/32-bit positive integer, 16/32-bit integer, and then the displayed value is acquired by offsetting the decimal point of return value by the set number of digits. If the value 212 is returned and the number of decimal places is 2, then 2.12 is displayed. If the selected data type is a 32-bit floating-point number, the value has no offset; but only the fractional decimal places are displayed. If the value 2.123 is returned and the scale is set to 2, only 2.12 is displayed.

Total number of bits means the sum of the length of the integer part and the fraction part. If the integer length of the displayed value is greater than that of the integer part, the length of the displayed integer will be that of the actual value. For example, for the value 2123, the length of value is 2, and number of decimal place is 1, then it will display 212.3.

The Advanced page of Numeric display contains powerful functions, including Scaling and Range Display, as shown in Figure 4-71:

Figure 4-71 Numeric Display Advanced page

Scaling: When this option is selected, the data displayed by the numeric display control is: Monitor (Read) Address Value × Gain + Offset

Display Range: When this option is selected, user can set the lower and higher limit values as well as the low and high-level background color according to the needs. The address value monitored (read) by the control will be represented by different color patterns in the user-set lower and higher limit values.

Variable range: the values of "Lower Limit" and "Higher Limit" are dynamically changed, depending on the address entered by the user

Lower limit: Set the lower limit of the display. When the number displayed is lower than this limit, the background color will be the color set in Low Level Background Color.

Higher limit: Set the higher limit of the display. When the number displayed is higher than this limit, the background color will be the color set in High Level Background Color.

For example, when you set the background color and text color in the General page and select the Range display color as shown in Figure 4-72:

Figure 4-72 Range Display Property Settings

When the value of the monitored address changes, the text and background of the numeric display change accordingly, as shown in Figure 4-73:

Figure 4-73 An example of numeric display

Refer to the use of "Bit button" control for the Permission page.

When the 32-bit data type is selected, the stored address occupies 2 words. For example, when write data to the SIEMENS PLC's data register, and the address written is V10, then the occupied data register address includes V10 and V11; if users also use other controls to monitor the value of V11, an error will appear. Users should pay attention to the use of 32-bit data types in case of Note data and address errors.

Ø After the setting, click "OK" to add the control to the view area.


SamDraw数值显示输入

Numeric Input

Numeric input is the most commonly used control, almost essential for all of the process control processes. It can input, display and store the value in the data register of the PLC or other connected devices, such as speed, current, pressure and so on.

Functions of Numeric input and numerical display are basically the same, and the only difference is that the numerical input can enter values to the data register of PLC or other connected devices, but not just display the value.

Specific operations to create a numeric input touch key are as follows:

Select the Numerical input icon [image] in the toolbar, and a dialog box appears. As shown in Figure 4-74.

Figure 4-74 Numeric Input dialog box

Shape, border color, foreground color, background color and pattern can be set with reference to "Bit button" control.

Refer to the "Numerical Display" control for "Alignment", "Justification”, "Decimal Place" and "Total Digits".

Double-click the data display box to reset the contents and properties of the data display. When the control functions in the HMI, an on-screen keyboard will pop up, giving an access to the data input for user, as shown in Figure 4-75.

Figure 4-75 Number input keyboard

When the 32-bit data type is selected, the stored address occupies 2 words. For example, when write data to the SIEMENS PLC's data register, and the address written is V10, then the occupied data register address includes V10 and V11; if users also use other controls to monitor the value of V11, an error will appear. Users should pay attention to the use of 32-bit data types in case of Note data and address errors.

The number of decimal place affects the data display. When the selected data type is 16/32-bit positive integer, 16/32-bit integer, and then the displayed value is acquired by offsetting the decimal point of return value by the set number of digits. If the value 212 is returned and the number of decimal places is 2, then 2.12 is displayed. If the selected data type is a 32-bit floating-point number, the value has no offset; but only the fractional decimal places are displayed. If the value 2.123 is returned and the scale is set to 2, only 2.12 is displayed.

Total number of bits means the sum of the length of the integer part and the fraction part. If the integer length of the displayed value is greater than that of the integer part, the length of the displayed integer will be that of the actual value. For example, for the value 2123, the length of value is 2, and number of decimal place is 1, then it will display 212.3.

Password input: "Password input" means the password input function, and the characters entered by the user are displayed in the form of "*" in the process of inputting and displaying.

Use Macro: Select the option of "Use Macro" to display the list of macros. User can select a macro to execute when the numeric input button is pressed. Only compiled macros are displayed in the drop-down list.

“Advanced” page: This page is mainly used to set the gain, offset and range check of input data (to check whether the input value is beyond the set range); In addition, the advanced page also has "Touch availability " and "Notification" options, which have the same functionality as that of the "Bit Button" control which users can refer to.

Click the "Advanced" tab, as shown in Figure 4-76:

Figure 4-76 Numeric Input Advanced page

Scaling: When this option is selected, the value written to the address = (the value entered by user through the pop-up keyboard - offset) / Gain; the displayed value (ie, the value of the monitor address) = the value of the monitor address × gain + offset

Range check: Check whether the input value is beyond the set maximum or minimum value.

After the settings, click "OK" to add the control to the view area.


SamDraw ASC显示

ASC Display

ASCII Display is used to displaying ASCII in device.

Click the ASCII display button icon [image] , and then a dialog box pops up as shown in Figure 4-77:

Figure 4-77 ASCII Display dialog box

In this dialog box, you can set the monitor address of the connected device to be displayed, choose the font size of the display text and other properties.

Refer to Bit Button control for Shape, Border color, Foreground color, Background color and Pattern.

If set the transparence property of this control, the setting of background color is invalid.

Refer to the use of "Bit button" control for the Permission.

Ø After the settings, click "OK" to add the control to the view area.


SamDraw ASC显示输入

ASC Input

Click the ASCII Input button icon [image] , and then a dialog box pops up as shown in Figure 4-78:

Figure 4-78 ASCII Input dialog box

Write address: Input ASCII text into the address.

Exchange high and low bytes of input: The high byte in the value input by user will be exchanged with the low byte, and then the data after such exchange will be stored into the monitored word address.

Use Macro: Select the option of "Use Macro" to display a list of macros. User can select one to execute when the button is pressed. Only compiled macros are displayed in the drop-down list.

For example, when the 32-bit data type is selected, the stored address occupies 2 words. For example, when writing data to the SIEMENS PLC's data register, and the address written is V10, then the occupied data register address includes V10 and V11; if users also use other controls to monitor the value of V11, an error will appear. Users should pay attention to the use of 32-bit data types in case of Note data and address errors.

Other functions in General page are the same with those of SCII Display which you can refer to.

Refer to Bit Button for the application of “Advanced” and “Permission” page.

After the settings, click "OK" to add the control to the view area.


SamDraw柱状图

Bar Chart

Bar Chart, also called bar, is mainly used to present the real-time change in the numerical values in the form of bars, so that user may view such change more visually. Graph may present the change in the numerical values of data registers of PLC or other devices connected, and also the real-time change in all analog quantities in process flows. See the figure below:

Figure 4-79

Operations of adding a histogram (bar) and modifying the properties are as follows:

1. Click on the control icon [image] , and then it will appear a dialog box as shown in Figure 4-80:

2. Set the properties of the bar graph in the Property dialog box, and then click OK:

Monitor address: The data register address that can be displayed in the bar, i.e., the read address

Maximum: The maximum value of the Monitor (read) address. When the value of the monitor (read) address is greater than it, the bar is full and no longer changes with the value of the monitor address

Minimum: The minimum value of the Monitor (read) address. When the value of the monitor (read) address is less than this value, the bar is empty and no longer changes with the value of the monitor address

Direction: The direction of the histogram scroll, there are four directions: Upward, Downward, Leftward and Rightward.

Upward: When the value of the monitor address increases, the columnar surface rolls from bottom to top

Downward: When the value of the monitor address increases, the column rolls from top to bottom

Leftward: When the value of the monitoring address increases, the columnar surface rolls from right to left

Rightward: When the value of the monitor address is increased, the columnar surface rolls from left to right

Background color: The background color of the bar chart

Bipolar bar: It can be displayed on both sides according to the value of the data register.

For example, assuming the maximum value is 100, the minimum is 10, and the scroll mode is upward, when the bipolar bar is selected, input 70 to the "Midpoint" value. Then the value incremented of the monitor address from 0 is shown in Figure 4-81.

Figure 4-81 Bipolar bar graph

3. Modify the bar chart: Click on the histogram, then it will appear eight small green dots that you can drag with the mouse to modify its size.

“Range” page:

This page is mainly used to display the value of the monitor address in the specified range to show a different foreground color and background color. The properties are shown in Figure 4-82:

Figure 4-82 Bar Graph Range page

When the option of Display Range is selected, users can set the lower and higher limit values as well as the low and high-level background color according to the needs. The address value monitored (read) by the control will be represented by different color patterns in the user-set lower and higher limit values.

Lower limit: Set the lower limit of the display. When the number displayed is lower than this limit, the background color will be the color set in Low Level Background Color.

Higher limit: Set the higher limit of the display. When the number displayed is higher than this limit, the background color will be the color set in High Level Background Color.

Refer to “Bit button” for the application of “Permission”.

Ø After the settings, click "OK" to add the control to the view area.


SamDraw时间显示

Time Display

The control of Time Display is mainly used to display the system time. Click on the control icon [image] , and then it will appear a dialog box as shown in Figure 4-83.

Figure 4-83 Time Display dialog box

Refer to Bit Button control for Shape, Border color, Foreground color, Background color and Pattern.

Format: Fours modes of time display for users to choose.

HH:MM Hour: Minute

HH:MM:SS Hour: Minute: Second

HH-MM-SS Hour- Minute-Second

HH-MM Hour- Minute

Font: Font type of text

Font Size: Decide the font size of time display

Color: Decide the text color of time display

Alignment: Decide the position of time display, left, center or right.

After the settings, click "OK" to add the control to the view area.


SamDraw日期显示

Date Display

The control of Date Display is mainly used to display the system date. Click in the button icon [image] in the toolbar, and then it will appear a dialog box as shown in Figure 4-84:

Figure 4-84 Date Display dialog box

Format: There are nine modes of date display for user’s choice.

YYYY-MM-DD

MM-DD-YYYY

DD-MM-YYYY

YYYY/MM/DD

MM/DD/YYYY

DD/MM/YYYY

YYYY.MM.DD

MM.DD.YYYY

DD.MM.YYYY

Font: Font type of text

Font Size: Decide the font size of time display

Color: Decide the text color of time display

Alignment: Decide the position of time display, left, center or right.

Refer to Bit Button control for Shape, Border color, Foreground color, Background color and Pattern.

After the settings, click "OK" to add the control to the view area.


SamDraw星期显示

Week Display

The control of Date Display is mainly used to display the system date. Click in the button icon [image] in the toolbar, and then it will appear a dialog box as shown in Figure 4-85：

Figure 4-85 Date Display dialog box

Refer to Bit Button control for Shape, Border color, Foreground color, Background color and Pattern.

Click “Text” to modify the settings of text to be displayed, including text, font, font size, color, etc. “Text” page is shown as Figure-4-86:

Figure 4-86 Text page of Week Display

Select first the item to be modified and then change the content in editing box.

After the settings, click "OK" to add the control to the view area (the screen).


SamDraw静态图片

Static Picture

The control of Static picture is mainly used to show a picture that can be in various formats from the file or from the library. With the picture loaded, it can be applied as a screen background to beautify the project interface.

1. Click on the static picture icon [image] on the toolbar to pop up a dialog box as shown in Figure 4-87:

Figure 4-87 Static picture dialog box

Picture: From system gallery or file.

Picture Path：Right click the file icon to find the needed picture.

Link：Save only the picture path instead of the picture in order to decrease the file size.

Embed： Save the picture to project file, which will make file bigger and affect the storage speed.

2. After selecting a picture, click OK, and then the mouse cursor will become cross-shaped [image] ; left click on anywhere on the screen to add the picture control.

3. The size of the inserted picture can be modified through the mouse. SKTOOL configuration software supports various image formats: JPG, BMP, PNG, WMF, EMF, and GIF.


SamDraw图片显示器

Picture Display

Picture Display is an extension of the Static picture control, because the Static picture can only display one picture while Picture display can display up to 32 pictures. Picture display may have different definitions according to different status categories selected by user.

Steps are as follows:

Click the icon [image] of the Picture display on the toolbar. The dialog box shown in Figure 4-88 pops up:

Figure 4-88 Picture Display dialog box

Bit: When Bit is selected, the total number of states is only two, state 0 and 1. Monitor address can only be a bit address. The control displays the corresponding picture based on the state 0 or 1 of the monitor address.

Value: When the Value option is selected, the total number of states can be up to 2048, and different pictures are displayed according to the value of the monitor address. When the value of the monitor address is 0, the picture under the state 0 is displayed, and so on.

Auto-switching: When the auto-switching option is selected, the total number of states can be up to 2048, and the control does not need to change pictures according to the value of the monitor address, as long as user sets the total number of states; then set the automatic transformation frequency. If it runs in the HMI, the control will switch pictures automatically within the range.

The "Picture" page of the Picture Display is similar to that of the "Multi-state Indicator Lamp" control that you can refer to.

Refer to the "Bit button" control for the application of “Permission”.

After the settings, click "OK" to add the control to the view area.


SamDraw扩展控件

SamDraw extended controls

l GIF Display

l Trend Chart

l XY Trend Chart

l Dynamic Circle

l Dynamic Rectangle

l Alarm Controls

l Alarm Bar

l Historical Alarm Display

l Graphics Move

l Meter

l Historical Data Display

l Historical Trend Chart

l Message Display

l Flowing block

l Timer

l Multi-function Button


SamDraw GIF显示器

GIF Display

GIF display can be used to display images of GIF format, supporting 32 frames at most. Operation is as follows:

Click the GIF icon on [image] the toolbar to display the dialog box shown in Figure 4-89.

Figure 4-89 GIF Display dialog box

After setting the properties, click "OK", then the mouse cursor will become a cross in the editing area; left click to draw a rectangle and the control is added to the view area (i.e. the screen).

Ø Select the "Advanced" page to display its properties.

Figure 4-57 GIF Display "Advanced" page

Controlled By bit: When "Controlled by Bit" is selected, if the "Active Status" selected is 1, the GIF picture will be animated if and only if the value of "Control bit" is 1, otherwise it is a static display; when the selected "Active Status" is 0, the GIF picture will be animated if and only if the value of "Control Bit" is 0, otherwise it will be displayed statically.

Refer to the application of "Bit Button" control for "Permission" page.


SamDraw 趋势图

Trend Chart
说明: 说明: logo.gif

Trend Chart Summary:

Dynamic, variable and continuous value displayed continuously.

Draw reference curves of multiple data. Take the time as the horizontal axis, the value as the vertical coordinate axis, in order to accurately and intuitively judge the change tendency of a certain value during a period of time.

Up to 8 polylines can be displayed (line graph).

Add Properties of the trend graph:

1. Select the Trend Chart icon 说明: 说明: 037.jpg in the toolbar, and then the properties dialog box appears, as shown in Figure 4-90

说明: 说明: 趋势图

Figure 4-90 Trend Chart Common Dialog Box

Background color: Change the background color of the trend chart. The effect cannot be visible until you click OK.

Data type: 7 kinds of data types are available for users.

Read trigger bit: Only when the "Read trigger bit address" value is 1, the curve will move around.

Data group number: Number of lines, up to 8.

Number of data points per group: Number of data shown on the X-axis.

Sampling time: The sampling frequency

Read Address: The value of the Read Address represents the value of each line on the Y-axis direction. According to different data group numbers and data types, Read address can be read continuously (16-bit data) or read at intervals (32-bit data).

E.g.:

When the 16-bit data type is selected and the number of data groups is 8, it is assumed that the user-input address is LW3, and 8 groups of address values are continuously read out,

LW3: The value of line1

LW4: The value of line 2

LW5: The value of line 3

LW6: The value of line 4

LW7: The value of line 5

LW8: The value of line 6

LW9: The value of line 7

LW10: The value of line 8

Therefore, when the user selects 16-bit data and sets the number of N groups of data, the user can read out the address values of the N groups in succession according to the address rules of different PLC models.

Direction:

Left to right: The line moves from the left.

Right to left: The line moves from the right.

Background color: The color of the line

Clear Trigger Bit: Clear the current status of all lines when the address value changes from 0 to 1 (rising edge). The line remains the same when the address value changes from 1 to 0 (falling edge) or has no change,.

2. The "Line" page of the Trend Chart is shown in Figure 4-91: This page allows user to set the maximum value, minimum value, style and color of each pen.

Figure 4-91 Trend Chart Pen Dialog Box

The data type in the General page determines that of the maximum and minimum values here.

For example, if the maximum or minimum value is a floating-point number, user must first select 32-bit floating-point number in the Data Type in the General page. Otherwise, an error will occur when user clicks "OK".

3. The "XY Axis" page of the trend chart is shown in Figure 4-92:

Figure 4-92 Trend Chart XY Axis Dialog Box

l X-axis

Display scale: whether to display the X-axis scale.

Show Y-axis grid: Whether to display Y-axis grid.

Axis / Scale Color: Change the color of the X-axis / scale.

Grid Color: Change the X-axis grid color.

Main sub-scale: X-axis main scale.

Sub-scale: X-axis times the number of times.

Display Scale Indicates whether the X-axis scale is displayed.

l Y-axis

Display Scale: Whether to display the Y-axis scale.

Show X-axis grid: Whether to display the X-axis grid.

Axis / Scale Color: This option changes the color of the Y-axis / scale.

Grid Color: This option changes the Y-axis grid color.

Major scale division: Numbers of Y-axis major scale.

Sub-scale division: Numbers of Y-axis sub-scale.

Show Marks: Whether to display the Y-axis scale mark.

Font Size: Change the font size of the Y-axis scale.

Minimum: The minimum value of the Y-axis scale.

Max: The maximum value of the Y-axis scale.

Total: Display the maximum digital number of the data.

Decimal Place: The maximum digital number that can be displayed after the decimal point.

Refer to "Bit Button" for the "Permission" page.


Historical Trend Chart

Ø Historical Trend Chart Summary:

This control functions in cooperation with “Historical data collector” in “Project Manager”, which means it presents data values of “Historical data collector”.

Display continuously dynamic, variable and continuous value.

Draw reference curves of multiple data. Take the time as the horizontal axis, the value as the vertical coordinate axis, in order to accurately and intuitively judge the change tendency of a certain value during a period of time.

Up to 8 polylines can be displayed (line graph).

Ø Add properties of the trend graph:

1. Select the Trend Chart icon in the toolbar, and then the properties dialog box appears, as shown in Figure 4-90

Figure 4-90 Trend Chart Common Dialog Box

Background color: Change the background color of the trend chart. The effect cannot be visible until you click OK.

Data Logger: The default is the historical data collector in Project manager.

Number of curve: Number of lines, up to 8.

Ground color: Color of line’s moving trace.

2. The "Line" page of the Trend Chart is shown in Figure 4-91: This page allows user to set the maximum value, minimum value, style and color of each pen.

Figure 4-91 Trend Chart Pen Dialog Box

It is available to set the maximum value, minimum value, pattern and color of line. Data source is the data item in “Historical Data Collector”. It’s possible to choose different data sources for each line.

3. The "XY Axis" page of the trend chart is shown in Figure 4-92:

图4-92 历史趋势图 XY轴页面

l X-axis

Display scale: whether to display the X-axis scale.

Show Y-axis grid: Whether to display Y-axis grid.

Axis / Scale Color: Change the color of the X-axis / scale.

Grid Color: Change the X-axis grid color.

Main sub-scale: X-axis main scale.

Sub-scale: X-axis times the number of times.

Display Scale Indicates whether the X-axis scale is displayed.

l Y-axis

Display Scale: Whether to display the Y-axis scale.

Show X-axis grid: Whether to display the X-axis grid.

Axis / Scale Color: This option changes the color of the Y-axis / scale.

Grid Color: This option changes the Y-axis grid color.

Major scale division: Numbers of Y-axis major scale.

Sub-scale division: Numbers of Y-axis sub-scale.

Show Marks: Whether to display the Y-axis scale mark.

Font Size: Change the font size of the Y-axis scale.

Minimum: The minimum value of the Y-axis scale.

Max: The maximum value of the Y-axis scale.

Total: Display the maximum digital number of the data.

Decimal Place: The maximum digital number that can be displayed after the decimal point.


SamDraw XY趋势图

XY Trend Chart
说明: 说明: logo.gif

XY Trend Chart Overview:

Display continuously dynamic, variable and continuous value.

You can draw multiple data reference curve, and take two consecutive register address value as the horizontal axis and vertical axis coordinates respectively, in order to observe the change rules accurately and intuitively.

Up to 8 polylines can be displayed (line graph).

Operations of adding XY Trends and modifying XY Trend Properties are similar to those of Trend Chart. Users can refer to the "Trend Chart" page operation. Click the icon 说明: 说明: 038.jpg ; Open the XY Trend Property dialog box; refer to the "Trend Chart" property settings. It should be noted that each line in the Trend Chart represents the value of consecutive addresses starting from the write address, and each in the XY Trend Chart represents the value of two consecutive addresses starting at the write address.

For example, if 16-bit data type is selected and the number of data groups is 4, assuming that the user-input address is LW3, 8 sets of address values are continuously read,

LW3: Line1 Value of the X-axis

LW4: Line 1 Value of the Y-axis

LW5: Line 2 Value of the X-axis

LW6: Line 2 Value of the Y-axis

LW7: Line 3 Value of the X-axis

LW8: Line 3 Value of the Y-axis

LW9: Line 4 Value of the X-axis

LW10: Line 4 Value of the Y-axis

The addresses to be read are LW3-LW10, with 8 groups of addresses. Therefore, when select the 16-bit data and sets N groups of data, you can read values of 2 * N groups of address consecutively according to address rules of different PLC models.

When the 32-bit data type is selected and the number of data groups is 3, assuming that the user-input address is LW3, then it needs to read address values of 12 data groups in succession.

LW3: Line 1 Value of the X-axis

LW5: Line 1 Value of the Y-axis

LW7: Line 2 Value of the X-axis

LW9: Line 2 Value of the Y-axis

LW11: Line 3 Value of the X-axis

LW13: Pen 3 Value of the Y-axis

The addresses to be read are LW3-LW14, with 12 sets of address. Therefore, when select 32-bit data and set N groups of data, you can read address values of 2 * N data by plus 2 at interval according to address rules of different PLC models.


SamDraw 消息显示

Message Display

Message Display functions similarly to the multi-state indicator, except that the total states number of the message display control increases, which is up to 128. This control icon on the toolbar is [image] , click it to bring up a dialog box as shown in Figure 4-103:

Figure 4-103 Message Display General Page

Refer to the Multi-state indicator control for attribute settings.


SamDraw 动态圆

Dynamic Circle

A dynamic circle is designed to move and change size following certain track by placing a graphic on the screen. This movement and size change are determined by the value of the monitor address. Add the dynamic graphic control and modify the dynamic graphic control properties:

Select the dynamic circle icon [image] in the toolbar, as shown in Figure 4-93:

Figure 4-93 Dynamic circle dialog box

Three sets of address values to be read by Dynamic circle represent the x-coordinate, y coordinates of the circle center and the radius of the circle respectively. The way that these three groups of addresses are read depends on the data type selected by the user.

Control:

Center: The circle moves according to the position of the center of the circle while the radius does not change.

Radius: Just the radius size changes and the position do not move.

Center & Radius: Not only the radius changes with the value of monitor address representing the radius of the circle, but also the center does with the value of monitor address representing the x, y coordinates of the circle center.

Solid:

When user does not select Solid, the circle is an empty circle, which means it has no background color. Otherwise the circle is a solid circle; the background color option can change its background color.

Border

When user does not select this option, the circle does not have change lines, and the color of the edge line cannot be changed. Otherwise, the circle is a circle with an edge line; border color options can change the color of the edge line.

Here's an example:

Select the data type "16-bit integer", and read out three sets of data consecutively to represent respectively the x coordinate, y coordinate of the center and circle radius, according to address formats of different PLC models. When the monitor address is LW1, it needs to read the address values of LW1, LW2 and LW3. The meaning of the address is as follows:

The value of LW1 is the x-coordinate of the circle center.

The value of LW2 is the y-coordinate of the circle center.

The value of LW3 is the radius of the circle.

Regardless of whether selecting Center or Radius in the control option, HMI will still read three groups of address, which represent the same meaning. For example, , you select the radius in the control bar, and the monitoring address is LW1, then still only value of LW3 can control the radius of the circle.

When select the data type "32-bit integer" and the monitor address is LW1, then it needs to read the address values of LW1, LW2 and LW3. The meaning of the address is as follows:

The value of LW1 is the x-coordinate of the circle center.

The value of LW3 is the y-coordinate of the circle center.

The value of LW5 is the radius of the circle.

When select the data type "32-bit integer", according to the address format of different PLC models, you can add 2 at interval to the monitor address to acquire three sets of data representing the x coordinate, y coordinate of the circle center and the radius respectively.

Refer to "Bit Button" control for the application of "Permission" page.


SamDraw 动态矩形

Dynamic Rectangle

Functions of dynamic rectangle are similar to those of dynamic circle. They all reflect the dynamic state of monitor address in real time by changing the position or size of the graph according to different values of monitor address.

Select the dynamic rectangle icon [image] in the toolbar to bring up the dialog box shown in Figure 4-94.

Figure 4-94 Dynamic rectangle dialog box

The dynamic rectangle needs to read four sets of address values to represent the x-coordinate, y-coordinate, the width and height of the rectangle respectively. The way to read these four groups of addresses depends on the data type selected by the user.

l Here's an example:

When select the data type "16-bit integer" and the monitor address is LW1, then it needs to read the four sets of address values LW1, LW2, LW3, and LW4. Their meanings are as follows:

The value of LW1 is the x-coordinate of the rectangular;

The value of LW2 is the y-coordinate of the rectangular;

The value of LW3 is the width of the rectangle;

The value of LW4 is the height of the rectangle.

In the case of selecting a data type of "16-bit integer", the user can read four sets of data consecutively according to the address specification format of the PLC model to represent the rectangle x coordinate, rectangle y coordinate, and rectangle width and height, respectively.

When the user selects the data type as "32-bit integer" and the address LW1 is monitored, the address values ​​of LW1, LW3, LW5, and LW7 need to be read out.

The value of LW1 is the rectangular x coordinate;

The value of LW3 is the rectangular y coordinate;

The value of LW5 is the width of the rectangle;

The value of LW7 is the height of the rectangle;

When select the data type "32-bit integer", according to the address format of different PLC models, you can add 2 at interval to the monitor address to acquire four sets of data representing the x coordinate, y coordinate, the width and the height of the rectangle respectively.

Control

Position: The height and width of the rectangle does not change with the corresponding monitor address value while the position of the rectangle changes with the monitor address value that represents the x and y coordinates of the rectangle.

Size: The height and width of the rectangle changes with the following four fixed points, but the position of the rectangle does not change.

Upper Left: The fixed point of the rectangle is in the upper left corner, and it extends in the direction of the lower right corner.

Upper right: The fixed point of the rectangle is in the upper right corner, and it extends in the direction of the lower left corner.

Lower Left: The fixed point of the rectangle is in the lower left corner, and it extends in the direction of the upper right corner.

Lower right: The fixed point of the rectangle in the lower right corner, and it extends in the direction to the upper left corner.

Solid:

When user does not select Solid, the rectangle is an empty one, which means it has no background color. Otherwise it is a solid rectangle; the background color option can change its background color.

Border:

When user does not select this option, the rectangle does not have change lines, and the color of the edge line cannot be changed. Otherwise, it is a rectangle with an edge line; border color options can change the color of the edge line.

Refer to "Bit Button" control for the application of " Permission" page.


SamDraw 报警控件

Alarm Controls

The alarm control can display the alarm information of the current equipment (digital alarm and analog alarm). Before executing this control, it needs to configure the alarm settings. For ways to configure the alarm settings please refer to "Alarm setting".

Alarm control can store real-time alarm information, and the number of alarms is determined when you configure. SamDraw supports digital alarm messages.

Add the alarm control:

Select the Alarm Control [image] in the Tool menu or select the Alarm Control button in the Toolbar menu; a dialog box shown in Figure 4-95 will pop up:

Figure 4-95 Alarm Display dialog box

In the alarm display box, you can set the color and size of the display frame, color and type of the grid line, the time, date and color of alarm title. In the Text box, you can also set font size, text color and number of rows of alarm message. If the row is set to 5, then the alarm control can display 5 alarm messages, when there is a new alarm occurs, the earlier one will be replaced.

After the settings, left click to draw the alarm control on the screen, as shown in Figure 4-96:

The size of the alarm control is determined by the rows and the maximum character size of the alarm. The mouse can resize it and the position of the alarm control can be adjusted.


SamDraw 趋势图

Digital alarm—Application case

Here is an example about settings of Digital alarm and application of alarm control.

1. Create a new Digital alarm control

Double click Digital alarm in Project Manager to bring up the setting dialog box, as shown below:

Set the Read Address to M5, which means five continuous bit register addresses from M5. Check “Use” for the alarm to be displayed. Select OK to complete alarm settings. Alarm information can be shown on the screen via “Alarm Display”, “Alarm Bar” and “Historical Alarm Display”.

2. “Alarm Display”:

Set the row and time for display in the dialog box; click OK to add it on the screen, as shown below:

3. “Alarm Bar”:

Set the speed, direction, alarm sort and so on; setting completed

4. Historical Alarm Display:

Set the row, time and message in the dialog box, as shown below:

When M5, M7, M8…turn to 1 from 0, “Alarm Display”, “Alarm Bar” and “Historical Alarm Display” will show specific alarm information.


SamDraw静态图片

Analog alarm—Application case

Analog alarm can function with cooperation with “Alarm Display”, “Alarm Bar” and “Historical Alarm Display”.

Double click “Analog alarm” in Project Manager, as shown below:

Set Read address and Block size; check “Use” for alarm displaying. Select OK to complete the alarm settings.

Refer to the case of Analog alarm for combined application with “Alarm Display”, “Alarm Bar” and “Historical Alarm Display”.


SamDraw 动态报警条

Alarm Bar

The Alarm Bar is used to display the current alarm. It differs from the alarm control in that the dynamic alarm bar displays the current alarm contents (digital alarm contents and analog alarm contents) in the form of text scroll.

If there are three alarms, then the dynamic alarm bar will scroll display the first alarm, then the second, and finally the third, and so on. The scroll direction is from right to left, but it is also possible to make it from left to right; the speed, movement interval time and alarm sound are determined by the properties; please refer to "Alarm display setting". Before using the dynamic alarm bar, you need to configure the alarm settings; refer to "Alarm settings" please.

Add the alarm bar:

Select the Alarm Bar or the button [image] in the Tool menu, as shown in Figure 4-97:

Figure 4-97 Alarm Bar dialog

Font Size: Change the font size of the alarm content

Text color: Change the font color of the alarm contents

Speed: Movement step of the alarm contents.

Direction: The moving direction of the alarm content ( Left or Right)

Alarm Sort: The display order of alarms

Application of shape, border color, background color, foreground color and pattern can be used with reference to "Bit Button" control.

When calling off-line simulation, the font size should be "16x16"; in other case, you can choose otherwise.

Refer to "Bit Button" control for "Permission" page.


SamDraw 历史报警显示器

Historical Alarm Display

Historical alarm display is designed to show former alarm messages whose operation mode is same with that of Alarm Display which you can refer to. Its icon in the Toolbar is [image] .

Refer to Alarm Control for basic operations;

Refer to Bit Button for the application of Permission page.


SamDraw 图形移动

Graphics Move

With the Graphic Move control, a gallery graphic or graphic file can move in a specific direction on the screen, and the associated variable value can trigger the movement of the variables. This control can produce an animation effect on the screen.

Add the Graphic Move control and modify its properties:

Select the Graphic Move command button [image] in the toolbar; set the properties in the dialog box that pops up; and click OK, as shown in Figure 4-98:

Figure 4-98 Graphic Move dialog

Picture selection:

On the Pictures page, select a picture as a moving graphic that can also be customized.

Monitor Address:

The monitor address for the change of graphic movement occupies three addresses, which correspond to the change of the total status, the value of the X axis and the value of the Y axis. For example, assuming the monitor address is LW1 in the internal memory and the data type is 16 Bit. (Then the value change of LW1, LW2, LW3 can directly control the total number of state, X-axis movement and Y-axis movement); if data type is 32 Bit, then the monitor address of Total Status is LW1, that of X coordinate is LW3 and that of Y coordinate is LW5.

Method:

The following examples all take LW1 in internal storage address as the monitoring address, and the data type is 16 Bit. As an example to illustrate each movement:

Move horizontally along the X axis: The graph moves only horizontally, but not vertically; cannot move below the lower limit of X axis or above the upper limit of X axis. The total number of status is the value of the monitor address LW1 and that of the LW2 represents the X coordinate.

Move vertically along the Y axis: The graph moves only vertically, but not horizontally; cannot move below the lower limit of Y axis or above the upper limit of Y axis. The total number of status is the value of the monitor address LW1 and that of the LW2 represents the Y coordinate.

Move horizontally and vertically in the meantime: The graph can move in horizontal and vertical direction at the same time; it cannot move below the lower limit of X-axis or above the upper limit of X-axis horizontally, or move below the lower limit of Y axis or above the upper limit of Y axis vertically. The total number of status is the value of the monitor address LW1, that of the LW2 represents the X coordinate and that of LW3 represents the coordinate.

Move horizontally and proportionally along the X axis: The graph moves only horizontally, but not vertically; cannot move below the lower limit of X axis or above the upper limit of X axis. The total number of status is the value of the monitor address LW1 and that of the LW2 represents the X coordinate.

Move vertically and proportionally along the Y axis: The graph moves only vertically, but not horizontally; cannot move below the lower limit of Y axis or above the upper limit of Y axis. The total number of status is the value of the monitor address LW1 and that of the LW2 represents the X coordinate.

Move anti-horizontally and proportionally along the X axis: The graph moves only horizontally, but not vertically; cannot move below the lower limit of X axis or above the upper limit of X axis. The total number of status is the value of the monitor address LW1 and that of the LW2 represents the X coordinate.

Move anti-vertically and proportionally along the Y axis: The graph moves only vertically, but not horizontally; cannot move below the lower limit of Y axis or above the upper limit of Y axis. The total number of status is the value of the monitor address LW1 and that of the LW2 represents the X coordinate.

As for "Text" and "Picture" pages, refer to those of the "Multi-state Indicator" control.

Refer to "Bit Button" control for "Permission" page.

It is available to control the position of the graphic movement by changing the values of the last two monitor addresses.

The maximum coordinate of the X / Y-axis is the maximum value of the screen.


SamDraw 仪表

Meter

The Meter control can display the current value of associated variables through a pointer; generally the control is a semicircle or circular, which can be a visual representation of the actual situation of the variable.

Add the Meter control and modify the properties:

1. Select the Meter control icon [image] in the toolbar; then the dialog box shown in Figure 4-99 appears:

Figure 4-62 Meter dialog box

Needle color: Change the color of the pointer

Needle holder Color: Change the color of the needle holder

Background color: Change the background color of the dial

Direction: Select the clockwise or counterclockwise direction

Data type: Choose different data types according to their needs

Monitor address: Read the address value that is shown by the pointer on the dial plate.

Maximum: Set the maximum value that cannot be exceeded by the monitor address value

Minimum: Set the minimum value that the monitor address value cannot be lower than

2. Click the Scale tab to set the scale properties, as shown in Figure 4-100:

Figure 4-100 Scale tab of Meter

On this page, you can set the color, number of major scale, number of sub-scale, and whether to display the axis and whether to display the scale marks, etc.

3. In the screen editing area click to draw the control. The effect diagram of the Meter control is as follows:

Figure 4-101 Meter control

4. Select the Meter control graph, move the mouse on the 8 small green dots to modify its size; double-click to re-modify the control properties.

Meter control has a fixed aspect ratio; if modify the size, its length and width enlarge or shrink in the meantime.

Refer to "Bit Button" control for "Permission" page.


SamDraw 历史记录显示器

Historical Data Display

In actual use, data generated from PLC or other connected equipment can update at any time, such as alarm. When it comes to historical data, we can use the historical data collector in SamDraw to observe the historical data.

SamDraw provides the function of historical data collector. Enter the Historical data collector dialog box in the project manager. If it is a new project, right-click the "Historical data collector" to add one; then double-click "Historical Data Collector 0" to enter the setting dialog box. For details, refer to properties of " History Data Collector ".

Click on the historical data display button [image] on the toolbar, and the following dialog box will pop up:

Figure 4-102 Historical Data Display dialog box

General:

l Foreground Color: Click the color inside the box to change the foreground color of the display.

Border Color: Click the color inside the box to change the color of the display border.

Grid: Whether to show the grid and select the line color.

Vertical: Check it to show the vertical grid line.

Horizontal: Check this to show the horizontal grid line.

Title: Choose the font size, font style, background color, text color and whether to display the date and time. Language settings can be referred to that of "Alarm Display".

Data: Choose the font size, color, and the maximum lines to be displayed.

l Data Page:

Check the list box to display the corresponding data.

l Time query: Check this option and dialog box will turn into that as shown below:

Figure 4-102 Historical Data Display dialog box

General:

l Foreground Color: Click the color inside the box to change the foreground color of the display.

Border Color: Click the color inside the box to change the color of the display border.

Grid: Whether to show the grid and select the line color.

Vertical: Check it to show the vertical grid line.

Horizontal: Check this to show the horizontal grid line.

Title: Choose the font size, font style, background color, text color and whether to display the date and time. Language settings can be referred to that of "Alarm Display".

Data: Choose the font size, color, and the maximum lines to be displayed.

l Data Page:

Check the list box to display the corresponding data.

l Time query: Check this option and dialog box will turn into that as shown below:

Note: The start time should be earlier than the end time. Otherwise this function will not be enabled.

Setting values of time address should be in BCD format.

Refer to "Bit Button" control for the application of Permission.

Function of Print is unavailable for now.


SamDraw流动块

Flowing block

A Flowing block is an animated graphic that simulates the liquid flow within a pipe. Whether to flow is determined by the state of the trigger address. When the trigger address is 1, the Flowing block is in flow state; while when it is 0, the Flowing block is in static state. User determines the flow speed. Click the button [image] on the toolbar, and then it appears a pop-up dialog box, as shown below:

Color: Set the color properties of the Flowing block.

Flowing block foreground color: Click on the color button to set the Flowing block foreground color;

Flowing block background color: Click on the color button to set the Flowing block background color;

Pipe foreground color: Click on the color button to set its foreground color;

Pipe background color: Click on the color button to set the pipe background color;

Border color: Click on the button to set the border color of the Flowing block control;

Pattern: Click to select the pattern of the Flowing block control; the default setting is “Solid”.

Trigger Address: Address that controls the stationary or moving of the Flowing block; when the value of the address is 1, then the block flows.

Attribute: Set the properties of the Flowing block, such as direction, flow speed.

Display Mode: Select "Horizontal" to make the Flowing block move horizontally; and select "Vertical” to make it flow vertically.

Direction: When the display mode is “Horizontal”, you can choose "Left" or "Right"; in another case, "Up" or "Down".

Blocks: The number of flowing units, ranging from 1 to 30;

No Border: When this attribute is selected, the edges of the Flowing block are hidden.

Speed: High, Middle or Low.

Refer to "Bit Button" control for the application of Permission.


SamDraw定时器

Timer

Timer is a control whose function can be triggered by time. In SKTOOL configuration software, Timer is designed for a macro trigger control.

Click on the toolbar or double click the existing Timer to enter the setting page of Timer:

Execution mode: Choose an execution mode between Always Execute and Address Triggered.

1. "Always Execute" means always executing the macro command at a certain frequency set by user.

2. "Address Triggered" means executing the macro command at the set frequency when the value of the specified bit is 1 while no execution when the value of the specified bit is 0.

Address: When "Address Triggered" mode is selected, the address input field appears where to input the bit address controlling the execution of the macro. When its value is 1, the macro runs.

Frequency: The frequency at which the selected macro runs ranging from 0.1 to 60S.

Execution Times: Run times of the selected macro. When the value is 0, the macro will be executed all the time.

Function type: Select the type of function to be executed. The function of timer control in SKTOOL V6.0.0 configuration software is macro.

Name: The name of the macro to be executed. The timer cannot be set when no macro is present.

The size of the timer control cannot be changed, but the position can. When the project runs, the timer control is not displayed on the HMI.


SamDraw多功能按钮

Multi-function Button

Multi-function button allows realizing the function of multi-step custom operation through one single control. It can simplify user operation. Click on the toolbar or double-click the existing multi-function button to enter the property page [image] ：

l General:

1. Button Appearance: shape, color, style, and other settings.

2. Available functions

Several functions are listed for user to select.

Set Coil: Set the input address.

Reset Coil: Reset the input address.

Coil Alternation: Invert the input address value; if the address value is 0, then it becomes 1; if 1, it becomes 0;

Coil Jog: When touched, the input address will be set; reset after releasing;

Screen Jump: Jump to the selected screen. Modify it to choose the screen to jump to.

Set data: Write the set value to the set address. You can select the type of data to be written, as well as the address and the data.

User input: Enter a value and write it to the set address. You can select the data type to be written and set the address to be written. When this command is executed, it will appear the data input interface where you can perform the above operation.

Select an available function and click Add to add the function to the list of selected features.

When "User Input" and "Coil Jog" are selected, only the User Input will be executed while the coil jog will not.

3. Added functions

When you select an available function, the function is listed here. Double click it or click "Modify" to set or modify. Click "Delete" to delete this function.

Application of multifunction button during the running time of configuration means performing all of the selected functions.

4. Macro

Select "Execute Macro" to see the list of macros. Choose a macro, and click the multi-function button to execute it when the project runs.

l Mark, Advanced and Permission settings: Refer to those of the Bit Button.

Refer to “Bit Switch” for hot keys of Advanced.

It can set up to 8 functions of multifunction button at the same time and only one Screen jump and one User input.


SamDraw控件操作说明

SamDraw control instruction

SamDraw provides full-featured basic controls. Users can double-click or right-click the control in the view area to set the properties. It can modify the position and size of controls manually in the status bar below or directly drag the mouse.

Address input of controls: It is available to input an address directly through a keyboard when it needs to operate on the PLC address. The address name is case-insensitive.

Status combo box: In the toolbar, there is a combo box where to display and change the state of bit button, bit indicator, multi-state button, multi-state indicator, graphics move, message display and picture display.

When a control of the above type is selected, its current state is displayed in the status combo box that users can pull down to change the current state.

Address Search: Query the use of an address and list the information of control occupying this address; double-click the information item to select the control.

Enter the address and select "Find", then the information output window will list the search results:

Choose the search result and double-click to select the control occupying the address currently.

Address Display: Click the "Address Display" to show the list of addresses used by the configuration project; double-click a message, then it will pop up the property page of control using this address so as to set the property settings easily and quickly.

In the Display Mode, you can specify the selected address information or display all the screens.

Overlay of control: You can execute multiple controls by one operation through stacking controls. SKTOOL supports stacking up to 32 controls. When multiple controls are overlaid and touched, the corresponding operations are performed in the order in which they are superimposed, as shown in Figure below:

Superimposing the control 1, 2 and 3, after the touch, execute in turn the command 1, 2 and 3.

If there is a screen switch button in the overlaid control, it will switch the screen when it comes to the turn of this command. The superimposed button commands that are after the screen button will not be executed. Similarly, if there is a pop-up input keyboard, it will pop up a keyboard while without executing the after commands.


SamDraw综述

System Setting

l Communication port setting

l Setting

l Screen

l Window

l Historical data collector

l Alarm setting

l Alarm display control

l Recipe

l Global Macro

l Initial Macro


SamDraw综述

Communication port setting

Communication port property is applied to set the communication parameters between GC controller and connected devices. 4.3 Inch GC Controller only supports communication mode of 485 via COM 1; COM 2 is occupied by internal communication of controller, thus it cannot be set. Use COM 1 to communicate with external PLC; settings are as shown below:

u Double click "Link" and “Link 1", as shown in Figure 6-1:

Figure 6-1 COM1Port property dialog box

Link ID：Set by system and no need to modify; ID of COM 1 port is 1.

Link Name：Set by system and no need to modify

Link Type: Only Serial Port is available for GC controller; system default and no need to modify.

Device / Server: Select corresponding service according to the PLC brand; select the PLC driver for specific PLC model.

Link Port: Correspond to “Link Name”.

PLC contiguous address: Continuous address refers to the maximum bytes that a command can read, specifically associated with the specific PLC. For example, the address interval is 16, and then it can read up to 8 consecutive word addresses. Up to 16 * 8 bit addresses can be read.

Communication Mode: Only RS485

Please select the device / server of MITSUBISHI if it is HuiChuang PLC.

u Click the Parameter tab of the dialog box, as shown in Figure 6-2:

Figure 6-2 COM1 port parameter setting

Parameter settings:

Baud rate: 1200/2400/4800/9600/19200/38400/57600/115200 / 187.5k; the default is 9600 (transmission speed=baud rate/1000ms).

Check: Odd / Even / None

Data bits: 7/8

Stop bits: 1/2

If columns of Baud rate, Data bits and Stop bits are transparent, set the settings same with the PLC.

HMI address: Depend on whether HMI serves as master station or slave station. Set it to 0 if HMI is the master station; set it to the specific station number if it is a slave station. For example, set it to 1 if HMI is the first slave station while 2 for the second station.

PLC address: Same with the HMI address. It needs to be set only when activating “One machine with multiple screens” or “One screen with multiple machines” connection.

Communication time: HMI sends data to the PLC and receives the data from PLC, and it cannot send data again until after the set communication time.

Retry: The number of times that the data is retransmitted after a timeout

Address mode:

① Standard mode: One serial port connects one PLC; ② Extended mode: One serial port connects multiple PLCs of the same type.

Communication mode: Only RS485 for 4.3 Inch Samkoon controller.

Cause of communication failure: Wrong communication parameters, wrong station number, wrong way of wiring, environment interference, etc.

No data returned: Wrong communication parameters, wrong station number or wrong way of wiring.

Wrong return length： Interference; Address of Read PLC or Write PLC out ou range

If columns of Baud rate, Data bits and Stop bits are transparent, set the settings same with the PLC.

HMI address: Depend on whether HMI serves as master station or slave station. Set it to 0 if HMI is the master station; set it to the specific station number if it is a slave station. For example, set it to 1 if HMI is the first slave station while 2 for the second station.

PLC address: Same with the HMI address. It needs to be set only when activating “One machine with multiple screens” or “One screen with multiple machines” connection.

Communication time: HMI sends data to the PLC and receives the data from PLC, and it cannot send data again until after the set communication time.

Retry: The number of times that the data is retransmitted after a timeout

Address mode:

① Standard mode: One serial port connects one PLC;

② Extended mode: One serial port connects multiple PLCs of the same type.

Communication mode: Only RS485 for 4.3 Inch Samkoon controller.

Cause of communication failure: Wrong communication parameters, wrong station number, wrong way of wiring, environment interference, etc.

No data returned: Wrong communication parameters, wrong station number or wrong way of wiring.

Wrong return length： Interference; Address of Read PLC or Write PLC out ou range


SamDraw 设置

Setting

It mainly introduces HMI settings.


SamDraw 触摸屏参数设置

HMI parameter settings

HMI model can be assigned when create a project or be modified during the configuration through HMI parameter settings in the Project Manager.

Double click “HMI Parameter Setting: in the Project Manager, then a dialog box pops up, as shown in Figure 6-3:

Figure6-3 HMI Parameter Setting dialog box

HMI Model: Model of HMI

Display mode: Adjust horizontal or vertical display screen.

Splash screen: The start screen of HMI when powered on

Screen Saver Time: Set screensaver time

Flicker Frequency: Set the flicker frequency of objects or controls which can blink; you can change the speed of flicker by inputting directly a value and clicking the spin button.

Alarm sound: When the alarm occurs, the touch screen can remind users through sound; the right drop-down menu contains two cases, with or without sound reminder.

Touch sound: Options in the right drop-down menu can decide Sound reminder or No sound reminder.

Screensavers screen: Select a screen among the existing screens as screensaver screen; just touch the screen to return the former screen.

Load Screen: If choose this option, the HMI will display the selected loading screen after power-on for a certain while, and then switch to the splash screen; thus users can give some tips or notes.

User Password Setting: Select this option and set up passwords. This function supports 8 sets of user password, each of which has eight levels of password for users to choose.

Password for Uploading: Select this option so that it is necessary to enter the password in order to upload project.


SamDraw HMI状态

HMI status

HMI state setting is employed to write the current HMI state information to the data register of PLC.

Double click the "HMI State" item in the Project Manager; a dialog box will pop up as shown in Figure 6-4:

Current screen NO: Write the serial number of the current HMI screen to the PLC.

Current recipe NO: When the serial number of the current recipe to the PLC.

Current user level: Write the current user level to the PLC.

Click "OK" HMI to complete the settings.


SamDraw PLC控制

PLC control

PLC control means realizing operations of screen switching, change user level, change recipe and write recipe through PLC. Double click "PLC Control" in the "Project Manager", the dialog box shown in Figure 6-5 will pop up:

Screen switch: Switch screens according to the address value. E.g. input 0 into the Register D5 occupied by Screen switch and then the screen will switch to Screen 1, and so on.

说明: 画面号 It needs the serial number in front of the screen.

Change recipe: HMI changes the recipe according to its address value.

Write recipe: HMI controls the write of the recipe based on its address value.

Current user level: HMI controls the current user level according to this address value.


SamDraw 时钟

Clock

Clock setting includes three functions: downloading system time to HMI, writing time to PLC and synchronization with PLC.

Double click “Clock” in the Project Manager to open the attribute setting box of Clock.

Download system clock to HMI: Whether to download the system clock information to HMI.

Write time/date to PLC:

The Data type and Length are default values.

Time: Year-Month-Day-Hour-Minute-Second-Week. Refer to LW 60000~LW 60006 in Register Address for detailed information. It cannot modify the Week in the system time.

Write address: The system time information will be written into this PLC address.

Startup Method:

Timing: Write the system time information into the specified PLC address periodically at specified time internal.

Trigger: The system time information will be written into the specified PLC address when the trigger address is 1.

Synchronization with PLC time:

The Data type and Length are default values.

Read address: The information in the PLC address will be read.

Startup Method:

Timing: Write the system time information into the specified PLC address periodically at specified time internal.

Trigger: The system time information will be synchronized with the PLC when the trigger address is 1.


SamDraw 文件保护

File protection

Password is necessary or not for the access of project file.

Double click the "File protection" in the “Project Manager", as shown in Figure 6-7 pop-up dialog box:

Figure 6-7 File Encryption dialog box

Select the "Use password to protect file" in the above dialog box; enter in the Password and Confirm Password; click "OK" to complete.

In this case, if user reopens the project, a password input box will be displayed as shown in Figure 6-8:

Figure 6-8 Password input box

Users need to input the password to open project.

图6-9 密码输入框

用户需输入密码才能打开工程。


SamDraw HMI保护

HMI protection

HMI protection is mainly employed to set a certain period of time during which HMI can functions normally. If the time is beyond the set period, HMI will jump to a specify screen where a password is necessary to re-use the HMI.

Double click the "HMI protection" option in the "Project Manager" to pop up dialog box shown in Figure 6-10:

Figure 6-10 HMI Protection dialog box

u Example to illustrate the application of this function:

➢Select "Use password protection": A password is required to enter the HMI protection the next time.

➢Select "Use HMI protection"

Set the "Total level password" to 3; select the 1 button icon, choose 2009-04-01 and 12-00-00 in the Time Limit column under the "Parameter settings"; decide the screen 1 as the "Prompt Screen"; Set "Password to unlock" to 1111. Then the level 1 protection is set up.

As in the above case, set the time limits and passwords for level 2 and level 3.

Assuming it is 8 o’clock, 2009-04-01now, since the time limit of level 1 HMI protection is 12-00-00, 2009-04-01, the HMI can still runs normally; while 4 hours, when it is 12 o’clock, the HMI will automatically jump to the set prompt screen (screen 1). Add a function button with the function of "Unlock HMI" to this screen. Then enter 1111 in the pop-up password input box of this button so as to remove the level 1 password protection and continue to operate.

Similarly, it needs to input the corresponding passwords when it reaches the time limit. When the protection of level 3 is removed, the HMI protection is hereby invalid.

This example illustrates the application of HMI protection; settings of the password level are similar to the above case.


SamDraw 画面

Screen

Create a new screen as shown in Figure 6-11:

Right click the "Screen" in the Project Manager, and then select "Add Screen" to create a new one. In the pop-up dialog box, set the properties such as "Screen Name"; click "OK".

Two ways to open other screens: double click the screen name in the "Project Manager"; right click the screen name and select "Open" in the pop-up menu.

Delete: Delete the screen by right clicking the screen name and selecting "Delete" in the pop-up menu.

Property: Right click the screen name, and select "Property" in the pop-up menu; or, the select "Screen Properties" in the menu bar.

Copy: Right click the screen name, and select "Copy" in the pop-up menu to copy; set the new screen name and click OK to complete.


SamDraw 窗口

Window

Way to add a new window is similar to that to create a new screen. Refer to screen operations for the open, delete, copy or properties of window. The Properties dialog box of the window is shown in Figure 6-12.

Figure 6-12 Window Properties dialog box

Height, Width: Set the height and width of the window respectively.

Display in Middle: When the window pops up, it is displayed in the center of the HMI.

Display in: Set the X-coordinate and Y-coordinate point on which to display the window. The origin of coordinates is the top left corner of the HMI screen.

Title: Enter the title name that will pop up as a title bar with the window.

Close Button: Whether the window has a close button.

Background Color: Set the background color of the window.


SamDraw 历史记录显示器

Historical data collector

The Historical Data Collector functions in conjunction with the Historical Data Display on the toolbar. The former is mainly applied for parameter settings while the latter is mainly to display the historical data.

Create a historical data collector by right clicking "Historical Data Collector" and select "New Historical Data Collector" in the pop-up menu.

Note: SKTOOL newly supports multiple sets of historical data; up to four historical data collectors can be built.

Note that you cannot create more than four sets; otherwise an error dialog box will pop up as follows:

Double click "Historical Data Collector 0" in "Project Manager" to open a dialog box as shown in Figure 6-13:

Figure 6-13 Historical Data Collector dialog box

Name: Set the name displayed in the Project Manager.

Sampling length: Number of data to be read from the memory for one time

Total number of samples: Data number of sampling

Total number of samples must divide exactly 50.

The memory required = (20 + total bytes of data types occupied by all data items) * total number of samples.

"20" refers to the bytes occupied by time and date;

“Total bytes of data types occupied by all data items” refers to the sum of the data types selected for each item on the Data Items page.

For example, as shown in Figure 6-14:

a, if the data type of each item is "16-bit positive integer", then "total bytes of data types occupied by all data items " = 2 +2 +2 +2 +2; that "all data items (20 + 10) * 2, which is equal to 60; the bytes number of "16-bit data " is 2 while "32-bit data occupies 4 bytes.

b. If the data type selected for "LH1" and "LH3" is "32-bit positive integer" (when the data type selected for "LH1" and "LH3" is "32-bit positive integer", the address of the "Data item" displays as LH0, LH1, LH3, LH5, LH6), then "the total number of bytes occupied by all data items" = 2 + 4 + 4 + 2 + 2= 14; then the required memory = (20 + 14) * 2= 68.

Read Address: Start address to read data (Refer to Data Item for detailed information)

Sampling method:

• Timing: Read data at set interval.

• Trigger: Read data when the value of the trigger address is 1.

• O’clock: Start reading data at a user-set time interval.

Full sample processing: disposal manner: Disposal when the data sampling reaches the maximum total number.

Stop sampling: Stop data sampling in case of full sampling; if this option is not selected, the new read data will replace the oldest one.

Notify: Inform an address whose value is 1 when the sampling number reaches the maximum.

Click the "Data Item" tab, set the page properties, as shown in Figure 6-14:

Figure 6-14 Data Item of Historical Data Collector

Click on any item in the list box to set the properties.

An example in detail:

Set the read address to LW1 on the General page, the register address is set consecutively and the sampling length is 5; click the Data Item tab and add 5 columns of data (LH0-LH4) in the list. Select each to set the properties such as name, address, data type, total digits decimal places and whether to scale.

Assuming that the names, data type and scaling of LH0-LH4 are set as shown below (other attributes are default values):

LH0-16 bit Positive integer, Scaling, with a gain of 3 and an offset of 2

LH1-32 bit positive integer, Scaling, with a gain of 2 and an offset of 1

LH2-16-bit integer, Scaling is not selected

LH3-32-bit integers, Scaling is not selected

LH4-Floating point, Scaling, with a gain of 4 and an offset of 5

After the settings, since the sample length is 5 (set in General page), it reads out 5 address values consecutively starting with "Read Address". Addresses are read according to the data type of each item.

If select 16-bit data, the extracted address is continuous. If 32-bit data is selected, the fetched addresses are separated. If the scaling function is selected, the final read value is equal to the value of read address multiplied by the gain plus the offset.

Note: The gain value in scaling must be greater than 1!

Set up each data type and whether to scale; the addresses to be read are as follows:

LH0-LW1 (16-bit data, read address + 1) Final value of LH0 = Address value of LW1 × 3 + 2

LH1-LW2 (32-bit data, read address +2) Final value of LH1 = Address value of LW2 × 2 + 1

LH2-LW4 (16-bit data, read address +1) Final value of LH2 = Address value of LW4

LH3-LW5 (32-bit data, read address +2) Final value of LH3 = Address value of LW5

LH4-LW7 (32-bit data, read address +2) Final value of LH4 = Address value of LW7 × 4 + 5

After settings, click "OK". Click "Historical data display" icon on the toolbar; set the row number to 5 in the pop-up dialog box, the other attribute values are by default.

Click "OK" to generate a table automatically in the screen, as shown in Figure 6-15:

Figure 6-15 Data Table of Historical Data Display

Application of the above table:

• Date: The date on which the address value is read

• Time: The time when to read the address value

• "kui": Display the value of the LW1 at a certain time.

• "看": Display the value of the LW2 at a certain time.

• "3": Display the value of the LW4 at a certain time.

• "4": Display the value of the LW5 address at a certain time.

• "5": Display the value of the LW7 address at a certain time.

For example, the read address is LW1, the user-defined data sampling length is 3, the total number of samples is 10, the sampling method is Trigger, the time interval is 1 second, and the data type of each data is the default;

The option of Stop Sampling is not selected:

The LW1, LW2, LW3 address values are read every 1 second. Since the total number of samples is 10, 10 sets of data are read out at the tenth second. Because the "Stop sampling" option is not selected, the process continues. A fixed memory area depending on the sampling length, total number of samplings and data type is allocated to store the read data, so when the number of data groups has reached the "total number of samplings," the latest read data will replace the first one.

The option of Stop Sampling option is selected:

The only difference is that it stops sampling when achieve the total number of samplings.

Employ “Historical Trends” or “Historical Data Display” to read the values more intuitively.


SamDraw对齐

Application case

The following example illustrates the combined application of Historical Data Collector, Historical Data Display and Historical Trend Graph.

1. Create new historical data collector

Right click the “Historical Data Collector” in the "Project Manager" to create a new one, as shown in Figure 1 below

Figure 1 Create a new historical data collector

2. Settings of Historical data collector

Double click to open Historical data collector, as shown in Figure 2

Figure 2 General settings of Historical data collector

Set the Sampling Length to 4, i.e. four continuous registers from Read Address. The total sampling here is set to 1000, that is, take a total of 1000 samples, until it is full. Read Address is D0, thus the four registers are D0, D1, D2 and D3.

Data Item Setting:

Figure 3 Historical Data Item Setting

Set data type and name for each address, 16-bit integer for example. Then LH0 is D0, named Data1. Click OK to complete settings of Historical data collector. After that, Historical data is available on touch screen via Historical Data Collector.

3、Historical Data Display Setting :

Figure 4 “General” Setting of Historical Data Display

Row number to be displayed is set to 7.

Figure 5 “Data” item setting of Historical Data Display

Check all data to be displayed. Click OK and add it to the screen, as shown below:

Figure 6 Historical data display on the screen

Employ “Historical trend chart” to display the value change if it is needed.

4. Open Historical trend chart, as shown below:

Figure 7 General setting of Historical trend chart

It needs to select the number of line to be displayed and its data source as well as color.

Figure 8 Line settings of Historical trend chart

Set the maximum value and time at XY axis.

Figure 9 XY axis settings of Historical trend chart

Click “OK” button to complete; draw the trend chart as shown below:

Figure 10 Historical trend charts on screen


SamDraw 配方组态

Recipe

In the field of manufacturing, recipe is used to describe the proportions of materials used to produce a product, and is a set of parameter settings of variables used during production.

For example, a basic recipe is necessary for bread making, and this recipe may list the weights or proportions of all materials used to make bread, such as water, flour, sugar, egg, oil, and so on. In addition, it may also list some optional materials such as fruit, nut, chocolate, and so on. These optional materials may be added to the basic recipe to make bread of different flavors. Take iron works for another example. A recipe in an iron works may be a set of machine parameters. For batch processing machines, a recipe may be used to describe different steps of the batch processing.

A machine may make both bread and cakes, including bread of different flavors and cakes of various forms. Here, we call the material proportions of bread as a recipe, and call the different material proportions of different flavors of bread as a file. Obviously, recipe records are contained in recipe files.

SamDraw provides the function of recipe configuration that is available in the Recipe of the menu bar or in the Project Manager, you can enter the recipe configuration dialog box, add a new set of recipe functions. As shown in Figure 6-24:

Figure 6-24 Recipe Property Settings Dialog Box

ü Name: Name of the current recipe file.

ü Description: Description: Name description of the current recipe file;

ü Recipe length: Set the length and quantity of the recording address to be read by the current recipe. Addresses of recipe record form are arranged in sequence automatically by the system, and cannot be changed. The maximum length of recipe is 4096.

ü

ü Total Number: Number of recipes, up to 512;

ü Note: Recipe length * Bytes occupied by data type * Total number <= 512KB

ü Data Type: Data type of the data register;

ü Write recipe to PLC: Set related data register address of recipe and PLC;

ü Read recipe from PLC: Set related data register address of recipe and PLC;

ü Recipe memory: The memory addresses range of the recipe in the HMI that is automatically generated and cannot be changed;

ü Current recipe: The recipe memory address in the HMI and the data register of PLC is automatically generated by order and cannot be changed;

ü Recipe Number Register: the recipe is arranged automatically by the order of serial number, and it cannot be changed; it corresponds to the order of recipe name in the data item.

The recipe data item, as shown in Figure 6-25:

Figure 6-25 Recipe Data Item Page

ü Name: The name of the current recipe;

ü Data: Write and display each address value of the current recipe;

ü Copy Recipe Data: Copy the data from the source recipe to the destination recipe. Click OK to save the current one and click Cancel to exit the dialog box. Once the recipe configuration has been completed, the interface can be designed to operate the recipe in the HMI.


SamDraw PLC控制

Application case

Application example of Recipe:

1. Create a new recipe

Create a recipe configuration as described above. The effect is shown in Figure 1:

Figure 1 Function of recipe data copy

Double click to open it, as shown in Figure 2:

Figure 2 “General” setting of Recipe

Set the Recipe Length to 4, which means one recipe contains four data items; set Number of recipe to 10, i.e. it has ten recipes in total; D50 for Write Recipe to PLC;

2. Data Item settings

Figure 3 “Data” item setting of recipe

Having set the recipe name, click OK. It can display recipe data via “Numerical Input and Display”. Select the internal memory address RWI: 0 to create a numerical display and input control on the screen. The input and display value is the recipe serial number. The value 0 of RWI0 means recipe serial number 1; the value 1 means recipe number 2, etc. Employ the control of Numerical Input and Display to present the data from D50 to D53. Functions concerning recipe of Function Buttons can be used to save or read recipes. Please refer to Function Button for details.

Figure 4 Numerical Input and Display control in D50

After all settings, create the Numerical Input and Display control on the screen.

Figure 5 Recipe Display

It is easily available to modify recipe parameters via the control of Numerical Input and Display; to preserve, read and write recipe through the Function Buttons.


SamDraw 资料传输

Data transmission

Applied to transmit data between PLC and HMI or between PLC and PLC

Click "Data Transmission" in the Project Manager to show the current data transmission list.

1. Select Data Transmission in the Project Manager; double click to open it, as shown below:

2. Click New button

3. As shown below:

(1). Attribute

Timing / Trigger: Select the trigger mode for data transfer.

Timing: Perform data transfer at the set interval.

Triggering: The transmission signal is controlled by specified address. Execute this command when the address value is 1.

Address Type: Select the address type to transfer data: Bit / Word / Double Word.

Word / Bit: Input the length of the data to be transferred. The length range is 1~ 32. The bigger it is, the slower it communicates, which effects the communication speed of the system.

(2). Address

Source Address: The source address of the transmitted data, which must be of the same type as the type of address set in the "Property".

Destination Address: The destination address of the transmitted data, which must be of the same type as the type of address set in the "Property".

Destination address and Source address cannot be on the same PLC. If transmit data from one serial port to another, please send data from the port to internal register first and then transmit it to another one.

E.g.: To transmit data from COM1 to COM2, it needs to send it from COM1 to internal register first and then transmit it again from the internal register to COM2.

4. Set all parameters and click OK to complete one data transmission; it can create up to 10 pieces.

5. Setting completed, as shown below:

1. Destination address and Source address cannot be on the same PLC. If transmit data from one serial port to another, please send data from the port to internal register first and then transmit it to another one.

2. It is impossible to transmit data between internal addresses; macros would be helpful if necessary.


SamDraw综述

Device Driver

It is important for the configuration to set I / O of device driver. Samkoon HMI can communicate with PLC, MCU, inverter and other industrial equipment, including the vast majority of PLCs: SAMKOON, MITSUBISHI, OMRON, SIEMENS, ALLEN-BRADLEY Rockwell, MATSUSHITA, DELTA, FATEK, etc. Or it can also monitor and control certain industrial control equipment via specific protocol, such as MODBUS RTU / ASCII, HOSTLINK and some other custom protocols.

I / O driver of each PLC or device is made into a file, so it only needs to select the corresponding PLC or device when creating a configuration project without the necessity for engineers to perform other complex programming operation. SamDraw can realize functions of all kinds of registers or relays of most PLCs or devices through simple and convenient configuration operations. There are three operation modes: read only, write only, read and write, meeting various requirements of industrial control.

To facilitate connections to different devices, Shenzhen Samkoon Technology Co., Ltd launches the service of developing device-driven according to the needs of users, simply with an appropriate protocol document of corresponding communication device. Users can contact Samkoon via the contact information provided at the end of this manual.

PLCs supported by Samkoon HMI:

PLC Manufacturer | Series | Communication Protocol
MITSUBISHI | FX/A | Programming port protocol
SIEMENS | S7-200 S7-300 | PPI/ MPI
OMRON | CPM | HostLink
MODICON | NEZA /NANO/TWIDO | Unitelway/Modbus
MATSUSHITA | FP | MELTOCOL
FUJI | NB | Programming port protocol
EMERSON | EC | Modbus RTU
DELTA | DVP | Proprietary protocol of Delta
VIGOR | VH/VB/M | Proprietary protocol of Vigor
KDN | K3 | Moubus RTU
Rockwell | MICROLOGIX/SLC | DF1
LG | MASTER-K | MASTER-K
Fatek | MA/MC | Proprietary protocol of Fatek
Haiwell | S/H | Modbus RTU
Techwayson | All series | Modbus RTU
ModBus Controller |  | Modbus RTU
Koyo | CCM protocol series | CCM
Hitachi | EH |
Hollysys | LM |
ALTEC | All series |
IDEC | MICRO Smart FC |
YOKOGAWA | FA |
ZhengHang Electronics | A5 |
Advantech Distributed I/O | ADAM-4017、ADAM-4060 |
GE | SNP-X、CMM |
T-VERTER | TP03 Series |

Pin definitions of Samkoon GC Controller

COM 1 is communication port for 485 while COM 2 is for internal usage and cannot be set.


SamDraw 松下MATSUSHITA FP系列 PLC与Sa

Matsushita FP Device Driver
说明: 说明: logo.gif

The device driver is used for Samkoon HMI to read and write the data or state of Matsushita FP series PLC register. The serial communication connection is established through the serial port on the touch screen and the serial port of Matsushita FP series PLC, so as to operate Matsushita FP series PLC. Prior to use of the driver, one shall carefully read related technical specifications of the chapter and Matsushita FP series PLC.

How to establish connection with Matsushita FP series PLC

1. Hardware connection

ü FP0/FP2/FP2SH/FPM CPU programming interface 说明: 说明: 34

说明: 说明: 2

Communication cable model：CA_MAT_1

ü FP0 CPU RS232，3-pin binding post

说明: 说明: 201

Communication cable model：CA_MAT_2

ü FP1/FP2/FP2SH/FP10SH CPU RS232 9-pin D type male connector

说明: 说明: 202

Communication cable model： CA_MAT_2

ü FP1 CPU RS422

说明: 说明: a

说明: 说明: 45

Communication cable model：CA_MAT_3

2. Software settings

Select MATSUSHITA in connection device service.

Select the corresponding item in connection device service according to the connected PLC model or supported protocol.

Ensure that the communication parameters in touch screen connection parameters and PLC station number are consistent with the PLC connected.

For settings of connecting PLC, please refer to the technical documents of the Matsushita FP series PLC.

Default connection parameters of Samkoon HMI

Setting item | Default
Communication port type | RS422
Baud rate | 9600
Data bit length | 8
Stop bit length | 1
Parity bit | ODD
PLC Address | 1

Operational register and address range

Register name | Input range | Type | Address format | Note
X | 0~999f | Read Only | ddddh | Bit: external input
Y | 0~999f | Read/Write | ddddh | Bit: external output
R | 0~999f | Read/Write | ddddh | Bit: internal relay
L | 0~999f | Read/Write | ddddh | Bit: link relay
T | 0~9999 | Read Only | dddd | Bit: status of timer
C | 0~9999 | Read Only | dddd | Bit: status of counter
WL_Bit | 0.00~99999.15 | Read/Write | ddddd.dd | Word: link relay
DT_Bit | 0.00~99999.15 | Read/Write | ddddd.dd | Word: data register
WL | 0~9999 | Read/Write | dddd | Word: link relay
DT | 0~99999 | Read/Write | ddddd | Word: data register
LD | 0~9999 | Read/Write | dddd | Word: link register
SV | 0~9999 | Read/Write | dddd | Word:
EV | 0~9999 | Read/Write | dddd | Word:

d represents decimal system, input range is 0-9;

h represents hexadecimal system, input range is 0-9, a-f;

Word in the remarks: represents the register can only be used as word;

Bit in the remarks: represents the register can only be used as bit;

Read only in the remarks represents that the register can only be read but not be written;

The names of the registers supported by different equipment model may be different, and the scopes may also be different.

For detailed name and scope, please consult related technical document of the connected device

l Communication failure analysis：

<1>.Fail to establish communication connection

1：Check the power of PLC

2：Whether to use communication cable

3：Check communication parameter settings

4：Check whether any register operation is out of range

<2>.Way to rule out unreliability of communication

Communication status switches between 0 and 1 frequently, which means unstable communication; possible reasons areas follow:

1： Communication distance is too far; within 500m for RS 422 while 15m for RS232.

2：Please contact Shenzhen Samkoon if connection between PLC and programming software functions.


SamDraw 艾默生EMERSON EC系列PLC与Samko

Emerson EC PLC Device Driver

The device driver is used for SK series HMI to read and write the data or state of Emerson EC series PLC register. The serial communication connection is established through the serial port of HMI and the serial port of Emerson EC series PLC, so as to operate Emerson EC series PLC. Prior to use of the driver, one shall carefully read related technical specifications of the chapter and Emerson EC series PLC.

l How to establish connection with Emerson EC series PLC

1. Hardware connection

ü Connect to programming interface via communication cable

Communication cable type：CA_EMR_1

Set Run Control Switch On to switch into specific protocol, i.e. MODBUS Protocol.

2. Software settings

Select MODBUS Protocol in PLC programming software; set PLC Address to 1; select RTU for Transmission mode and others are consistent with that of Samkoon HMI. For detailed settings, please refer to the technical documents of the Emerson PLC.

Recommended settings of HMI

Setting item | Recommended Value
Communication port type | RS232
Baud rate | 19200
Data bit length | 8
Stop bit length | 1
Parity bit | EVEN
PLC Address | 1

Operational register and address range:

PLC Address | Value Range | Type | Format | Remarks
X | 0~377 | Read | Xooo | I/O Input point
Y | 0~377 | Read/Write | Yooo | I/O Output point
M | 0~1119 | Read/Write | Mdddd | Intermediate register
D | 0~7999 | Read/Write | Ddddd | Data register
T | 0~255 | Read | Tddd | Timer coil
C | 0~255 | Read | Cddd | Counter coil
T* | 0~255 | Read/Write | T*ddd | Timer process value
C* | 0~199 | Read/Write | C*ddd | Counter process value
D_Double | 0~255 | Read | D_Doubleddd |
C*_Double | 0~255 | Read | C*_Doubleddd |

d represents decimal system, input range is 0-9;

h represents hexadecimal system, input range is 0-9, a-f;

Word in the remarks: represents the register can only be used as word;

Bit in the remarks: represents the register can only be used as bit;

Read only in the remarks represents that the register can only be read but not be written;

The names of the registers supported by different equipment model may be different, and the scopes may also be different.

For detailed name and scope, please consult related technical document of the connected device

l Communication failure analysis：

<1>.Fail to establish communication connection

1. Check the power of PLC

2. Whether to use communication cable

3. Check communication parameter settings

4. Check whether any register operation is out of range

5. Check whether Run Control Switch is ON

<2>.Way to rule out unreliability of communication

Communication status switches between 0 and 1 frequently, which means unstable communication; possible reasons areas follow:

1. Communication distance is too far; within 500m for RS 422 while 15m for RS232.

2. Please contact Shenzhen Samkoon if connection between PLC and programming software functions.


SamDraw 丰炜系列PLC与Samkoon系列触摸屏的连接

Vigor PLC Device Driver
说明: 说明: logo.gif

The device driver is used to read and write the data or state of Vigor PLC register. The serial communication connection is established through the serial port on the touch screen and the serial port of Vigor V/VH/VB/M series PLC, so as to operate Vigor V/VH/VB/M series PLC. Prior to use of the driver, one shall carefully read related technical specifications of the chapter and Vigor PLC.

How to establish connection with Vigor PLC

1. Hardware connection

ü Connect to PLC programming interface via RS232

说明: 说明: 203

Communication cable type：CA_VIGOR_1

ü Connect Vigor VS series PLC to programming interface via communication cable 485:

说明: 说明: image007.png 说明: 说明: img.gif

Communication parameter settings of Vigor VS series PLC:

Default communication parameter:

Select Online Setting –Initialize PLC in Menu

2. Software settings

For detailed settings of the connected PLC, please consult related technical documents of Vigor PLC.

Default connection parameters of Samkoon HMI

Setting item | Default value
Communication port type | RS232
Baud rate | 19200
Data bit length | 7
Stop bit length | 1
Parity | EVEN
PLC station number | 0

Operational register and address scope

HMI Address | Value range | Type | Format | Corresponding PLC address | Control example | Description
X | 0〜377 | Read only | Xooo | X0〜X377(octal) | X5 | Bit: Input relay X
Y | 0〜377 | Read/Write | Xooo | Y0〜Y377(octal) | Y123 | Bit: Output relay Y
M | 0〜8191 | Read/Write | Mddd | M0〜M8191 | M1234 | Bit:Auxiliary relay M
S | 0〜4095 | Read/Write | Sdddd | S0〜S4095 | S100 | Bit: Step relay
SM | 0〜511 | Read/Write | SMddd | SM9000 〜SM9511 | SM12 | Bit: Special relay SM
D_Bit | 0〜8999 0〜F | Read/Write | D_Bitdddd.dd | D0〜D8999 D.0〜D.F | D_Bit 123.15 | Bit: Bit unit of Temporary storage D D.b
R_Bit | 0〜25999 0〜F | Read/Write | R_Bitddddd.dd | R0〜R25999 的 R.0〜R.F | R_Bit 999 .12 | Bit: Bit unit of Temporary storage R R.b
T* | 0〜511 | Read/Write | T*ddd | T0〜T511 | T*25 | Bit: Timer T coil
T | 0〜511 | Read only | Tddd | T0〜T511 | T123 | Bit: Timer T contact
C* | 0〜255 | Read/Write | C*ddd | C0〜C255 | C*12 | Bit: Counter C coil
C | 0〜255 | Read only | Cddd | C0〜C255 | C200 | Bit: Counter C contact
D | 0〜8999 | Read/Write | Ddddd | D0〜D8999 | D1000 | Word: Text value of Temporary storage D
SD | 0〜511 | Read/Write | SDdddd | SD9000〜 SD9511 | SD255 | Word: Text value of Temporary storage SD
R | 0〜25999 | Read/Write | Rdddd | R0〜R25999 | R12345 | Word: Text value of Temporary storage R
TV | 0〜511 | Read/Write | TVddd | T0〜T511 | TV255 | Word: Current value of Timer T
CV | 0〜199 | Read/Write | CVddd | C0〜C199 | CV120 | Word: current value of 16-bit timer
32CV | 200〜255 | Read/Write | 32CVddd | C200〜C255 | 32CV235 | Word: current value of 32-bit timer

d represents decimal system, input range is 0-9;

h represents hexadecimal system, input range is 0-9, a-f;

Word in the remarks: represents the register can only be used as word;

Bit in the remarks: represents the register can only be used as bit;

Read only in the remarks represents that the register can only be read but not be written;

The names of the registers supported by different equipment model may be different, and the scopes may also be different.

For detailed name and scope, please consult related technical document of the connected device

l Communication failure analysis：

<1>.Fail to establish communication connection

1. Check the power of PLC

2. Whether to use communication cable

3. Check communication parameter settings

4. Check whether any register operation is out of range

5. Check whether Run Control Switch is ON

<2>.Way to rule out unreliability of communication

Communication status switches between 0 and 1 frequently, which means unstable communication; possible reasons areas follow:

1. Communication distance is too far; within 500m for RS 422 while 15m for RS232.

2. Please contact Shenzhen Samkoon if connection between PLC and programming software functions.


SamDraw 莫迪康MODBUS协议与Samkoon系列触摸屏

Modicon MODBUS Device Driver

The device driver is used for Samkoon HMI to read and write the data or state of Modicon PLC register. The serial communication connection is established through the serial port on the touch screen and the serial port of Modicon PLC, so as to operate it. Prior to use of the driver, one shall carefully read related technical specifications of the chapter and Modicon NEZA/TWIDO series PLC.

NEZA series PLC communicates with HMI through MODBUS and extended communication module or interface instead of programming interface. Please refer to specific manual of Modicon PLC.

l How to establish connection with PLC

1. Hardware connection

ü Connect to PLC programming interface via communication cable

Communication Cable Type：CA_MODICON_1

2. Software settings

Select RTU for Transmission mode and others are consistent with that of Samkoon HMI. For detailed settings, please refer to the technical documents of the Schneider PLC.

Recommended parameter settings of HMI

Setting item | Recommended Value
Communication port type | RS485
Baud rate | 9600
Data bit length | 8
Stop bit length | 1
Parity bit | ODD
PLC Address | 1

Operational register and address range

PLC Address | Value range | Type | Format | Description
0x | 0~9999 | Read/Write | 0dddd | Logic coil
1x | 0~9999 | Read | 1dddd | Input bit register
3x | 0~9999 | Read | 3dddd | Analog input register
4x | 0~9999 | Read/Write | 4dddd | Preservation register

d represents decimal system, input range is 0-9;

h represents hexadecimal system, input range is 0-9, a-f;

Word in the remarks: represents the register can only be used as word;

Bit in the remarks: represents the register can only be used as bit;

Read only in the remarks represents that the register can only be read but not be written;

The names of the registers supported by different equipment model may be different, and the scopes may also be different.

For detailed name and scope, please consult related technical document of the connected device

l Communication failure analysis：

<1>.Fail to establish communication connection

1. Check the power of PLC

2. Whether to use communication cable

3. Check communication parameter settings

4. Check whether any register operation is out of range

5. Check whether Run Control Switch is ON

<2>.Way to rule out unreliability of communication

Communication status switches between 0 and 1 frequently, which means unstable communication; possible reasons areas follow:

1. Communication distance is too far; within 500m for RS 422 while 15m for RS232.

2. Please contact Shenzhen Samkoon if connection between PLC and programming software functions.


SamDraw 莫迪康Unitelway协议与Samkoon系列

Modicon Unitelway Device Driver

The device driver is used for Samkoon HMI to read and write the data or state of Modicon network device register. The serial communication connection is established through the serial port on the touch screen and the programming port of Modicon Unitelway network device so as to operate Modicon PLC. Prior to applicatopn of the driver, it should read related technical specifications of the chapter and Modicon TSX/Micro/NANO/NEZA series PLC.

l How to establish connection with Modicon PLC

1. Hardware connection

ü Connect to PLC programing interface via communication cable

Communication cable type：CA_MODICON_2

2. Software settings

Ensure that the communication parameters in touch screen connection parameters and PLC station number are consistent with the connected PLC.

Recommended communication parameters of HMI:

Setting item | Recommended value
Baud rate | 9600
Communication port type | RS485
Data bit length | 8
Stop bit length | 1
Parity bit | ODD

Operational register and address range

PLC Address | Value range | Type | Format | Description
MW | 0~1023 | Read/Write | MWdddd | Intermediate register

dddd represents decimal system

Different PLC models maybe support different registers; please take that supported by actual PLC as a standard.

l Communication failure analysis：

<1>.Fail to establish communication connection

1. Check the power of PLC

2. Whether to use communication cable

3. Check communication parameter settings

4. Check whether any register operation is out of range

5. Check whether Run Control Switch is ON

<2>.Way to rule out unreliability of communication

Communication status switches between 0 and 1 frequently, which means unstable communication; possible reasons areas follow:

1. Communication distance is too far; within 500m for RS 422 while 15m for RS232.

2. Please contact Shenzhen Samkoon if connection between PLC and programming software functions.


SamDraw 三菱MITSUBISHI FX/A系列PLC与S

三菱MITSUBISHI FX/A系列PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写三菱FX/A系列中支持无通信协议的PLC设备。通过触摸屏中的串行口设备和PLC上的通讯单元（编程口）建立串行通讯连接，从而达到操作PLC设备的目的，使用本构件前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的FX/A系列PLC包括有FX0N，FX1N，FX1S，FX2N，FX3U采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。其中FX-N系列的PLC请选择设备服务FX3G-24MR/ES-A，FX-2N的PLC请选择设备服务FX-2N CPU Port，FX-3U的PLC请选择设备服务FX-3U CPU Port。

l 如何建立与PLC的连接：

1.硬件连接

ü 与编程口连接

采用9针串口（DB9）-8针圆口，连接Samkoon触摸屏的口是母头，连接MITSUBISHI三菱PLC的口是公头，串口电缆的长度不要超过12M。

通信电缆型号：CA_FX_1

ü 与通讯模块RS232BD连接

采用9针串口（DB9）-9孔串口（DB9），连接Samkoon触摸屏的口是母头，连接RS232BD模块的口是公头，串口电缆的长度不要超过12M。

通信电缆型号：CA_FX_2

ü 与通讯模块RS485BD连接

采用9针串口（DB9）-5点接线端子，连接Samkoon触摸屏的口是母头，连接RS485BD模块的口是5点接线端子，电缆的长度不要超过12M。

通信电缆型号：CB_FX485

PLC通信参数设置：

1.GX Developer软件中的左边的工程栏中选择“PLC参数”

2.弹出如下对话框：

3.勾选通信设置操作，然后做如下设置：

4.保存设置，然后下载到PLC中。

ü 三菱QC24N模块PLC连接设置

232通信线连接线示意图

1. 波动开关拨到停止

2. 选择“在线”—>“PLC数据删除”。显示如下界面： 选择“main”和“PLC/网络/远程口令”，然后点击执行。

3. 选择“PLC参数”

选择I/O分配项

类型选择“智能”，点数选择“32点”，然后点击选择设定。弹出如下框,依次选择对应的模块种类和模块型号

并点击OK，进入如下设置。

4. 选择“在线”—>“PLC写入”

三菱Q系列的串口232通信一般这样配置就可以了。不过下载的时候一定不要选“软元件注释”

5.拨码开关拨到运行。

附：

若以上设置还是连接不上，执行步骤2删除PLC数据参数。然后把拨码开关拨到复位，测试通信情况。然后再按以上步骤检查设置。

2.软件设置：

系统默认设置：D8120=H0086表示9600，7，偶校验，1位停止位，无命令头和命令尾，整个命令不加校验和，无协议的通信方式。触摸屏上的设置必须要与PLC的设置相同。

在触摸屏中定义通讯参数为：

设置项 | 缺省值
通信口类型 | RS422
波特率： | 9600
数据位长度 | 7
停止位长度 | 1
奇偶校验位 | 偶校验

FX/FX-2N模块可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~177 | 读 | Xooo | 位：I/O输入点
Y | 0~177 | 读写 | Yooo | 位：I/O输出点
M | 0~7999 | 读写 | Mdddd | 位：内部辅助寄存器
T | 0~255 | 读 | Tddd | 位：定时器触点
C | 0~255 | 读 | Cddd | 位：计数器触点
T* | 0~255 | 读写 | T_Vddd | 字：定时器经过值
C* | 0~255 | 读写 | C_V ddd | 字：计数器经过值
D | 0~7999 | 读写 | Ddddd | 字：数据寄存器

FX3U模块可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~377 | 读 | Xooo | 位：I/O输入点
Y | 0~377 | 读写 | Yooo | 位：I/O输出点
M | 0~7679 | 读写 | Mdddd | 位：内部辅助寄存器
T | 0~511 | 读 | Tddd | 位：定时器触点
C | 0~255 | 读 | Cddd | 位：计数器触点
T* | 0~511 | 读写 | T_Vddd | 字：定时器经过值
C* | 0~255 | 读写 | C_V ddd | 字：计数器经过值
D | 0~7999 | 读写 | Ddddd | 字：数据寄存器
S | 0~4059 | 读写 | Sdddd | 位：状态位
R | 0~32767 | 读写 | Rdddd | 位：文件寄存器
CV32 | 200~255 | 读写 | CV32 ddd | 双字：计数器经过值

Q00J模块可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~177 | 读 | Xooo | 位：I/O输入点
Y | 0~177 | 读写 | Yooo | 位：I/O输出点
M | 0~7999 | 读写 | Mdddd | 位：内部辅助寄存器
T | 0~255 | 读 | Tddd | 位：定时器触点
C | 0~255 | 读 | Cddd | 位：计数器触点
T* | 0~255 | 读写 | T_Vddd | 字：定时器经过值
C* | 0~255 | 读写 | C_V ddd | 字：计数器经过值
D | 0~7999 | 读写 | Ddddd | 字：数据寄存器
L | 0~2047 | 读写 | dddd | 位：锁存继电器
B | 0~7ff | 读写 | hhh | 位：变换继电器
V | 0~2047 | 读写 | dddd | 位：变址继电器
W | 0~7ff | 读写 | hhh | 字：变换寄存器
SW | 0~7ff | 读写 | hhh | 字：特殊链接寄存器

QC24N模块可操作地址范围(OK)：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~7FF | 读 | Xooo | 位：I/O输入点
Y | 0~7FF | 读写 | Yooo | 位：I/O输出点
M | 0~8191 | 读写 | Mdddd | 位：内部辅助寄存器
L | 0~2047 | 读写 | Ldddd | 位：锁存继电器
B | 0~7ff | 读写 | B hhh | 位：变换继电器
V | 0~1023 | 读写 | V dddd | 位：变址继电器
D | 0~11135 | 读写 | D ddddd | 字：数据寄存器
W | 0~7ff | 读写 | W hhh | 字：变换寄存器
SW | 0~3ff | 读写 | SW hhh | 字：特殊链接寄存器

485BD模块可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~377 | 读 | Xooo | I/O输入点
Y | 0~377 | 读写 | Yooo | I/O输出点
M | 0~7999 | 读写 | Mdddd | 内部辅助寄存器
S | 0~4095 | 读写 | Sdddd | 位，步进继电器
SM | 8000~8999 | 读写 | SMdddd | 特殊中间继电器
T | 0~511 | 读写 | Tddd | 定时器触点
D_bit | 0~7999的0~f | 读写 | Dddd.dd | 数据寄存器的位
C | 0~255 | 读写 | Cddd | 计数器触点
TV | 0~511 | 读写 | TVddd | 定时器经过值
CV | 0~199 | 读写 | CVddd | 计数器经过值
CV32 | 200~255 | 读写 | CVddd | 双字，特殊32计数器当前值
D | 0~7999 | 读写 | Ddddd | 数据寄存器
SD | 8000~8999 | 读写 | SDdddd | 特殊寄存器
R | 0~32767 | 读写 | Rdddd | 文件寄存器

Birne ：dddd表示十进制，ooo表示8进制。

Birne ：不同的PLC型号支持的寄存器和范围有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：组态的PLC型号是否与连接的型号一致

5：检查对某一寄存器的操作是否超出范围，以下是常用寄存器的范围

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件和编程电缆能与PLC连接，则请与深圳显控联系。


SamDraw 西门子SIEMENS S7-200系列 PLC与

SIEMENS S7-200系列 PLC

本设备驱动用于Samkoon系列触摸屏读写西门子SIEMENS S7-200系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与西门子SIEMENS S7-200系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的S7-200系列PLC型号有：S7_21X、S7_22X，200cn系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_S200

2.软件设置：

设置PLC的通信协议为PPI协议

PLC设备地址默认为2，请设为2。

通信参数的设置要与触摸屏设置一致。

具体设置请参阅SIEMENS公司的相关使用手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS485
波特率： | 9600
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 偶校验
PLC站地址 | 2

可操作地址范围：

对应PLC寄存器 | 寄存器名称 | 输入范围 | 类型 | 地址格式 | 备注
I | I | 0.0~4095.7 | 只读 | dd.o | 位：输入映像寄存器，只读
Q | Q | 0.0~15.7 | 读写 | dddd | 位：输出映像寄存器
M | M | 0.0~31.7 | 读写 | dddd | 位：位存储器
V(位) | V_B | 0.0~10239.7 | 读写 | dddd | 位：变量存储器的位
T(位) | T | 0~255 | 只读 | ddd | 位：定时器状态,只读
C(位) | C | 0~255 | 只读 | ddd | 位：计数器状态,只读
S | S | 0.0~31.7 | 读写 | ddd | 位：顺序控制继电器
SM | SM | 0.0~549.7 | 读写 | ddd | 位：特殊位存储器,SM0.0-SM29.7只读
VW | V | 0-10238 | 读写 | ddd | 字：变量存储器，8位寄存器，每个字占用两个地址
MW | MW | 0-30 | 读写 | ddd | 字：位存储器，8位寄存器，每个字占用两个地址
VD | VD | 0~10236 | 读写 | dddd | 双字：变量存储器，8位寄存器，每个双字占用4个地址
T(字) | TV | 0~255 | 读写 | ddd | 字：定时器当前值
C(字) | CV | 0~255 | 读写 | ddd | 字：计数器当前值

附录：

dd表示十进制，o表示8进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

5：通信时间设置成40ms。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过500米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


西门子SIEMENS S7-300系列 PLC与Samkoon系

西门子SIEMENS S7-300系列 PLC设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写西门子SIEMENS S7-300系列PLC寄存器的数据或状态。通过触摸屏的串行口设备与西门子SIEMENS S7-300系列的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与西门子SIEMENS S7-300系列的PLC相通讯。

l 如何建立与PLC的连接：

1.硬件连接：

通过通讯电缆和MPI电缆与PLC连接，以下是详细的连接图：

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | SIEMENS S7-300系列 | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持SIEMENS S7-300系列PLC
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 19200 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 奇（ODD） | Samkoon SA系列触摸屏有偶校验（EVEN），奇校验（ODD），无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 2 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
超时时间 | 20 | 单位为0.1s，20即表示在2秒内触摸屏未收到相应的恢复则弹出通信失败提示，一般采取默认设置
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“SIEMENS(西门子)”和“S7-300 MPI系列PLC”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。

可操作的地址范围：

可操作地址是以一个SIEMENS S7-300系列PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照SIEMENS S7-300系列PLC使用手册说明，且按以下的I/O分配来操作：

PLC地址类型 | 取值范围 | 类型 | 地址格式 | 描述
I | 0.0~4095.7 | 读 | I dddd.o | 位:外部输入
Q | 0.0~4095.7 | 读写 | Q dddd.o | 位:内部输出
M | 0.0~4095.7 | 读写 | M dddd.o | 位：中间继电器
DBBit | 0 0000.0~2558192.7 | 读写 | DBBit DDDdddd.o | DB块存储区的字的位，块号DDD 0~255，每个块字dddd 0~8192，每个字的位o 0~7
MW | 0~4095 | 读写 | MW dddd | 字：位存储器，8位寄存器，每个字占用两个地址
DB | 0 0000~2558192 | 读写 | DB DDDdddd | 字：DB块存储区，块号DDD 0~255，每个块字dddd 0~8192，8位寄存器，每个字占用两个地址

hhh表示16进制，dddd表示10进制，o表示8进制。

DBBit的地址格式： D:块号，dddd：块内地址；o：字节位，默认情况块号为0。

DB的地址格式：D:块号，dddd：块内地址，默认情况块号为0。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

5：通信时间设置成40ms。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 富士FUJI NB系列 PLC与Samkoon系

富士FUJI NB系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写富士FUJI NB系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与富士FUJI NB系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_NB

2.软件设置：

PLC通信参数要与触摸屏设置一致，不需要设定PLC站地址。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS422
波特率： | 19200
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 奇校验

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~1F | 读 | Xhh | I/O输入点
Y | 0~1F | 读写 | Yhh | I/O输出点
M | 0~FF | 读写 | Mhh | 中间寄存器
D | 0~1F | 读写 | Dhh | 数据寄存器
T | 0~1F | 读 | Thh | 定时器线圈
C | 0~1F | 读 | Chh | 计数器线圈
T* | 0~1F | 读 | T* hh | 定时器经过值
C* | 0~1F | 读 | C* hh | 计数器经过值

hh表示16进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过500米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 凯迪恩KDN K3系列PLC与Samkoon系列

凯迪恩KDN K3系列PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写凯迪恩KDN K3系列PLC(CPU304，CPU304EX，CPU306，CPU306EX，CPU308)寄存器的数据或状态。通过触摸屏中的串行口设备与凯迪恩KDN K3系列PLC的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的K3系列PLC型号有：CPU304，CPU304EX，CPU306，CPU306EX，CPU308。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_KDN232_1

2.软件设置：

在PLC编程软件中设定PLC设备地址为1，通信参数与Samkoon触摸屏设定一致，建议采用推荐设置。

具体设置请参阅凯迪恩KDN公司的相关使用手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 9600
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 无校验
PLC站地址 | 1

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
I | I0.0~I7.7 | 读 | Id.o | I/O输入点
Q | Q0.0~Q7.7 | 读写 | Qd.o | I/O输出点
M | M0.0~M31.7 | 读写 | Mdd.o | 中间寄存器
V | 0~4094 | 读写 | Vdddd | 数据寄存器

d表示十进制，o表示八进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 台达DELTA DVP系列 PLC与Samkoo

台达DELTA DVP系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写台达DELTA DVP系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与台达DELTA DVP系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的DVP系列PLC型号有：ES，EP，EH系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_DVP232

ü 通过通信电缆与PLC 485通讯端口连接

通信电缆型号：CB_DVP485

2.软件设置：

PLC设备地址默认为1，请设为1。

设置D1120为H86。

具体设置请参阅台达DELTA公司的相关技术手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 9600
数据位长度 | 7
停止位长度 | 1
奇偶校验位 | 偶校验
PLC站地址 | 1

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~177 | 读 | Xooo | 位：I/O输入点
Y | 0~177 | 读写 | Yooo | 位：I/O输出点
M | 0~1279 | 读写 | Mdddd | 位：中间寄存器
D | 0~1143 | 读写 | Ddddd | 字：数据寄存器
T | 0~127 | 读写 | Tddd | 位：定时器线圈
C | 0~127 | 读写 | Cddd | 位：16位计数器线圈
C | 232~255 | 读写 | Cddd | 位：32位计数器线圈
S | 0~1023 | 读写 | Sddd | 位：步进继电器
T* | 0~127 | 读写 | T*ddd | 字：定时器经过值
C* | 0~127 | 读写 | C*ddd | 字：16位计数器经过值

ddd表示十进制，ooo表示8进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw LG MASTER-Kxxx系列 PLC与Sam

LG MASTER-Kxxx系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写LG MASTER Kxxx系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与LG MASTER Kxxx系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的MASTER Kxxx系列PLC型号有：K10S/30S/60S/80S/120S/K200S。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_LG232

2.软件设置：

PLC设备地址默认为0，请设为0。

具体设置请参阅LG公司的相关技术手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 19200
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 无
PLC站地址 | 0

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
P | 0~7F | 读写 | Phh | I/O输入输出点
M | 0~31F | 读写 | Mhhh | 辅助继电器
L | 0~31F | 读写 | Lhhh | 连接继电器
K | 0~31F | 读写 | Khhh | 保持继电器
T | 0~255 | 读写 | Tddd | 定时器线圈
C | 0~255 | 读写 | Tddd | 计数器线圈
T* | 0~255 | 读写 | Cddd | 定时器当前值
C* | 0~255 | 读写 | Cddd | 计数器当前值
D | 0~9999 | 读写 | D_dddd | 数据寄存器

ddd表示十进制，hh表示16进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 永宏FB系列 PLC与Samkoon系列触摸屏的

永宏FB,B1z/B1系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写永宏FB系列,B1z/B1系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与永宏FB系列,B1z/B1系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的FB系列PLC型号有MA和MC两个系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 与PLC编程端口连接

通信电缆型号：CA_FATEK232

2.软件设置：

PLC设备地址默认为1，请设为1。

具体设置请参阅永宏FACON公司的相关技术手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 9600
数据位长度 | 7
停止位长度 | 1
奇偶校验位 | 偶校检
PLC站地址 | 1

FB系列可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~255 | 读 | Xddd | I/O输入点
Y | 0~255 | 读写 | Yddd | I/O输出点
M | 0~9999 | 读写 | Mddd | 辅助继电器
D | 0~9999 | 读写 | Dddd | 数据寄存器
S | 0~999 | 读写 | Sddd | 步进继电器
T | 0~255 | 读 | Tddd | 定时器
C | 0~255 | 读 | Cddd | 计数器
R | 0~9999 | 读写 | Rddd | 数据寄存器
T* | 0~255 | 读写 | T*ddd | 定时器经过值
C* | 0~255 | 读写 | C*ddd | 计数器经过值

B1z/B1系列可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~255 | 读 | Xddd | I/O输入点
Y | 0~255 | 读写 | Yddd | I/O输出点
M | 0~9999 | 读写 | Mddd | 辅助继电器
S | 0~999 | 读写 | Sddd | 步进继电器
T | 0~255 | 读写 | Tddd | 定时器
C | 0~255 | 读写 | Cddd | 计数器
R | 0~9999 | 读写 | Rddd | 数据寄存器
RT | 0~255 | 读写 | RTddd | 16位定时器当前值
RC | 0~200 | 读写 | RCddd | 16位计数器当前值
DRT | 0~255 | 读写 | DRTddd | 32位定时器当前值
DRC | 200~255 | 读写 | DRCddd | 32位计数器当前值

ddd表示十进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 海为S/H系列 PLC与Samkoon系列触摸屏

海为S/H系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写海为S/H系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与海为S/H系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的PLC型号有S和H两个系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

与PLC编程端口连接

通信电缆型号：CA_HW

2.软件设置：

PLC设备地址默认为1，请设为1。

具体设置请参阅海为公司的相关技术手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 19200
数据位长度 | 8
停止位长度 | 2
奇偶校验位 | 无校检
PLC站地址 | 1

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~255 | 读 | Xddd | I/O输入点
Y | 0~255 | 读写 | Yddd | I/O输出点
M | 0~9999 | 读写 | Mdddd | 辅助继电器
S | 0~9999 | 读写 | Sdddd | 步进继电器
T | 0~255 | 读写 | Tddd | 定时器
C | 0~255 | 读写 | Cddd | 计数器
T* | 0~255 | 读写 | T*ddd | 定时器
C* | 0~255 | 读写 | C*ddd | 计数器

ddd表示十进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 德维森V80系列PLC与Samkoon系列触摸屏

德维森V80系列PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写德维森V80系列PLC寄存器的数据或状态。使用标准的MODBUS RTU协议。通过触摸屏中的串行口设备与德维森V80系列PLC的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的德维森PLC型号有：V80系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC的232编程端口连接

通信电缆型号：CA_DWS

2.软件设置：

PLC的通信模式必需设置为RTU模式，站地址要与触摸屏设置一致。具体设置请参考德维森PLC的相关技术手册。

PLC通信参数请与触摸屏中设置一致。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 19200
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 偶校验
PLC站地址 | 1

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
0x | 00001~09984 | 读写 | 0xdddd | 逻辑线圈（输出点和辅助节点）
1x | 10001~19984 | 读 | 1xdddd | 输入位寄存器
3x | 30001~30512 | 读 | 3xdddd | 模拟输入寄存器
4x | 40001~49999 | 读写 | 4xdddd | 保持寄存器

dddd表示十进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：是否选择了正确的通信口。

5：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw ModBus Controller与Samkoo

ModBus Controller设备驱动

本设备驱动用于Samkoon系列触摸屏读写ModBus Controller寄存器的数据或状态。使用标准的MODBUS RTU协议。通过触摸屏中的串行口设备与ModBus Controller的通讯口建立起串行通讯连接，从而达到操作该控制器 设备的目的。使用本驱动前，请先阅读通讯单元和控制器设备的有关技术说明书。支持的所有支持ModBus RTU协议的控制器。

l 如何建立与ModBus Controller的连接：

1.硬件连接

ü ModBus RS232端口

ü ModBus RS422端口

ü ModBus RS485端口

2.软件设置：

PLC的通信模式必需设置为RTU模式，站地址要与触摸屏设置一致。具体设置请参考施耐德提供的关于ModBus RTU协议相关技术手册。

PLC通信参数请与触摸屏中设置一致。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232/422/485
波特率： | 9600
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 无校验
PLC站地址 | 1

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
0x | 0~65535 | 读写 | 0xdddd | 逻辑线圈
1x | 0~65535 | 读 | 1xdddd | 输入位寄存器
3x_Bit | 0.00~65535.15 | 读 | ddddd.DD | 位：16位输入寄存器的位，只读
4x_Bit | 0.00~65535.15 | 读写 | ddddd.DD | 位：16位输入寄存器的位
3x | 0~65535 | 读 | 3xdddd | 输入寄存器
4x | 0~65535 | 读写 | 4xdddd | 保持寄存器
3x_D | 0~65535 | 读 | 3x_Ddddd | 输入寄存器
4x_D | 0~65535 | 读写 | 4x_Ddddd | 保持寄存器

dddd表示十进制,3x_D、4x_D仅限32位数使用，高16位在前，低16位在后。

不同的控制器型号支持的寄存器有可能不同，以实际控制器支持的寄存器为准。

ModBus RTU Special 协议没有0x06功能码。

l 通信故障分析：

<1>.无法建立通信连接

1：检查控制器是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：是否选择了正确的通信口。

5：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过500米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw Samkoon系列HMI内置MODBUS从站通讯

Samkoon系列HMI内置MODBUS从站通讯协议说明

l 概述：

支持MODBUS协议功能码0x01,0x03,0x05,0x06,0x10;通过这些功能码，可读写的地址有LB(位地址)，LW（字地址）,RWI（字地址）。

1. MODBUS帧格式

ü 功能码0x01(01):读线圈

请求帧格式：从机地址+0x01+线圈起始地址+线圈数量+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x01（功能码） | 1个字节 | 读线圈
3 | 线圈起始地址 | 2个字节 | 高位在前，低位在后。见线圈编址
4 | 线圈数量 | 2个字节 | 高位在前，低位在后（N）
5 | CRC检验 | 2个字节 | 低位在前，高位在后

响应帧格式：从机地址+0x01+字节数+线圈状态+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x01（功能码） | 1个字节 | 读线圈
3 | 字节数 | 1个字节 | 值：【（N+7）/8】
4 | 线圈状态 | 【（N+7）/8】个字节 | 每8个线圈合为一个字节，最后一个若不足8位，未定义部分填0.前8个线圈在第一个字节，最地址最小的线圈在最低位。依次类推
5 | CRC检验 | 2个字节 | 低位在前， 高位在后

错误响应：见错误响应帧

ü 功能码0x03(03):读寄存器

请求帧格式：从机地址+0x03+寄存器起始地址+寄存器数量+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x03（功能码） | 1个字节 | 读寄存器
3 | 寄存器起始地址 | 2个字节 | 高位在前，低位在后。见寄存器编址
4 | 寄存器数量 | 2个字节 | 高位在前，低位在后（N）
5 | CRC检验 | 2个字节 | 低位在前，高位在后

响应帧格式：从机地址+0x03+字节数+寄存器值+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x03（功能码） | 1个字节 | 读寄存器
3 | 字节数 | 1个字节 | 值：N*2
4 | 寄存器值 | N*2个字节 | 每两字节表示一个寄存器值，高位在前，低位在后。寄存器的值小的排在前面
5 | CRC检验 | 2个字节 | 低位在前，高位在后

错误响应：见错误响应帧

ü 功能码0x05(05):写单线圈

请求帧格式：从机地址+0x05+线圈地址+线圈状态+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x05（功能码） | 1个字节 | 写单线圈
3 | 线圈地址 | 2个字节 | 高位在前，低位在后。见线圈编址
4 | 线圈状态 | 2个字节 | 高位在前，低位在后。非0即为有效
5 | CRC检验 | 2个字节 | 低位在前，高位在后

响应帧格式：从机地址+0x05+线圈地址 +线圈状态+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x05（功能码） | 1个字节 | 写单线圈
3 | 线圈地址 | 2个字节 | 高位在前，低位在后。见线圈编址
4 | 线圈状态 | 2个字节 | 高位在前，低位在后。非0即为有效
5 | CRC检验 | 2个字节 | 低位在前，高位在后

错误响应：见错误响应帧

ü 功能码0x06(06):写单寄存器

请求帧格式：从机地址+0x06+寄存器地址+寄存器值+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x06（功能码） | 1个字节 | 写单寄存器
3 | 寄存器地址 | 2个字节 | 高位在前，低位在后。见寄存器编址
4 | 寄存器值 | 2个字节 | 高位在前，低位在后。非0即为有效
5 | CRC检验 | 2个字节 | 低位在前，高位在后

响应帧格式：从机地址+0x06+寄存器地址+寄存器值+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x06（功能码） | 1个字节 | 写单寄存器
3 | 寄存器地址 | 2个字节 | 高位在前，低位在后。见寄存器编址
4 | 寄存器值 | 2个字节 | 高位在前，低位在后。非0即为有效
5 | CRC检验 | 2个字节 | 低位在前，高位在后

错误响应：见错误响应帧

ü 功能码0x10(16):写多个寄存器

请求帧格式：从机地址+0x10+寄存器起始地址+寄存器数量+字节数+寄存器值+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x010（功能码） | 1个字节 | 写多个寄存器
3 | 寄存器起始地址 | 2个字节 | 高位在前，低位在后。见寄存器编址
4 | 寄存器数量 | 2个字节 | 高位在前，低位在后。
5 | 字节数 | 1个字节 | 值：N*2
6 | 寄存器值 | N*2 (N*4) |
7 | CRC检验 | 2个字节 | 低位在前，高位在后

响应帧格式：从机地址+0x10+寄存器起始地址+寄存器数量+CRC检验

序号 | 数据（字节）意义 | 字节数量 | 说明
1 | 从机地址 | 1个字节 | 由参数中设定
2 | 0x010（功能码） | 1个字节 | 写多个寄存器
3 | 寄存器起始地址 | 2个字节 | 高位在前，低位在后。
4 | 寄存器数量 | 2个字节 | 高位在前，低位在后。
5 | CRC检验 | 2个字节 | 低位在前，高位在后

错误响应：见错误响应帧

l 变量编址

ü 位地址：只有两种状态0和1；

ü 寄存器：指16位或32位变量；

变量名称 | 支持功能码 | MODBUS起始地址 | 数量 | 说明
LB0-4095 | 0x01, 0x 02,0x05 | 0 | 4096 | 位地址
LW0-4095 | 0x 03, 0x 06, 0x 10 | 0 | 4096 | 内部寄存器
RWI0-4095 | 0x 03, 0x 06, 0x 10 | 4096 | 4096 | 配方寄存器


SamDraw 光洋Koyo系列PLC与Samkoon系列触摸屏

光洋Koyo系列PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写光洋PLC的数据或状态。使用标准CCM协议。通过触摸屏中的串行口设备与光洋PLC的通讯口建立起串行通讯连接，从而达到操作该控制器设备的目的。使用本驱动前，请先阅读通讯单元和控制器设备的有关技术说明书。凡是支持CCM协议的光洋公司生产的PLC都可以与Samkoon触摸屏连接。

l 如何建立与光洋PLC的连接：

1.硬件连接

ü 光洋PLC编程端口PORT2

2.软件设置：

PLC的通信模式必需设置为CCM协议通讯模式，站地址要与触摸屏设置一致。具体设置请参考光洋公司提供的关于CCM协议相关技术手册。

PLC通信参数请与触摸屏中设置一致。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 9600
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 奇校验
PLC站地址 | 1

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
I | 0~477 | 读写 | Iooo | 输入点
Q | 0~477 | 读 | Qooo | 数出点
M | 0~377 | 读写 | Mooo | 中间寄存器
T | 0~177 | 读写 | Tooo | 定时器线圈
C | 0~177 | 读写 | Cooo | 计数器线圈
R | 0~77777 | 读写 | Rooo | 数据寄存器

ooo表示八进制。

不同的控制器型号支持的寄存器有可能不同，以实际控制器支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查控制器是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：是否选择了正确的通信口PORT2。

5：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


本设备驱动用于Samkoon SA系列触摸屏读写日立Hitach

日立（Hitachi）PLC设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写日立Hitachi EH系列PLC寄存器的数据或状态。通过触摸屏的串行口设备与日立Hitachi EH系列的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与日立Hitachi EH系列的PLC相通讯。

如何建立连接：

硬件连接：

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 日立PLC编程端口

RS232端口 RS232通信端口

D型母口 8针水晶头

SamDraw3.2 组态画面编辑软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | 日立Hitachi EH系列 | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持日立Hitachi EH系列PLC
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 19200 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 7 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 偶（EVEN） | Samkoon SA系列触摸屏有偶校验（EVEN），奇校验（ODD），无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 0 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 通信周期，单位为ms，一般采用默认值
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“日立Hitachi”和“EH系列PLC”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。

可操作的地址范围：

可操作地址是以一个日立Hitachi EH系列PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照日立Hitachi EH系列PLC使用手册说明，且按以下的I/O分配来操作：

插槽0：X48

插槽1：Y32

PLC地址类型 | 取值范围 | 类型 | 地址格式 | 描述
X | X0 ~ X12 | 读 | X hh | 位外部输入
Y | Y100 ~ Y109 | 读写 | Y hhh | 位外部输出
R | R0 ~ R7C2 | 读写 | R hhh | 位内部输入
M | M0 ~ M4000 | 读写 | M hhhh | 位内部输出，且与WM共享位/字
WR | WR0 ~ WR1000 | 读写 | WR hhhh | 字内部输出
WM | WM0 ~ WM400 | 读写 | WM hhhh | 字内部输出，且与M共享位/字

hhh表示16进制。

同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l：通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 和利时

和利时(Hollysys)PLC设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写和利时Hollysys LM系列PLC寄存器的数据或状态。通过触摸屏的串行口设备与和利时Hollysys LM系列的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与和利时Hollysys LM系列的PLC相通讯。

如何建立连接：

1.硬件连接：

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 和利时PLC编程端口

RS232端口 RS232通信端口

D型母口 D型公头

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | 和利时Hollysys LM 系列 | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持和利时Hollysys LM系列PLC
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 38400 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 无（NONE） | Samkoon SA系列触摸屏有偶校验（EVEN），奇校验（ODD），无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 51 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 通信周期，单位为ms，一般采用默认值
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“和利时Hollysys”和“LM系列PLC”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。值得注意的是在“PLC地址”项内的参数是51，不要随意更改，需结合与PLC的连接情况而定。请参照和利时Hollysys编程手册。

可操作的地址范围：

可操作地址是以一个和利时Hollysys LM系列PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照和利时Hollysys LM系列PLC使用说明手册。

PLC地址类型 | 取值范围 | 类型 | 地址格式 | 描述
IX | IX0.0 ~ IX511.7 | 读 | IX ddd.o | 输入存储区
QX | QX0.0 ~ QX511.7 | 读写 | QX ddd.o | 输出存储区
MX | MX0.0 ~ MX8191.7 | 读写 | MX ddd.o | M存储区，M0到M99为自诊断数据区只能读不能写。M300到M799具有掉电保持功能，其余则没有。
MW | MW0 ~ MW8191 | 读写 | M2 dddd

ddd表示10进制,ooo表示八进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l：通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 和利时

亚特克仪表(ALTEC)设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写亚特克仪表(ALTEC)寄存器的数据或状态。通过触摸屏的串行口设备与亚特克仪表(ALTEC)的编程口建立起串行通讯连接。从而达到操作和监视设备的目的。使用本驱动前，请先阅读通讯单元和ALTEC设备的相关技术说明书。现Samkoon SA系列支持与ALTEC具有通信功能的所有仪表通讯。

如何建立连接：

1.硬件连接：

通过编程电缆与亚特克仪表(ALTEC)连接， 具体连接方法参照ALTEC使用说明书。

2.软件设置：

  在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 9600
数据位长度 | 7
停止位长度 | 1
奇偶校验位 | 偶校验
PLC站地址 | 0

“地址模式”必须设置为扩展模式。

通讯地址参数：

寄存器名称 | 地址 | 通信代码 | 描述
CODE | 0 | PV | 测量值（只读）
CODE | 1 | OP | 输出功率（只读）
CODE | 2 | SP | 运行目标值（只读）
CODE | 3 | SL | 基本设定值
CODE | 4 | A1 | AL1报警值
CODE | 5 | A2 | AL2报警值
CODE | 6 | XP | 加热比例带
CODE | 7 | TI | 积分时间
CODE | 8 | TD | 微分时间
CODE | 9 | DB | 加热冷却静区
CODE | 10 | CH | 加热动作周期
CODE | 11 | CC | 冷却动作周期
CODE | 12 | RG | 相关冷却系数
CODE | 13 | HS | 设定值最大值
CODE | 14 | LS | 设定值最小值
CODE | 15 | BP | 故障输出功率
CODE | 16 | HO | 最大输出功率
CODE | 17 | SR | 升降温速率值
CODE | 18 | HB | 自动暂停带
CODE | 19 | LC | 曲线程序循环次数
CODE | 20 | ch | 程序编号
CODE | 21 | SE | 当前运行程序短号（只读）
CODE | 22 | r1 | 斜坡1的斜率值
CODE | 23 | l1 | 平台1的设定值
CODE | 24 | t1 | 平台1的运行时间
CODE | 25 | r2 | 斜坡2的斜率值
CODE | 26 | l2 | 平台2的设定值
CODE | 27 | t2 | 平台2的运行时间
CODE | 28 | H1 | 运行斜坡1及平台1时的最大输出功率
CODE | 29 | H2 | 运行斜坡1及平台1时的最大输出功率
CODE | 30 | H3 | 运行斜坡1及平台1时的最大输出功率
CODE | 31 | #3 | 曲线程序控制
CODE | 32 | #4 | PID自整定

以上所有寄存器类型均是32位浮点数；

不同型号ALTEC仪表寄存器地址略有不同，具体参数请参照ALTEC仪表使用说明书。

l：通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


和泉

和泉(IDEC MICRO Smart)PLC设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写和泉IDEC MICRO Smart FC系列PLC寄存器的数据或状态。通过触摸屏的串行口设备与和泉IDEC MICRO Smart FC系列的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与和泉IDEC MICRO Smart FC系列的PLC相通讯。

如何建立连接：

1.硬件连接：

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 和泉IDEC MICRO Smart

RS232端口 RS232通信端口

D型母口 8针公头

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | 和泉IDEC MICROSmart FC系列 | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持和泉IDEC MICRO Smart FC系列PLC
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 9600 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 7 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 偶（EVEN） | Samkoon SA系列触摸屏有偶校验（EVEN），奇校验（ODD），无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 1 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 通信周期，单位为ms，一般采用默认值
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“和泉 IDEC”和“FC系列”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。若需更改，需结合与PLC的连接情况而定。请参照和泉PLC编程手册。

可操作的地址范围：

可操作地址是以一个和泉IDEC MICRO Smart FC系列PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照和泉IDEC MICRO Smart FC系列PLC使用说明手册。（以下是以FC4A-C24R2为例）

PLC地址类型 | 取值范围 | 类型 | 地址格式 | 描述
X | X0 ~ X15,X30 ~ X107 | 读 | X dddo | 输入存储区
Y | Y0 ~ Y11,Y30 ~ Y107 | 读写 | Y dddo | 输出存储区
M | M0 ~ M1267 | 读写 | M dddo | 中间继电器
D | D0 ~ D1299 | 读写 | D dddd | 数据寄存器
RT | RT0 ~ RT99 | 读写 | RT dddd | T设置值
RC | RC0 ~ RC99 | 读写 | RC dddd | C设置值

ddd表示10进制,ooo表示八进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l: 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2: 若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


横河

横河系列(YOKOGAWA)PLC

本设备驱动用于Samkoon SA系列触摸屏读写横河YOKOGAWA FA系列PLC寄存器的数据或状态。通过触摸屏的串行口设备与横河YOKOGAWA FA系列的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与横河YOKOGAWA FA系列的PLC相通讯。

如何建立连接：

1.硬件连接：

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 横河YOKOGAWA FA系列PLC

RS422端口 D-sub 9 pin

D型母口 (socket)

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | 横河YOKOGAWA FA系列PLC | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持横河YOKOGAWA FA系列PLC
通信口类型 | RS422 | 采用标准的RS422串行通讯
波特率 | 9600 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 偶（EVEN） | Samkoon SA系列触摸屏有偶校验（EVEN），奇校验（ODD），无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 1 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 通信周期，单位为ms，一般采用默认值
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“横河(YOKOGAWA)”和“FA系列”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。若需更改，需结合与PLC的连接情况而定。请参照横河PLC编程手册。

可操作的地址范围：

可操作地址是以一个横河YOKOGAWA FA系列PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照横河YOKOGAWA FA系列PLC使用说明手册。（以下是以FA-M3为例）

PLC地址类型 | 取值范围 | 类型 | 地址格式 | 描述
X | X201 ~ 71664 | 读 | X ddd | 不连续，由槽号定
Y | Y201 ~ 71664 | 读写 | Y ddd | 不连续，由槽号定
M | M0 ~ 16384 | 读写 | M ddd |
I | I0 ~ 71024 | 读写 | I ddd |
L | L0 ~ 9984 | 读写 | L ddd | 不连续
D | D0 ~ 8192 | 读写 | D ddd |
B | B0 ~ 32768 | 读写 | B ddd |
V | V0 ~ 64 | 读写 | V ddd |
W | W0 ~ 71024 | 读写 | W ddd | 不连续
Z | Z0 ~ 512 | 读写 | Z ddd |

ddd表示10进制,ooo表示八进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l：通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


正航电子PLC与Samkoon SA系列触摸屏连接说明

正航电子PLC设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写正航电子 A5系列PLC寄存器的数据或状态。通过触摸屏的串行口设备与正航电子 A5系列的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与正航电子 A5系列的PLC相通讯。

如何建立连接：

1.硬件连接：

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 正航电子 A5系列

RS232端口 RS232通信端口

D型母口 9针公头

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | 正航电子 A5系列 | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持正航电子 A5系列PLC
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 9600 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 无（NONE） | Samkoon SA系列触摸屏有偶校验（EVEN），奇校验（ODD），无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 1 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 通信周期，单位为ms，一般采用默认值
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“正航电子”和“A5系列”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。若需更改，需结合与PLC的连接情况而定。请参照和泉PLC编程手册。

可操作的地址范围：

可操作地址是以一个正航电子 A5系列PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照正航电子 A5系列PLC使用说明手册。（以下是以A5-CPU226为例）

PLC地址类型 | 取值范围 | 类型 | 地址格式 | 描述
I | I0.0 ~ I15.7 | 读 | X ddd.o | 输入存储区
Q | Q0.0 ~ Q15.7 | 读写 | Y ddd.o | 输出存储区
M | M0.0 ~ M15.7 | 读写 | M ddd.o | 中间继电器
VW | VW0 ~ VW1998 | 读写 | VW dddd | 数据寄存器

ddd表示10进制,ooo表示八进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

1：通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


研华分布式I/O与Samkoon SA系列触摸屏连接说明

研华分布式I/O设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写研华分布式I/O系列PLC寄存器的数据或状态。通过触摸屏的串行口设备与研华分布式I/O系列的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与研华 ADAM-4017、ADAM-4060 PLC相通讯。

如何建立连接：

1.硬件连接：

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 ADAM-4017、ADAM-4060

RS232端口 RS485通信端口

D型母口 接线端子

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | 研华ADAM-4017、ADAM-4060 | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持研华ADAM-4017、ADAM-4060型号PLC
通信口类型 | RS485 | 采用标准的RS485串行通讯
波特率 | 9600 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 无（NONE） | Samkoon SA系列触摸屏有偶校验（EVEN），奇校验（ODD），无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 1 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 通信周期，单位为ms，一般采用默认值
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“研华分布式I/O”和“ADAM-4017”、“ADAM-4060”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。若需更改，需结合与PLC的连接情况而定。请参照 研华PLC编程手册。

可操作的地址范围：

可操作地址是以一个研华分布式I/O系列PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照研华分布式I/O系列PLC使用说明手册。

对应设备型号 | 寄存器名称 | 输入范围 | 类型 | 地址格式 | 备注
4017 | Data4017x | 0~7 | 只读 | dddd | 字：32位浮点数 （格式：12.345）
4060 | Relay | 0~3 | 读写 | dddd | 位：继电器
4024 | Data4024x | 0~3 | 读写 | dddd | 字：32位浮点数 （格式：12.345）
4024 | 4024_DI | 0-3 | 只读 | dddd | 位：继电器

ddd表示10进制 。

ADAM-4017 Data寄存器数据只能以浮点数显示。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

ADAM-4024的拨码开关需要拨到Normal端。

1：通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，RS422一般通讯不超过500米，RS232通讯不超过15米。

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


GE FANUC PLC与Samkoon SA系列触摸屏连接说明

GE FANUC PLC 设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写GE FANUC PLC寄存器的数据或状态。通过触摸屏的串行口设备与GE FANUC PLC的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与GE FANUC PLC通讯,支持的协议有SMP-X、CMM。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_GE_1

2.软件设置：

在PLC编程软件中设定编程口为GE FANUC PLC，通信参数与Samkoon触摸屏设定一致，建议采用推荐设置。

具体设置请参阅GE FANUC PLC的相关使用手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 19200
数据位长度 | 8
停止位长度 | 1
奇偶校验位 | 奇校验
PLC站地址 | 0

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
I | 1~10000 | 读 | Xddd | I/O输入点
Q | 1~10000 | 读写 | Yddd | I/O输出点
M | 1~10000 | 读写 | Mddd | 辅助继电器
G | 1~7680 | 读写 | Dddd |
T | 1~256 | 读写 | Tddd |
S | 1~128 | 读写 | Cddd |
AI | 1~10000 | 读写 | AIddd | 模拟输入寄存器
AQ | 1~10000 | 读写 | AQddd | 模拟输出寄存器
R | 1~32640 | 读写 | Rddd | 数据寄存器

ddd表示十进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

5：是否切换了运行控制开关到ON。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


台安TP03

台安TP03 Series PLC设备驱动

本设备驱动用于Samkoon SA系列触摸屏读写台安TP03 Series PLC寄存器的数据或状态。通过触摸屏的串行口设备与台安TP03 Series PLC的编程口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。现Samkoon SA系列仅支持与台安TP03 Series PLC相通讯。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_TAIAN_1

2.软件设置：

在PLC编程软件中设定编程口为 台安TP03协议，PLC设备地址为1，通信参数与Samkoon触摸屏设定一致，建议采用推荐设置。

具体设置请参阅台安TP03 Series PLC的相关使用手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 19200
数据位长度 | 8
停止位长度 | 2
奇偶校验位 | 无校验
PLC站地址 | 1

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~377 | 读 | Xooo | I/O输入点
Y | 0~377 | 读写 | Yooo | I/O输出点
M | 0~1535 | 读写 | Mdddd | 中间继电器
T | 0~511 | 读写 | Ddddd | 数据寄存器
D | 0~8511 | 读写 | Tddd | 定时器线圈
C | 0~255 | 读写 | Cddd | 计数器线圈
T* | 0~511 | 读写 | T_Vddd | 定时器经过值
C* | 0~255 | 读写 | C_Vddd | 计数器经过值

ddd表示十进制，ooo表示八进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

5：是否切换了运行控制开关到ON。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


迅捷XC*

信捷XC*、XCM、XD系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写信捷XC*、XCM、XD系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与信捷XC*、XCM、XD系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的PLC型号有：XC*、XCM、XD系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

ü 通过通信电缆与PLC编程端口连接

通信电缆型号：CA_THINGET232

ü 通过通信电缆与PLC 485通讯端口连接

通信电缆型号：THINGET485

2.软件设置：

PLC设备地址默认为1，请设为1。

设置D1120为H86。

具体设置请参阅XC*、XCM系列的相关技术手册。

在触摸屏中推荐定义通讯参数为：

设置项 | 推荐值
通信口类型 | RS232
波特率： | 9600
数据位长度 | 7
停止位长度 | 1
奇偶校验位 | 偶校验
PLC站地址 | 1

XC*、XCM可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
X | 0~77, 10000~20270 | 读写 | oooo | 位：输入线圈
Y | 0~1037 | 读写 | oooo | 位：输出线圈
M | 0~8767 | 读写 | dddd | 位：内部线圈
S | 0~1023 | 读写 | dddd | 位：流程
D | 0~9023 | 读写 | dddd | 字：数据寄存器
T | 0~639 | 读写 | ddd | 位：定时器状态
C | 0~639 | 读写 | ddd | 位：计数器状态
FD | 0~9023 | 读写 | dddd | 字：FlashROM寄存器
ED | 0~16383 | 读写 | ddddd | 字：扩展内部寄存器
T* | 0~639 | 读写 | ddd | 字：定时器当前值
C* | 0~639 | 读写 | ddd | 字：计数器当前值

XD 可操作地址范围：

寄存器名称 | 输入范围 | 类型 | 地址格式 | 备注
X | 0~77, 10000~20270 | 读写 | ooooo | 位：输入线圈
Y | 0~20277 | 读写 | ooooo | 位：输出线圈
M | 0~7999 | 读写 | dddd | 位：内部线圈
S | 0~1023 | 读写 | dddd | 位：流程
T | 0~575 | 读写 | ddd | 位：定时器状态
C | 0~575 | 读写 | ddd | 位：计数器状态
ET | 0-32 | 读写 | ddd | 位：定时器状态
SM | 0-2048 | 读写 | ddd | 位: 辅助继电器
HM | 0-960 | 读写 | ddd | 位：辅助继电器
HS | 0-128 | 读写 | ddd | 位：状态继电器
HT | 0-95 | 读写 | ddd | 位：定时器状态
D | 0~7999 | 读写 | dddd | 字：数据寄存器
TD | 0~575 | 读写 | ddd | 字：定时器当前值
CD | 0~575 | 读写 | ddd | 字：计数器当前值
FD | 0~6143 | 读写 | dddd | 字：FlashROM寄存器
ETD | 0~32 | 读写 | ddddd | 字：扩展内部寄存器
SD | SD0~SD4095 | 读写 | ddddd | 字：数据寄存器

ddd表示十进制，ooo表示8进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


基恩士KV1000

基恩士KV1000、KV3000系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写基恩士KV1000、KV3000系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与基恩士KV1000、KV3000系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的PLC型号有：KV1000、KV3000系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 KV1000、KV3000

RS232端口 RS232通信端口

D型母口 6针母头

6针的电话线水晶头，方向的辨认是：接线电缆放进水晶头的方向向着自己自左向右1－6。9针母头的5脚是屏蔽线接点，屏蔽线的另一端悬空

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | KV1000,KV3000 | 采用不同的PLC型号时，应选择相应的PLC型号
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 19200 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 偶（EVEN） | Samkoon SA系列触摸屏有偶校验(EVEN)，奇校验(ODD)，无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 0 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 单位为ms，20即表示触摸屏每次与PLC通讯间隔时间，一般采取默认设置
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
R | 0~19999 | 读 | Rdddh | 位：输入/输出线圈
MR | 0~19999 | 读写 | MRdddh | 位：内部辅助寄存器
CR | 0~19999 | 读写 | CRdddh | 位：控制线圈
LR | 0~19999 | 读写 | LRdddh | 位：锁存继电器
C | 0~999 | 读 | Cddd | 位：计数器触点
T | 0~999 | 读 | Tddd | 位：定时器触点
DM | 0~1999 | 读写 | DMddd | 字：数据存储器
TM | 0~99 | 读写 | TMddd | 字：临时寄存器
T* | 0~999 | 读 | T*ddd | 字：定时器经过值
C* | 0~999 | 读 | C*ddd | 字：定时器经过值
EM | 0~65535 | 读 | EMddd | 字：扩展寄存器

ddd表示十进制，h表示16进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


基恩士可视KV系列 PLC与Samkoon系列触摸屏的连接

基恩士 可视KV系列 PLC设备驱动

本设备驱动用于Samkoon系列触摸屏读写基恩士可视KV系列PLC寄存器的数据或状态。通过触摸屏中的串行口设备与基恩士可视KV系列的编程口建立起串行通讯连接，从而达到操作PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的有关技术说明书。支持的PLC型号有：可视KV系列。采用不同的PLC的时候应该在配置中选取和设备型号一致的PLC。

l 如何建立与PLC的连接：

1.硬件连接

通过编程电缆与PLC连接，以下是详细的连接图：

Samkoon SA系列触摸屏 可视KV系列PLC

RS232端口 RS232通信端口

D型母口 6针母头

6针的电话线水晶头，方向的辨认是：接线电缆放进水晶头的方向向着自己自左向右1－6。9针母头的5脚是屏蔽线接点，屏蔽线的另一端悬空

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | 可视KV系列 | 采用不同的PLC型号时，应选择相应的PLC型号
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 19200 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 偶（EVEN） | Samkoon SA系列触摸屏有偶校验(EVEN)，奇校验(ODD)，无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 0 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 单位为ms，20即表示触摸屏每次与PLC通讯间隔时间，一般采取默认设置
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

可操作地址范围：

PLC地址 | 取值范围 | 类型 | 格式 | 描述
R | 0~19999 | 读 | Rddd | 位：输入/输出线圈
C | 0~999 | 读 | Cddd | 位：计数器触点
T | 0~999 | 读 | Tddd | 位：定时器触点
DM | 0~1999 | 读写 | DMddd | 字：数据存储器
TM | 0~99 | 读写 | TMddd | 字：临时寄存器
T* | 0~999 | 读 | T*ddd | 字：定时器经过值
C* | 0~999 | 读 | C*ddd | 字：定时器经过值
EM | 0~65535 | 读 | EMddd | 字：扩展寄存器

ddd表示十进制，h表示16进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


Allen-Bradley

Allen-Bradley(AB)PLC设备驱动

本设备驱动用于Samkoon SA系列触摸屏通过Allen-Bradley DF1协议读写Allen-Bradley(AB)一系列 PLC寄存器的数据或状态。通过触摸屏的串行口设备与Allen-Bradley(AB)的通讯口建立起串行通讯连接。从而达到操作和监视PLC设备的目的。使用本驱动前，请先阅读通讯单元和PLC设备的相关技术说明书。

l 如何建立与PLC的连接：

1.硬件连接：

通过编程电缆与PLC连接，以下是详细的连接图：

RS-232: MicroLogix 1000, 1100, 1200, 1500

Samkoon SA系列触摸屏 Allen-Bradley(AB)

RS232端口 RS232通信端口

D型母口 8针公头

RS-232: MicroLogix 1400

Samkoon SA系列触摸屏 Allen-Bradley(AB)

RS232端口 RS232通信端口

D型母口 8针公头

RS-232: SLC5/03, 04, 05 CH0

连接电缆：

Samkoon SA系列触摸屏 Allen-Bradley(AB)

RS232端口 RS232通信端口

D型母口 9针公头

2.软件设置：

参数设置如下表：

参数项 | 默认设置 | 注意事项
PLC类型 | Allen-Bradle(AB) | 采用不同的PLC型号时，应选择相应的PLC型号，目前Samkoon SA系列触摸屏仅支持Allen-Bradley(AB)DF1协议
通信口类型 | RS232 | 采用标准的RS232串行通讯
波特率 | 19200 | Samkoon SA系列触摸屏有多达8种的波特率可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
数据位 | 8 | Samkoon SA系列触摸屏有6，7，8数据位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
校验 | 无（NONE） | Samkoon SA系列触摸屏有偶校验(EVEN)，奇校验(ODD)，无校验（NONE）可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
停止位 | 1 | Samkoon SA系列触摸屏有1，2停止位可供选择，但必须与PLC通信口的设定相同，一般采取默认设置
触摸屏地址 | 0 | 仅在SA系列触摸屏做【从站】和PLC与多台SA系列触摸屏相连接的情况下有效，请参考“一机多屏”的连接说明，一般采取默认设置
PLC地址 | 1 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置
通信时间 | 20 | 单位为ms，20即表示触摸屏每次与PLC通讯间隔时间，一般采取默认设置
地址模式 | 标准模式 | 仅在SA系列触摸屏做【主站】和SA系列触摸屏与多台PLC相连接的情况下有效，请参考“一屏多机”的连接说明，一般采取默认设置

在“设备服务”的下拉菜单下选择“Allen-Bradley”和“Allen-Bradley DF1”，参数设置选项卡内一般采取默认的参数设置。如若PLC的编程通信口设定了参数，则参数设置选项卡的参数也应做相同的变化。若需更改，需结合与PLC的连接情况而定。请参照Allen-Bradley PLC编程手册。

可操作的地址范围：

可操作地址是以一个Allen-Bradley PLC与一个SA系列触摸屏相连接的情况而定，如若有扩展模块或其他特殊情况，请参照Allen-Bradley PLC使用说明手册。（以下是以Allen-Bradley MicroLogix1200为例，位地址格式为ddd:ddd/dd，最前面的ddd为块地址，中间ddd为字地址，后面的dd为字的哪个位。下表中I1,O0,B3,S2,N7,T4,C5均为MicroLogix1200默认的地址块的范围，用户可自行添加块）

PLC地址类型 | 取值范围 | 类型 | 地址格式 | 描述
I | I1:0/0 ~ I1:255/15 | 读 | I ddd:ddd/dd | 输入继电器
O | O0:0/0 ~ O0:255/15 | 读写 | O ddd:ddd/dd | 输出继电器
B | B3:0/0 ~ B3:255/15 | 读写 | B ddd:ddd/dd | 中间继电器
S | S2:0 ~ S2:255 | 读写 | S ddd:ddd | 特殊数据寄存器
N | N7:0 ~ N7:255 | 读写 | N ddd:ddd | 数据寄存器
F | F8:0 ~ F8:255 | 读写 | F ddd:ddd | 32位浮点数
T_ACC | T_ACC4:0 ~ T_ACC4:255 | 读写 | T_ACC ddd:ddd | 定时器ACC值
C_ACC | C_ACC5:0 ~ C_ACC5:255 | 读写 | C_ACC ddd:ddd | 计数器ACC值

ddd表示10进制,ooo表示八进制。

不同的PLC型号支持的寄存器有可能不同，以实际PLC支持的寄存器为准。

l 通信故障分析：

<1>.无法建立通信连接

1：检查PLC是否上电。

2：是否使用通信电缆。

3：通信参数设置是否正确。

4：检查对某一寄存器的操作是否超出范围。

5：是否切换了运行控制开关到ON。

<2>.通讯不可靠如何排除。

通信不可靠（不稳定）若通信状态时而为0，时而为1，表示通信不可靠，原因可能有：

1：通信距离太远，一般不超过15米，

2：若保证PLC无问题，用编程软件能与PLC连接，则请与深圳显控联系。


SamDraw 多点连接方式

Connection among multiple screens and machines

This chapter introduces multipoint connection of Samkoon HMI series touch screen， that is “one machine with multiple screens” connection, “one screen with multiple machines” connection, and the Penetration connection.

l “One machine with multiple screens”

l “One screen with multiple machines”

l Penetration connection


SamDraw “一机多屏”的连接方式

“One machine with multiple screens” connection

Samkoon HMI series touch screen allows “one machine with multiple screens” connection for PLC via MODBUS protocol. All touch screens are connected one by one, and the first screen is connected with PLC. All touch screens may be set as Slave Station, and PLC set as Master Station. Double click “COM1 connection” on the project manager, and then a communication port attribute-setting box will pop up. In Equipment Service item of General option in this box, choose Modbus RTU, and choose Modbus RTU Slave on the right; alternatively, set the first touch screen connected with the PLC as the Master Station, and set the PLC and other screens as the Slave Station. In this case, when setting the communication port attributes of the first screen, choose Modbus RTU in Equipment Service item of General option, choose Modbus RTU Master on the right, change the mode to Extended Mode in the Parameter option, and allocate addresses of touch screens. Thus, the touch screens set as Slave Station may communicate with PLC through the first touch screen. In both of these two arrangements, only Master Station can communicate with Slave Station, and no communication among Slave Stations can be achieved.

When the PLC is set as Master Station and all touch screens are set as Slave Station:

1. The communication port of the PLC connected is RS232; connection methods and system settings are as shown in Figure 8-1, 8-2 and 8-3：

Figure 8-1 Sketch map of “One machine with multiple machines” when PLC(RS232) is Master station

Figure 8-2 Choose MODBUS protocol, and set it as Slave Station

Figure 8-3 Allocation station address of HMI

2. The communication port of the PLC connected is RS485, connection method is as shown in Figure 8-4:

Figure 8-4 Sketch map of “One machine with multiple machines” when PLC(RS485) is Master station

When the communication port of PLC is RS485, as all touch screens are Slave Station, the system settings are the same as those when the communication port is RS232. Refer to Figure 8-2 and Figure 8-3.

When all HMI series screens are set as Slave Station, up to 255 screens may be connected. However, if many touch screens are connected, the response will be slow.

n When the first touch screen is set as Master Station, and the PLC and all other screens are set as Slave Station:

1.The communication port of the PLC connected is RS232; connection methods and system settings are as shown in Figure 8-5, 8-6 and 8-7：

Figure 8-5 Sketch map of “One machine with multiple machines” when PLC (RS232) is Slave station

Figure 8-6 Choose MODBUS protocol for the first screen and set it as Master Station

Figure 8-7 Multiple PLC protocols are required when the first touch screen is set as Master Station

System setting of the touch screens set as slave station is similar as those shown in Figure 8-2 and Figure 8-3.

As RS232 cannot support multi-drop connection, when the PLC in the “one machine with multiple screens” connection does not support RS485 port, a communication adapter is required to convert RS485 signal to RS232 signal.

When HMI series touch screen is set as master station in the “one machine with multiple screens” connection, multiple protocols must be set for the address mode of the touch screen used as master station.

When set Modbus as Master station, it can add up to 255 Slave stations in principle; however, the more slave stations are set, the slower communication speed will be.


SamDraw “一屏多机”的连接方式

“One screen with multiple machines” connection

HMI series allows not only “one machine with multiple screens” connection but also “one screen with multiple machines” connection for PLC via MODBUS protocol. In “one screen with multiple machines” connection, one touch screen may be used to directly operate the register address of several PLCs connected with it, so long as the PLCs support MODBUS protocol. At the time of system setting, choose Modbus RTU in Equipment Service item of General option and choose Modbus RTU Master on the right, so that the touch screen is set as Master Station and all PLCs are set as Slave Screens. Then, the touch screen may operate the register address of the PLCs. The register names of the PLCs correspond to the register names in MODBUS protocol.

Connection methods and system settings are as shown in Figure 8-8, 8-9 and 8-10:

Figure 8-8 “One screen with multiple machines” connection

Figure 8-9 Set the touch screen as Master Station

Figure 8-10 Multiple protocols are required when the touch screen is set as Master Station

After above setting, the PLC addresses in the communication port attributes become ineffective. When user clicks a control to input address, an address input box as shown in Figure 8-11 will pop up. There is a dropdown menu on the right of the register name, and the protocol chosen from the dropdown menu is the Slave Station address of the PLC.

As RS232 cannot support multi-drop connection, when the PLC in the “one screen with multiple machines” connection does not support RS485 port, a communication adapter is required to convert RS485 signal to RS232 signal.


SamDraw 报警设定

Alarm setting

SamDraw alarm settings consist of digital alarm login and analog alarm login. Users can view the alarm type and the occurrence time through Alarm control or Alarm Bar after setting up the alarm login.


SamDraw 数位报警登录

Digital Alarm Login
说明: 说明: 说明: 说明: logo.gif

Alarm Setting is applied to display alarm information, only with which the alarm control and alarm bar run normally (in fact, the alarm control and alarm bar displays the alarm message of "digital alarm login" and "analog alarm login").

l Right click the "Alarm landing" in the Project Manager and select "New digital alarm log", as shown in Figure 6-16:

Figure 6-16

l Double click the "digital alarm login" option to open the digital alarm settings dialog box, as shown in Figure 6-17:

Figure 6-17 Digital Alarm Dialog Box

Steps to build a digital alarm log are as follows:

l Enter the read address first; it is assumed here that the internal address LB1 is set.

l In the "Size" column, select the total number of alarms, i.e. the total number of bit addresses, which is continuous. It is assumed here that the set value is six.

l Set the bit alarm “Scanning time", that is, the scanning frequency.

l Click an item in the list box, and then move the mouse to the right of the "Message" module; input text information in the “Text” edit box serving as the alarm content. Here assume that the alarm messages are as shown in Figure 7-23.

l If "Use" is selected, the alarm information will be displayed in "Alarm Control" or "Alarm Bar". Otherwise the alarm message will not appear even if the corresponding address is 1. If the address value of this item is 0, the alarm information does not show.

Here is an example:

Ø If the value of LB1 address is 0, the alarm information will not be displayed in "Alarm Control" and "Alarm Bar", regardless of whether the "Use" option is selected or not.

Ø If the value of the LB1 address is 1 and the "Use" option is not selected, the alarm information is not displayed in the "Alarm Control" and "Alarm Bar".

Ø If the value of LB1 is 1 and the "Use" option is selected, the alarm information will be displayed in "Alarm Control" and "Alarm Bar".

l Click "OK" to complete digital alarm settings. Users can add 6 bit buttons with the function of Alternation whose address is LB1-LB6; place controls of "Alarm" and “Alarm Bar" on the screen; then execute offline simulation to check whether it displays alarm information. The following is an example of offline simulation as shown in Figure 6-18:

Figure 6-18 Offline Simulation of Digital Alarm

In Figure 6-18, place an Alarm control in the screen with seven rows of texts; other parameters are by default; add an Alarm bar whose attributes are as follows:

Figure 6-19 Dialog Box of Alarm Bar Property

Add lastly six bit buttons whose write addresses are LB1-LB6 with the functions of "Alternation", “Monitor” and “Monitor Address identical to Write Address”. After the settings, click the "Save" button on the toolbar to save the project, execute the "Offline" command in the "Download" item in the menu bar, and then click the bit buttons LB1, LB2, LB4 and LB6. In this case, the Alarm control and Dynamic Alarm Bar will display the alarm information of LB1, LB2, LB4, and LB6 in the "Digital Alarm" When click them again, "Alarm Control" and "Dynamic Alarm Bar" will display nothing since their values are 0 because of the alternation function.


SamDraw 类比报警登录

Analog Alarm Login
说明: 说明: logo.gif

Open the analog alarm settings dialog box, as shown in Figure 6-20:

If user needs to use the analog alarm, steps are as follows:

l First input the address in the "Read Address" column to alarm. It is assumed here that the internal address LW1 is set.

l Select the total number of alarms in the "Size" option, which means the total number of addresses; data type decides the way to read address. Each address value is set firstly as the 16-bit data type and it is continuous. But the data type can be changed. As shown in Figure 7-28, the LW1 address chooses a 32-bit positive integer while LW3 and LW4 values are 16-bit positive integers. Therefore, when 32-bit data is selected for an address, the later address value to be read is added by 2 on the basis of the former address value; and if the 16-bit data type is selected, the later address value to be read is the former value plus 1.

l Users can set the "Scanning time" of the alarm, which means the scanning frequency.

l Click each item to input a value in the “Limit” box on the right; then enter the text information (alarm content) in the “Text" box. Here assume that the message is as shown in Figure 6-20: each address value can be classified into one of four ranges-- Low, Low Low, High, High High. Here take LW1 as an example to illustrate the meanings of four areas (Select “Use” for all four options of LW1), as shown in Figure 6-21:

图6-21 LW1地址的四个地址值区域的划分图

ü Low Low: When the value of this item is less than the limit of this setting and the "Use" option is selected, the alarm information of this item will be displayed in "Alarm Control" or "Dynamic Alarm Bar";

ü Low: When the value of this item is no less than the “Low Low” limit while less than the “Low” limit and the "Use" option is selected, the alarm information of this item will be displayed in "Alarm Control" or "Dynamic Alarm Bar";

ü High: When the value of this item is greater than the “High” limit while no greater than the “High High” limit and the "Use" option is selected, the alarm information of this item will be displayed in "Alarm Control" or "Dynamic Alarm Bar".

ü High High: When the value of this item is greater than the limit of this setting and the "Use" option is selected, the alarm information of this item is displayed in "Alarm Control" or "Dynamic Alarm Bar".

l Refer to “Digital Alarm Login” for the application of “Use”.


SamDraw 报警条设定

Alarm display control

Select [image] in the toolbar menu to set the alarm bar display parameters in the dialog box, as shown in Figure 6-22:

Figure 6-22 Alarm Bar dialog box

l Speed: the movement speed of the alarm information;

l Direction: The alarm bar moves from right to left or left to right;

l Alarm sort: The display order of alarms by chronological order or by traverse chronological order.

Select the alarm control in the toolbar menu to set the alarm display text and parameters in the dialog box, as shown in Figure 6-23:

Figure 6-23 Alarm Display dialog box


PLC Editing Software Help System

PLC editing software help system consists of:

1、 Quick Start

2、 Basic steps to create new project

3、 Instruction System

4、 Register

5、 Communication Protocol

6、 Hardware Manual

7、 System Setting

8、 Contact Information


Quick start of SAMSOAR Developer

Contents：

Learn about SAMSOAR Developer

System demands of SAMSOAR Developer

Basic operation of SAMSOAR Developer


What is SAMSOAR Developer？

SAMSOAR Developer is launched by Shenzhen Samkoon Technology Co., Ltd. as a ladder diagram editing software of Programmable Logic Controller (PLC).Supporting the compilation of main program, subroutine, interrupt program, each of which contains a number of networks, this software can help you quickly and accurately edit a PLC ladder project. The default number of networks in new project is 15, but the user can add networks freely; up to 1000 networks can be added.

To edit a ladder diagram, you can click the mouse on the toolbar to input, input commands directly via keyboard or double click the command in the tree menu to add the selected command into the location specified by the icon.

SAMSOAR Developer supports three editing modes: Write, Annotation Editor, Monitor. Edit mode supports operations of regular editing, modification, and ladder diagram conversion, etc.; Annotation Editor Mode supports modifying the annotation of component. Note that you can only modify the annotation of ladder diagram, but not insert or modify any ladder diagram element; Monitor mode supports monitoring values of ladder diagram elements in PLC, apart from that, it is also compatible with Element Login Monitor Mode to monitor values of mass elements. Serial port and USB port are available to execute monitoring mode.

SAMSOAR Developer also supports the function of Timing for automatic saving, through the dialog box of System Settings, making your project safer.

SAMSOAR Developer takes strict security password measures for uploading and downloading through the dialog box of PLC Settings. Uploading operation would be invalid without correct password. Encryption is also available for main program, subroutine and interrupt program in the property page when editing a ladder diagram of the program, so that others are unable to view freely the project you have written.


Basic operation of SAMSOAR Developer

This chapter introduces basic operation of SAMSOAR Developer: mouse usage, shortcuts and certain terms.

Content:

Mouse operation and shortcuts


Mouse usage and shortcuts of SAMSOAR Developer

1. Mouse usage

During ladder diagram editing, click the mouse on element toolbar, 说明: 说明: 说明: image002 move the mouse into the editing area of ladder diagram and then the mouse cursor will turn to the shape of selected element. Click the mouse in a proper place and an input dialog frame will pop up, as shown in Figure 1-1:

说明: 说明: 说明: image005

Figure 1-1 Input dialog frame of ladder diagram

Input the element address in the dialog box in order to add it to the ladder diagram.

In addition, you can edit a ladder diagram through double clicking the command under directory tree or inputting commands directly via keyboard.

Common mouse operations and their meanings of:

◎ Left click

Press the left button and release, i.e. Left click here; necessary when selecting menu, object, tool button and confirming settings.

◎ Double click

Left click twice rapidly, i.e. Double click here; it is supposed to open setting dialog boxes after double clicking existed elements in editing area under Edit, Annotation Editor, Monitor modes so as to modify specific information.

◎ Right click

Press the right button and release, i.e. Right click; right clicking an object or blank can open the drop-down menu and it can also quit editing state, restore the mouse shape.

2. Shortcuts

Common shortcuts are listed in the table below：

CTRL+C | Copy
CTRL+V | Paste
CTRL+X | Cut
←→↑↓ | Move the selected object left, right, up or down
ESC | Cancel the command operation
DEL | Delete

Table 2-1 Shortcuts


Editing interface and system composition of SAMSOAR Developer

Editing interface of SAMSOAR Developer is user-friendly and use to operate. This chapter introduces configuration screens and function buttons of SAMSOAR Developer.

Contents：

Menu Bar of SAMSOAR Developer

Toolbar of SAMSOAR Developer


SamkoonSoar Menu

Menu bar of SamkoonSoar provides various menu options, as shown in Figure 1-1:

说明: 说明: 说明: 说明: 说明: 说明: 011.jpg

Figure 1-1

Edit（E）：

说明: 说明: 说明: 说明: 说明: 说明: image002

Restore: Restore the last operation command; note that Restore operation is unavailable after executing the command of Generate Instruction List (Shortcut: F4)

Cut: Execute Cut operation to selected object

Copy：Execute Copy operation to selected object

Paste：Paste the content in clipboard into specific place

Line Insertion：Insert one line before the specific location by cursor; if it needs to insert the line after the cursor location, right click on the cursor and select Line Insertion> Insert Backward or Add to End in the pop-up menu.

Line Deletion：Delete the line selected by cursor

Search/Replace（S）：

说明: 说明: 说明: 说明: 说明: 说明: 136

Element Search/Replace：Exucute the search/replace operation for elements

Element Batch Replace：Execute the batch replacement of elements

Instruction Search： Search and mark the input instruction within the project

Network Search： Find the network according to the input network number

Element Annotation： View, edit and export the annotation of elements in the dialog box

Element Initialization： View and edit element values in the dialog box

Element List：Check whether a certain element has been occupied

Convert（C）：

说明: 说明: 说明: 说明: 说明: 说明: image010

Instruction Generation Table：Bug check the grammar and employed elements in ladder diagram; a corresponding instruction table would be generated for users to download and view.

Display（V）：

说明: 说明: 说明: 说明: 说明: 说明: image006

Annotation: Click this button to switch the display status of annotation

Toolbar: Click this button to switch the display status of the toolbar

Online（D）：

说明: 说明: 说明: 说明: 说明: 说明: 002.jpg

Transport Setting：Check the communication connection through dialog box test

Monitor Variable：Monitor elelment variables and change their values. Note that variable monitoring is available only under the monitoring mode

Tool（T）：

说明: 说明: 说明: 说明: 说明: 说明: image007

Program Check: Check ladder diagrams having been compiled successfully to rule out problems such as multiple coils output

System Setting: Settings concerning the programming interface and style of ladder diagram for a better UE

Window（W）：

说明: 说明: 说明: 说明: 说明: 说明: @J2QG@KKMMC3AD9[2UA8BW9

Instruction Window：Click this button to switch to the Command window

Ladder Diagram Window：Click this button to switch to Ladder Diagram Window

Instruction Comparison Window：Click this button to switch to Instruction Comparison Window

Help（H）：

说明: 说明: 说明: 说明: 说明: 说明: image011

Help：Click this button to view Help document

About：Click this button to view version number of the software and ownership of copyright


SamkoonSoar Toolbar

Standard Toolbar

说明: 说明: 100.jpg

Standard Toolbar consists of numbers of basic operation buttons concerning PLC programs, such as New Project, Open Project, Save, and Cut, Copy, Paste for ladder diagram editing, etc.

说明: 说明: AU3TH%`4[0VK[([)B~$79~T Cut：Execute cut operation to selected object

说明: 说明: G7K~()XMM4_KVS]CBOHFU$9 Copy：Execute copy operation to selected object

说明: 说明: 4DG9UI@WXXGV8%X~CF{]Q]Y Paste：Paste contents in the clipboard where the cursor locates

说明: 说明: 7C`98_98U7E1K1__9TJG(YI Undo：Undo the latest operation; note that the Undo operation is unavailable after the generation of Instruction list (Shortcut F4)

说明: 说明: D}(V43VPD_(FPX_O8_IBW4N Redo：Restore the operation just being undone

说明: 说明: QB(7S~N~RD8882E345ZX]2S Element Search/Replace：Execute the operation of Element search/replace;

说明: 说明: T5DDR[[(BS$ETVK79%)~8K1 Instruction Search：Look up an instruction and mark it in the project

说明: 说明: M}27X53_1Q2T$(EUGR@3V49 Element List：Check whether certain element has been occupied

说明: 说明: 101.jpg 注释显示：通过该按钮可以切换到注释显示状态

说明: 说明: }KPWVD0R%]PAV@U_DV~H([O Transport Setting：Check whether communication connection works regularly

说明: 说明: ]ZAT[`@{T%IANYC~3UN%%FW Monitor Varible: Monitor element variables and modify their values; note that monitorinig operation is valid only under the mode of Monitor Variable

说明: 说明: ~$8]1D1P63Q(8[CP0%`@[DS System Settinig：Settings concerning the programming interface and style of ladder diagram for a better UE

说明: 说明: RHHDP8(NUZVJK@Q_5U6PJGD Add Subroutine：Click this button to create a new subroutine in project

说明: 说明: SHO8P{VYN3})ZUHDVHTFL(9 Add Interrupt Routine：Click this button to create a new interrupt routine in project

说明: 说明: Q9IVQB7C@TJGRIAX64IT@9G Line Insertion：Insert one line before the specific location by cursor; if it needs to insert the line after the cursor location, right click on the cursor and select Line Insertion> Insert Backward or Add to End in the pop-up menu.

说明: 说明: O2`Q}_IP9Q)F}Y(%VCQJQVT Line Deletion：Delete the line selected by cursor

说明: 说明: EQG]10RAXT2UN]5TMUI[M6Q Network Insertion：Insert one network before the specific location by cursor; if it needs to insert it after the cursor location, right click on the cursor and select Network Insertion> Insert Backward or Add to End in the pop-up menu.

说明: 说明: YH)$%J1E(V}LVP4FQ`H62AN Network Deletion：Delete the network selected by cursor

说明: 说明: BC`$0JC86]HO85HXY[7`1A3 Element Annotation： View, edit and export the annotation of elements in the dialog box

说明: 说明: 1[MF%7PEE7`%1T`W}`BL@B5 Element Initialization：View and edit element values in the dialog box

Symbol Toolbar of Ladder Diagram

说明: 说明: C{3NHNOU8JAWMRRTLU@~8$7

This toolbar contains basic elements of ladder diagram editing, clicking which can input directly corresponding ladder diagram symbols.

说明: 说明: I2EWN_]{NX(SLF{(G(R6)F8 Mouse：When switching to normal Mouse mode, it can conduct operations of selecting, double clicking to modify and calling pop-up menu.

说明: 说明: 9XS4B(3@C_MU`(7@2N_(O`X Normally Open Contact：Switch the mouse to this mode so as to insert quickly a normally open contact through clicking on blank position of ladder diagram; the shortcut key is （F2）

说明: 说明: @VNNCF4IP2NE5K441LQKAGH A_INPUTIMME：As above, the shortcut key is（Shift+F2）

说明: 说明: 757KFBIIM4G@_)~O3F2ULK0 Normally closed：As above, the shortcut key is（F3）

说明: 说明: XD(0B5$X8K$4BUGEHUSBQ0E B_INPUTIMME：As above, the shortcut key is（Shift+F3）

说明: 说明: (_YTDP%X3LG%N))${$5{XJG PLS：As above, the shortcut key is（F5）

说明: 说明: @FKM_AL`Q9M(R~71F2KRC{D PLF：As above, the shortcut key is（F6）

说明: 说明: D@5EX{B565Z7LEKE[QO@FJS MEP：As above, the shortcut key is（Shift+F5）

说明: 说明: [ILRWPZ]O~MX(MFXC$L_%G8 MEF：As above, the shortcut key is（Shift+F6）

说明: 说明: X$1Z$~~7XE[UGHO(32LEIUV INV：As above, the shortcut key is（F7）

说明: 说明: B%J@J(~AP6K~]XN{KNX}P7M Out-put Coil：As above, the shortcut key is（F8）

说明: 说明: )EOFDNFC[81247H3BT{${`G OCOIL_IMME：As above, the shortcut key is（Shift+F8）

说明: 说明: (~O5{TZ~{]Q159GZI964QI7 Horizontal Line：Draw a horizontal line; the shortcut key is（F9）

说明: 说明: UTJ{AYO4DOG~I6A72L{P9)R Vertical Line：Draw a vertical line; the shortcut key is（F10）

说明: 说明: YYIB$EO8BV{@$8FDP_7}_CB Horizontal Line Deletion：Delete the selected line, the shortcut key is（Shift+F9）

说明: 说明: 5RGM(0GO[`0S{FKVSLAN~_7 Vertical Line Deletion：Delete the selected line, the shortcut key is （Shift+F10）

Application Toolbar

说明: 说明: 102.jpg

This toolbar contains operation commands concerning ladder diagram such as Upload, Download and Monitor.

说明: 说明: 12PP508%LML}3KF_Y6CE850 Generate Instruction List：Check errors in grammar and elements; an instruction list will be generated if error checking passes.

说明: 说明: []CEN)899X((@8ABLB58VID Display Switch of Ladder diagram/Instruction list: Click this button to switch between ladder diagram and instruction list. 说明: 说明: G`IFX0A)1_H37T7J1{$U30O Write Mode：Click this button to switch to normal editing mode under which operations like insertion, deletion and modification are available.

说明: 说明: 23I$I`%6H7VD{P)6E7T7J1T Annotation Editor Mode：Under this mode, it can modify the annotation while cannot edit elements by double clicking primitives.

说明: 说明: RGZ$SXC%H`%K)_{W1)FJUVS Monitor Mode：Monitor elements in the viewable area in the current window; read element values in internal PLC; operations as editing are invalid under this mode.

说明: 说明: B3(]2XORQF9TC9JY%TN@$%3 PLC Parameter Setting：Set parameters of PLC, such as filtering, AI/AO etc.


Element Search/Replace

Click the command Search/Replace -> Element Search/Replace or click directly the command icon on Toolbar [image] to open the dialog box as shown in Figure 4-1：

Figure 4-1

说明: 说明: 说明: 说明: 3LVFX@6$40NN3(P[JJ7PRX5 Here input the element name to be searched or replaced, such as X1、Y0.

说明: 说明: 说明: 说明: 1Z6VB`$NY7V527(EY3`~$PJ When it deals with replacing, enter here the replacement name, such as X1、Y0. If it only comes to searching, it is unnecessary to input anything.

说明: 说明: 说明: 说明: P}FXU~ECD(`K)HV}VLBU5GH This function is designed to replace original elements from the first one of certain point number with new ones from the new element in a specific program.

E.g., Original element: D10; New element: D20; Point number: 5

Which means: replace D10-D14 with D20-D24

Check this option to search only elements of output position during Search/Replace operation.

说明: 说明: 说明: 说明: H6%CJ4SJNT8_ZGDSHST]S$D Select the first option 说明: 说明: 说明: 说明: D{A@H~`K(LKCJPGVQGQ9%]Y and check it to search or replace from theselect network or element. If it is not checked, it would search/replace from the first network or element; it would search/replace forward from the cursor location while backward from the cursor location when the third option is checked.

说明: 说明: 说明: 说明: D{A@H~`K(LKCJPGVQGQ9%]Y Check to select a program where to search/replace.

说明: 说明: 说明: 说明: S3C~$DR9@~DEAJXMX_40BN2 This option is available only when this 说明: 说明: 说明: 说明: D{A@H~`K(LKCJPGVQGQ9%]Y is checked first; and then you can select the network range.

For example, Figure 4-1 means search an element called M1 in network 0-4 of Main(OB0) program, or replace output instruction of M1-M3 by Y1-Y3.


Element Batch Replace

Select Find/Replace on Menu Bar-> Element Batch Replace, a dialog box will pop up, as shown in Figure 1-1：

Figure 1-1

Original Element：Original elements that need to be replaced; replacement would be unavailable if this is blank here.

New Element：New elements to replace the original ones; it would report an error when executing this command without inputting anything here.

Point: Shift number of replacing and replaced elements; default value is 1; replacement method in Figure 1-1 can also be realized as follow:

Figure 1-2

Object Program: Check this option to replace elements of specific subroutine by batch.

：Click this button to execute the replacement function.


Instruction Search

Click Search/Replace->Instruction Search on Menu Bar or click directly the command icon [image] on Toolbar; a dialog box as shown in Figure 1-1 will appear:

Figure 1-1

：Input the instruction name to search, such as LD,OUT.


Network Search

Click Search/Replace->Network Search and a dialog box shows as shown in Figure 1-1:

Figure 1-1

：Input the ID of network to be searched; the net view window will jump to corresponding location while remains still if no result found.

Note: Network Search functions only in the current routine, not including subroutines regardless of search results.


Element List

Select the command of Search/Replace->Element List on Menu Bar or click directly the icon [image] on Toolbar; then a dialog box as shown in Figure 4-1will appear:

Check this option to conclude application situation of elements currently searched in all procedures.

Select this option conclude application situation of elements currently searched in the current routine.

Input here the primitive you want to view.


Element Variable Table

1.Double click Element-> Element Variable Table; a window as follow will appear：

2.Add variables to the table, as shown below:

Variable Name：Name of one specific address in the program

·Variable names are case-sensitive, which means it cannot input “switch” in the program if Switch is defined here.

·Variable names cannot conflict with PLC register addresses, i.e., the names such as X1, D1 are unavailable.

Address: Corresponding PLC register address of the variable name

Data type: The variable type defined by user (the default type can work if no special operation is applied; the configuration software reassigns a variable data type according to the type of instruction to which the variable applies).

Comment: A description of the variable name.

Add variables: Increase the number of table rows to define more variables.

• Click the button of Add variables to add table rows decided by this option [image] .

• The maximum number of rows in the table is 1000 (up to 1000 variables can be defined).

• Right-click on the table bar to insert, delete, and delete all.

3. The above definition takes effect only after the OK button being clicked.

4. The ladder is applied as follows:

• The variable name is applied to the instruction input mode

·Ladder diagram after inputting

Note：

·It can modify corresponding addresses, as shown below:

After clicking OK, the variable name does not change, but the variable is no longer applicable to the instruction that uses it in this name in the ladder. So the configuration software will determine whether the variable name used in the ladder is applicable to the original instruction after the above confirmation: if not, the software will modify the instruction parameters of the variable to correspond to the original address, as shown below:


Monitor Variable

Select Online->Monitor Variable on the Menu Bar or click directly its icon 说明: 说明: ]ZAT[`@{T%IANYC~3UN%%FW on the toolbar to open the dialog box of Monitor Variable, as shown in Figure 4-1.

Note: The "Start Monitor” button will become active only when the Monitor Mode is ON.

Figure 4-1 Element Monitor

• The list on the left side is the name of the monitored variable table, which can be switched to Monitor Variable table; In the right list box it can increase or decrease the variable table number (up to 13 tables). Each table can add different monitoring variables while only one table of variables can be monitored at one time.

• The selected monitor variable table name is displayed here [image] . Modify its contents to change the corresponding name.

1, click the "Add Element" button to pop up the "Element Information" dialog box shown in Figure 4-2:

Figure 4-2 Element Information

Add elements in this dialog box; checking "Bulk Add": input the number to be added so as to facilitate the realization of monitoring a series of data. Note that the number of addition cannot exceed the maximum length limit of element.

2. Click “Start Monitor” button under the Monitor mode to monitor the element value of PLC, as shown in Figure 4-3:

Figure 4-3 Element Monitor

In the dialog box it can not only view the element data in PLC, but also write or modify its value; double click the element to be modified, a dialog box will pop up as shown in Figure 4-4:

Figure 4-4 Modify Bit Element Value

Figure 4-4 Modify Word Element Value

3. Select “Stop Monitor” to stop monitoring the current PLC data.

4. Select "Delete Element" to delete the currently selected element.

5. Select "Delete all" to delete all the monitoring elements in the list.

6. Click “Close" to close the current dialog box.


Program Checking

Click Tool->Program Checking, and the dialog box below will appear:

Figure 1-1

As shown above: it can check the contents here; selecting “Double Coil” will check the multiple coil output of specified object and present it in the table（Grey options are unavailable and cannot be checked）.

As shown above, it can assign objects to be checked here; the whole procedure means checking all of it. Results are as shown below:

Figure 1-2

Click the error in this table to jump into the corresponding location.

Note: Please ensure the successful compilation of ladder diagram before checking, otherwise the checking is unavailable.


System Setting of SAMSOAR Developer

Click Tool->System Setting or click directly the icon [image] on Toolbar, a dialog box as shown below will appear：

Figure 1-1

说明: 说明: )6{D(5~CAM$3D1TTK4ETBJU : This option is for element color under the Write mode.

说明: 说明: ]C7MRWIPY`Z{@Z1WX))21K9 ：This option is for element/data color under the Monitor mode.

：This option is for scalar color, font, font size and instruction graphics size of elements.

说明: 说明: LAU0Y{6{Q92X(I2]8187~OJ ：This option is for font type, font size and font color of element annotation.

Set font, font color, font size etc. of programming interface in this dialog box and Annotation editor, Timing under the label of Other Setting, as shown in Figure 1-2:

图1-2

说明: 说明: IUGBIWR]W`P@AA32NU$[}`W ：Check this option to edit annotations even under Write mode.

说明: 说明: R0(4N{$M`%)9YV{W{EQMFHW ： Check this option to save projects automatically under the installation directory file “save”.


Element Annotation

Enter into the project, click on Element Explorer->Element Annotation Table, or click directly the icon on Toolbar 说明: 说明: BC`$0JC86]HO85HXY[7`1A3 ; then a comment box will pop up:

说明: 说明: YG3W[]AC22R(6_OCUTN26YS

说明: 说明: (SNB0Q~18CTHZ`_82[7}(XN ：Click this button to show names and annotations of all occupied elements in the program.

说明: 说明: 81WSQ32AW%WPW46(H6F%EZB ： Click this button to pop up the dialog box 说明: 说明: S29D2U62YTSZZ5TV(UWIO61 where to select the export path.

说明: 说明: B5@NV`II@%VN[TCOAFLNU(L ： Click this button to clear all contents in the table.

说明: 说明: X9B0S~F1M5OC5QP18P(L8(U ：Click these buttons to only display the annotation of the selected type element, such as clicking X: 说明: 说明: [K@RG[D`[5XSG$FI]N%L[J3

说明: 说明: 5Z[6E8G0)QSZOH_H6256]R1 ： Enter here directly the element name to view its annotation, such as: 说明: 说明: H$IN65YA0]X2O(]HU[6RTP7

说明: 说明: 81WSQ32AW%WPW46(H6F%EZB : Click OK to save the modification of annotation; operation of closing directly or cancelling will not preserve the modification.


Element Init

Enter into the program, select directly the option of Element init on the left Tree Menu or click [image] on the Toolbar, a dialog box as shown in Figure 1 will appear:

图1

: Enter here the starting position of element to be initialized (element name can start only with D).

： These two options provide display format of data.

： Enter here the range of element initialization, which is 0-8000; input 10 for example,and then it will display an editable range of d0-d10, as shown in Figure 1.


Element Editor Mode

Click [image] on the Toolbar to switch to the Element Editor Mode under which element operations of insertion, modification are unavailable. Double click an element under this mode, and then a dialog box as shown in Figure 4-1 will pop up:

图4-1软元件注释输入对话框

Enter in this box the annotation as shown in this figure [image] , click OK and all annotation of this variable in the programwill be replaced with the newly input contents, as shown in Figure 4-2:

Figure 4-2 Working Sketch of Annotation inputting

Click again the "Annotation Editor Mode" button to switch to the Write mode, or by selecting "Write Mode" to execute the corresponding switch operation.

•Note:

1. Under the Annotation Editor Mode, the option of "Annotation Display" in the menu of Display will be selected automatically, so do the "Annotation Display" on the toolbar; users can manually click the button to decide displaying or hiding that.

2. If you want to display the corresponding component comment in the ladder edit mode, you can make the corresponding display and hide the switch by clicking the "Comment" button in the "Display" menu, or "Comment display" in the toolbar.

3. An element has only one annotation in a program; modification of an element at any position applies also to others.

If you want to quickly modify the annotation of an element in batches, you can operate it in the tree directory, under the "Element Explorer" -> "Element Annotation Table". Refer to "Element Annotation Table" for details.


Monitor Mode

Click the button [image] on the Toolbar, a dialog box as shown in Figure 4-1 will pop up:

Figure 4-1Communication Setting

Set communication ports in this dialog box, [image] along with parameters of communication interface;

Click OK after settings and then editing area of ladder program will be switched under the Monitor mode, as shown in Figure 4-2:

Figure 4-2 Monitor mode of Ladder diagram

Double click an element under the Monitor mode to pop up the modification dialog box:

Figure 4-3 Modification of variable value

Compulsive “ON”/“OFF”operation or value modification of elements is available according to different variables.

Under the Monitor mode, the status bar displays the scanning cycle and current running status of PLC, as shown below:

Click again “Monitor Mode” to switch to the Write Mode.


Parameter settings of PLC

Click the icon [image] on the Toolbar; a dialog box will appear:

Figure 4-1 Dialog box of PLC parameter settings

1．Communication parameter settings

• COM port parameter: The communication parameters of the PLC can be set accordingly. PLC serial port default communication parameters: baud rate: 9600, data bit: 8, stop bit: 1, check code NONE

Note: If you want to apply the MODBUS master for MODBUS communication, [image] then it’s necessary to select the MODBUS master station.

And the COM port set as MODBUS master station or free port communication, can no longer be used to download the project; it needs to modify the COM port as MODBUS slave station before enabling its downloading function.

• Station number: The station number of the PLC can be set here

• Timeout: You can set the timeout time of PLC

2. Password settings, as shown in Figure 4-2:

Figure 4-2 Password settings page

• Upload encryption: Set the upload password of the PLC program; when uploading, the password is necessary; otherwise it will lead to uploading failure

• Download encryption: Set the download password of the PLC program, when downloading, the password is necessary; otherwise it will lead to updating failure of internal procedures

• Monitoring encryption: Set the password for PLC monitoring; when monitoring the PLC program, the password is necessary

Note: The maximum length of the password is 8 bits.

3. Filtering setting:

Figure 4-3 Filtering setting

·Set filtering parameters; Filtering range is 0.20~51.20ms

4. Preserved Area Setting, as shown in Figure 4-4：

·In this page, you can set the capacity of the holding area; When you click on the default setting, the current setting will be cleared and the starting address of the power-down holding area will be set to the minimum value, and the length will the maximum value.

5. Model Modification:

Figure 4-5 Model modification

·Change the current PLC model

6. Extended module settings, as shown in Figure 4-6:

Figure 4-6 Extended module settings

·Check the module to enable it and set the parameters

·Please refer to Instruction of extended modules


Instruction System of PLC

Contents：

Bit Logic

Comparison

Transformation

Logic Operation

Transmission

Floating Calculation

Integer Calculation

Timer

Counter

ProgramControl

Shift Instruction

INT

RTC

Communication Instruction

Pluse Output

High-speed Counting Instruction

Auxiliary Instruction

PID Instruction


Bit Logic

Contents：

-| |-

-|||-

-|/|-

-|/||-

-|↑|-

-|↓|-

-↑-

-↓-

-/-

-()

-(|)

-(S)

-(SI)

-(R)

-(RI)

ALT

ALTP


Set Output Coil –(S)

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
SETIM | Set output coil | Y/M/S/T/C,K/H

Instruction Description：

Set N coils from a certain address （BIT）; Maximum points are determined by operand type.

Effective operands：

I/O | Type | Operand | Description
（Up） | BOOL | Y/M/S/T/C | Certain start address of Set
（Down） | Integer | K/H | Operand of Set

Instance：

Instruction List：

LD X000

SET Y000 K16 //Set Y000~Y017

Ladder Diagram：


Immediately Open -|||-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
LDIM、ANDIM、ORIM | Immediately Open Contact | X/Y/M/T/C/S

Instruction Description：

When the actual input bit is 1, Immediately Open（LD、AND、OR）Contact ON（ON）, otherwise OFF（OFF）

In the instruction list, Immediately Open Contact is illustrated by LDIM（Load Immediately）, ANDIM（And Immediately）and ORIM（Or Immediately）that place the digital value of address on the top of stack and execute immediately.

Instance：

Instruction List：

LDIM X000 // Load immediately the coil X000; X000 is enabled only when it is 1.

ORIM X002 // Execute the operation of ORIM to the coil X002.

ANDIM X001 // Execute the operation of ANDIM to the coil X001.

OUT Y000 // Output the coil Y000.

Ladder Diagram：


Normally Closed -|/|-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
LDI、ANDI、ORI | Normally Closed Contact | X/Y/M/T/C/S

Instruction Description：

When the bit is 0, Normally Closed（LDI、ANDI、ORI）Contact ON（ON）, otherwise OFF（OFF）.

In the instruction list, Normally Closed Contact is illustrated by instructions of LD NOT, AND NOT and OR NOT placing the digital value of address on the top of stack.

Instance：

Instruction List：

LDI X000 // Load the logic NOT of input coil X000; X000 is enabled only when it is 0.

ORI X002 // Execute the operation of ORI to the input coil X002.

ANDI X001 // Execute the operation of ANDI to the input coil X001.

OUT Y000 // Output the coil Y000

Ladder Diagram：


Immediately Close -|/||-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
LDIIM、ANDIIM、ORIIM | Immediately Close Contact | X/Y/M/T/C/S

Instruction Description：

When the actual input bit is 0, Immediately Close（LDIIM、ANDIIM、ORIIM）Contact ON（ON）, otherwise OFF（OFF）

In the instruction list, Immediately Close Contact is illustrated by LDIIM（Load Immediately NOT）, ANDIIM and ORIIM that place the digital address value of logic NOT on the top of stack and execute immediately.

Instance：

Instruction List：

LDIIM X000 // Load immediately the input coil X000; X000 is enabled only when it is 0.

ORIIM X002 // Execute the operation of ORIIM to the coil X002.

ANDIIM X001 // Execute the operation of ANDIIM to the coil X001.

OUT Y000 // Output the coil Y000.

Ladder Diagram：


PLS -|↑|-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
LDP、ANDP、ORP | PLS | X/Y/M/T/C/S

Instruction Description：

1） It’s enabled to set the stack value to 1 every execution of converting 0 to 1 during a scanning; otherwise set it to 0;

2） The output along the rear of the signal will only be executed once at the moment when the edge signal is turned on, unless it is executed again if there is a corresponding edge signal again. Therefore, Set Output coil(SET) is recommended for the rear output, instead of normal output coil (OUT);

3） Do not connect edge signals in series: two edge signals in series can get through only when being triggered in a scan cycle at the same time, which is rare in actual application..

Instance：

Instruction List：

LD X000 // Load the input coil X000; X000 is enabled only when it is 1.

OR X002 // Execute the operation of OR to the coil X002.

ANDP X001 // Execute the operation of ANDP to the coil X001.

SET Y000 K1 // Output the coil Y000.

Ladder Diagram：


PLF -|↓|-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
LDF、ANDF、ORF | PLF | X/Y/M/T/C/S

Instruction Description：

1） It’s enabled to set the stack value to 1 every execution of converting 0 to 1 （ON → OFF）during a scanning; otherwise set it to 0;

2） The output along the rear of the signal will only be executed once at the moment when the edge signal is turned on, unless it is executed again if there is a corresponding edge signal again. Therefore, Set Output coil(SET) is recommended for the rear output, instead of normal output coil (OUT);

3） Do not connect edge signals in series: two edge signals in series can get through only when being triggered in a scan cycle at the same time, which is rare in actual application..

Instance：

Instruction List：

LD X000 // Load the input coil X000; X000 is enabled only when it is 1.

OR X002 // Execute the operation of OR to the coil X002.

ANDF X001 // Execute the operation of ANDP to the coil X001.

SET Y000 K1 // Output the coil Y000.

Ladder Diagram：


MEP -↑-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
MEP | MEP | None

Instruction Description：

1） Turn ON (conducting state) when it reaches the rising edge of the MEP end;

2） The output along the rear of the signal will only be executed once at the moment when the edge signal is turned on, unless it is executed again if there is a corresponding edge signal again. Therefore, Set Output coil(SET) is recommended for the rear output, instead of normal output coil (OUT).

Example：

Instruction List：

LD X000

OR X002

AND X001

MEP // Execute Rear Output inn case of rising edge of front contact results.

SET Y000 K1

Ladder Diagram：


MEF -↓-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
MEF | MEF | None

Instruction Description：

1） Turn ON (conducting state) when it reaches the falling edge of the MEP end;

2） The output along the rear of the signal will only be executed once at the moment when the edge signal is turned on, unless it is executed again if there is a corresponding edge signal again. Therefore, Set Output coil(SET) is recommended for the rear output, instead of normal output coil (OUT).

Example：

Instruction List：

LD X000

OR X002

AND X001

MEF // Execute Rear Output inn case of falling edge of front contact results.

SET Y000 K1

Ladder Diagram：


INV -/-

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
INV | Invert the result | None

Instruction Description：

Enable to invert the results till the end of INV and output.

Instance：

Instruction List：

LD X000

INV //Invert the result of M000 and output that to Y000

OUT Y000

Ladder Diagram：


Ordinary output coil - ()

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
OUT | Ordinary output coil | Y/M/S

Instruction Description：

1） Output the coil only when the front one keeps ON;

2） Do not repeat outputting coils; error instance: if X0 is turned on while X1 is not, in the sequence execution process of ladder, X0 is conducted first and then output Y0, but immediately X1 cannot be turned on leading to output disable of Y0, so Y0 cannot be outputted eventually; but the auxiliary relay M is helpful in this case.

Instance：

Instruction List：

LD X000

OUT Y000 //Output Y000

Ladder Diagram：

说明: 说明: 捕获

Error Instance：

说明: 说明: 捕获


Output coil immediately –(|)

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
OUTIM | Output coil immediately | Y/M/S

Instruction Description：

Write immediately the new value of output bit to output register and output it.

Instance：

Instruction List：

LD X000

OUTIM Y000 //Output immediately Y000

Ladder Diagram：


Set Immediately Output Coil–(SI)

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
SETIM | Set immediately output coil | Y/M/S/T/C,K/H

Instruction Description：

Set immediately N coils from the Address Bit; maximum points are determined by operand type.

Instance：

Instruction List：

LD X000

SETIM Y000 K16 //Set immediately Y000~Y015

Ladder Diagram：


Reset Output Coil –(R)

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
RST | Reset output coil | Y/M/S/T/C,K/H

Instruction Description：

Reset N coils from the Address Bit; maximum points are determined by operand type.

Instance：

Instruction List：

LD X000

RST Y000 K16 // Reset Y000~Y015

Ladder Diagram：

说明: 说明: image002


Reset Immediately Output Coil –(RI)

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
RSTIM | Reset Immediately output coil | Y/M/S/T/C,K/H

Instruction Description：

Reset immediately N coils from the Address Bit; maximum points are determined by operand type.

Instance：

Instruction List：

LD X000

RST IM Y000 K16 // Reset immediately Y000~Y015

Ladder Diagram：


Continuous Alternating Output

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
ALT | Continuous alternating output | Y/M/S

Instruction Description：

When the top of stack value is 1, it keeps alternating the status of the target element between 1（ON）and 0（OFF）continuously.

Instance：

Instruction List：

LD X000

ALT Y000 // Alternate change between 0 and 1 of Y000; the cycle is the current scanning cycle.

Ladder Diagram：


Alternating Pulse Output ALTP

Corresponding Instruction | Annotation/Introduction | Operand（Coil）
ALTP | Alternating pulse output | Y/M/S

Instruction Description：

When the result occurs a change of rising edge （OFF -- ON） before executing this instruction, it will keep alternating the status of the target element between 1（ON）and 0（OFF）continuously.

Instance：

Instruction List：

LD X000

ALTP Y000 // Y000 alternates between 0 and 1 when X000 turns 1 from 0

Ladder Diagram：


Comparison

Contents：

==

<>

>=

<=

>

<


Comparison ==

Corresponding Instruction | Annotation/Introduction | Operand（Register）
W= D= F= | LDWEQ、AWEQ、ORWEQ LDDEQ、ADEQ、ORDEQ LDFEQ、AFEQ、ORFEQ | K/H/D/CV/TV/AI/AO/V/Z,K/H/D/CT/TV/AI/AO/V/Z K/H/D/CV32,K/H/D/CV32 K/D/CV32,K/D/CV32

Instruction Description：

The instruction of Comparison & Equality is applied to compare whether two values are equal; if the comparison result is positive, then executes the output.

The two numbers are signed

W = Compare double-byte integers

D = Compare four-byte integers

F = compare real numbers

In the instruction list, when 1 is at the top of stack, it executes the operation of Load (LD), AND (AND) and / OR (OR).

Instance：

Instruction List：

LDWEQ D0 D1 // Load D0 and D1; compare them if they are equal

ORWEQ D4 H0123 // Compare whether D4 equals to H0123 and execute “OR” to the comparison result and stack value.

AWEQ D2 D3 // Compare whether D2 equals to D3 and execute “AND” to the comparison result and stack value.

LDDEQ D6 D8 // Load D6D7 and D8D9; compare them if they are equal

ORDEQ D14 K888 // Compare whether D14D15 equals to K888 and execute “OR” to the comparison result and stack value.

ADEQ D10V0 D12Z0 // Compare whether（D10D11+Address offset V0） equals to （D12D13+ Address offset Z0） and execute “AND” to the comparison result and stack value.

LDFEQ D18 D20 // Load floating numbers of D18D19 and D20D21; compare whether they are equal.

ORFEQ D26 K1.234567 // Compare whether the floating number D26D27 equals to K1.234567 and execute “OR” to the comparison result and stack value.

AFEQ D22 D24 // Compare whether the floating number D22D23 equals to D24D25 and execute “AND” to the comparison result and stack value.

ORB // Execute “OR” between the top value on the stack and the current energy flow

ORB // Execute “OR” between the top value on the stack and the current energy flow

OUT Y000 // Output Y000

Ladder Diagram：

说明: 说明: 说明: image002


Comparison <>

Corresponding Instruction | Annotation/Introduction | Operand（Register）
W<> D<> F<> | LDWNE、AWNE、ORWNE LDDNE、ADNE、ORDNE LDFNE、AFNE、ORFNE | K/H/D/CV/TV/AI/AO/V/Z,K/H/D/CT/TV/AI/AO/V/Z K/H/D/CV32,K/H/D/CV32 K/D/CV32,K/D/CV32

Instruction Description：

The instruction of Comparison & Equality is applied to compare whether two values are equal; if the comparison result is positive, then executes the output.

The two numbers are signed

W <> Compare double-byte integers

D <> Compare four-byte integers

F <> compare real numbers

Instance：

Instruction List：

LDWNE D0 D1 // Load D0 and D1; compare them if they are “Not Equal”

ORWNE D4 D5 // Compare whether D4 is “not equal” to D5 and execute “OR” to the comparison result and stack value.

AWNE D2 D3 // Compare whether D2 is “unequal” to D3 and execute “AND” to the comparison result and stack value.

LDDNE D6 D8 // Load D6D7 and D8D9; compare them if they are “unequal”

ORDNE D14 D16 // Compare whether D14D15 is “not equal” to D16D17and execute “OR” to the comparison result and stack value.

ADNE D10 D12 // Compare whether D10D11 is “unequal” to D12D13 and execute “AND” to the comparison result and stack value.

LDFNE D18 D20 // Load floating numbers of D18D19 and D20D21; compare whether they are “Unequal”.

ORFNE D26 D28 // Compare whether the floating number D26D27 is “unequal” to D28D29 and execute “OR” between the comparison result and stack value.

AFNE D22 D24 // Compare whether the floating number D22D23 is “unequal” to D24D25 and execute “AND” between the comparison result and stack value.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

OUT Y000 // Output Y000

Ladder Diagram：

说明: 说明: image002


Comparison >=

Corresponding Instruction | Annotation/Introduction | Operand（Register）
W>= D>= F>= | LDWGE、AWGE、ORWGE LDDGE、ADGE、ORDGE LDFGE、AFGE、ORFGE | K/H/D/CV/TV/AI/AO/V/Z,K/H/D/CT/TV/AI/AO/V/Z K/H/D/CV32,K/H/D/CV32 K/D/CV32,K/D/CV32

Instruction Description：

The instruction of Comparison & Equality is applied to compare whether two values are equal; if the comparison result is positive, then executes the output.

The two numbers are signed

W >= Compare double-byte integers

D >= Compare four-byte integers

F >= compare real numbers

Instance：

Instruction List：

LDWGE D0 D1 // Load D0 and D1; compare whether D0 is “equal or greater than” D1

ORWGE D4 D5 // Compare whether D4 is “equal or greater than” D5 and execute “OR” between the comparison result and stack value.

AWGE D2 D3 // Compare whether D2 is “equal or greater than” D3 and execute “AND” between the comparison result and stack value.

LDDGE D6 D8 // Load D6D7 and D8D9; compare whether D6D7 is “equal or greater than” D8D9

ORDGE D14 D16 // Compare whether D14D15 is “equal or greater than” D16D17and execute “OR” between the comparison result and stack value.

ADGE D10 D12 // Compare whether D10D11 is “equal or greater than” D12D13 and execute “AND” to the comparison result and stack value.

LDFGE D18 D20 // Load floating numbers of D18D19 and D20D21; compare whether D18D19 is “equal or greater than” D20D21

ORFGE D26 D28 // Compare whether the floating number D26D27 is “equal or greater than” D28D29 and execute “OR” between the comparison result and stack value

AFGE D22 D24 // Compare whether the floating number D22D23 is “equal or greater than” D24D25 and execute “AND” between the comparison result and stack value.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

OUT Y000 // Output Y000

Ladder Diagram：

说明: 说明: image002


Comparison <=

Corresponding Instruction | Annotation/Introduction | Operand（Register）
W<= D<= F<= | LDWLE、AWLE、ORWLE LDDLE、ADLE、ORDLE LDFLE、AFLE、ORFLE | K/H/D/CV/TV/AI/AO/V/Z,K/H/D/CT/TV/AI/AO/V/Z K/H/D/CV32,K/H/D/CV32 K/D/CV32,K/D/CV32

Instruction Description：

The instruction of Comparison & Equality is applied to compare whether two values are equal; if the comparison result is positive, then executes the output.

The two numbers are signed

W<= Compare double-byte integers

D<= Compare four-byte integers

F <= compare real numbers

Instance：

Instruction List：

LDWLE D0 D1 // Load D0 and D1; compare whether D0 is “less than or equal to” D1 ORWLE D4 D5 // Compare whether D4 is “less than or equal to” D5 and execute “OR” between the comparison result and stack value.

AWLE D2 D3 // Compare whether D2 is “less than or equal to” D3 and execute “AND” between the comparison result and stack value.

LDDLE D6 D8 // Load D6D7 and D8D9; compare whether D6D7 is “less than or equal to” D8D9

ORDLE D14 D16 // Compare whether D14D15 is “less than or equal to” D16D17and execute “OR” between the comparison result and stack value.

ADLE D10 D12 // Compare whether D10D11 is “less than or equal to” D12D13 and execute “AND” to the comparison result and stack value.

LDFLE D18 D20 // Load floating numbers of D18D19 and D20D21; compare whether D18D19 is “less than or equal to” D20D21

ORFLE D26 D28 // Compare whether the floating number D26D27 is “less than or equal to” D28D29 and execute “OR” between the comparison result and stack value

AFLE D22 D24 // Compare whether the floating number D22D23 is “less than or equal to” D24D25 and execute “AND” between the comparison result and stack value.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

ORB // Execute “OR” between the top value on the stack and the current能energy flow.

OUT Y000 // Output Y000

Ladder Diagram：

说明: 说明: image002


Comparison >

Corresponding Instruction | Annotation/Introduction | Operand（Register）
W> D> F> | LDWG、AWG、ORWG LDDG、ADG、ORDG LDFG、AFG、ORFG | K/H/D/CV/TV/AI/AO/V/Z,K/H/D/CT/TV/AI/AO/V/Z K/H/D/CV32,K/H/D/CV32 K/D/CV32,K/D/CV32

Instruction Description：

The instruction of Comparison & Equality is applied to compare whether two values are equal; if the comparison result is positive, then executes the output.

The two numbers are signed

W > Compare double-byte integers

D > Compare four-byte integers

F > compare real numbers

Instance：

Instruction List：

LDWG D0 D1 // Load D0 and D1; compare whether D0 is “greater than” D1

ORWG D4 D5 // Compare whether D4 is “greater than” D5 and execute “OR” between the comparison result and stack value.

AWG D2 D3 // Compare whether D2 is “greater than” D3 and execute “AND” between the comparison result and stack value.

LDDG D6 D8 // Load D6D7 and D8D9; compare whether D6D7 is “greater than” D8D9 ORDG D14 D16 // Compare whether D14D15 is “greater than” D16D17and execute “OR” between the comparison result and stack value.

ADG D10 D12 // Compare whether D10D11 is “greater than” D12D13 and execute “AND” to the comparison result and stack value.

LDFG D18 D20 // Load floating numbers of D18D19 and D20D21; compare whether D18D19 is “greater than” D20D21

ORFG D26 D28 // Compare whether the floating number D26D27 is “greater than” D28D29 and execute “OR” between the comparison result and stack value

AFG D22 D24 // Compare whether the floating number D22D23 is “greater than” D24D25 and execute “AND” between the comparison result and stack value.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

OUT Y000 // Output Y000

Ladder Diagram：

说明: 说明: image002


Comparison <

Corresponding Instruction | Annotation/Introduction | Operand（Register）
W< D< F< | LDWL、AWL、ORWL LDDL、ADL、ORDL LDFL、AFL、ORFL | K/H/D/CV/TV/AI/AO/V/Z,K/H/D/CT/TV/AI/AO/V/Z K/H/D/CV32,K/H/D/CV32 K/D/CV32,K/D/CV32

Instruction Description：

The instruction of Comparison & Equality is applied to compare whether two values are equal; if the comparison result is positive, then executes the output.

The two numbers are signed

W < Compare double-byte integers

D < Compare four-byte integers

F < compare real numbers

Instance：

Instruction List：

LDWL D0 D1 // Load D0 and D1; compare whether D0 is “less than” D1

ORWL D4 D5 // Compare whether D4 is “less than” D5 and execute “OR” between the comparison result and stack value.

AWL D2 D3 // Compare whether D2 is “less than” D3 and execute “AND” between the comparison result and stack value.

LDDL D6 D8 // Load D6D7 and D8D9; compare whether D6D7 is “less than” D8D9 ORDL D14 D16 // Compare whether D14D15 is “less than” D16D17and execute “OR” between the comparison result and stack value.

ADL D10 D12 // Compare whether D10D11 is “less than” D12D13 and execute “AND” to the comparison result and stack value.

LDFL D18 D20 // Load floating numbers of D18D19 and D20D21; compare whether D18D19 is “less than” D20D21

ORFL D26 D28 // Compare whether the floating number D26D27 is “less than” D28D29 and execute “OR” between the comparison result and stack value

AFL D22 D24 // Compare whether the floating number D22D23 is “less than” D24D25 and execute “AND” between the comparison result and stack value.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

ORB // Execute “OR” between the top value on the stack and the current energy flow.

OUT Y000 // Output Y000

Ladder Diagram：

说明: 说明: image002


Conversion

Contents：

WTOD

DTOW

DTOF

BIN

BCD

ROUND

TRUNC


Integer to Double integer WTOD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
WTOD | Convert 16-bit integer to 32-bit integer | D/K/H/TV/CV/AI/AO/V/Z,D

Instruction Description：

Integer to Double integer instruction（WTOD）is designed to convert an integer value（IN）to a double integer value and place the result to specified variable of OUT.

Instance：

Instruction List：

LD X000

WTOD D0 D1 // Convert the integer D0 to the double integer and store it in the register of D1D2.

Ladder Diagram：


Double integer to Integer DTOW

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DTOW | Convert 32-bit integer to 16-bit integer | D/K/H,D/TV/CV/AO/V/Z

Instruction Description：

Double integer to Integer instruction（DTOW）is designed to convert a double integer value to an integer value（IN） and place the result to specified variable of OUT.

If the value to be converted is too big, the flag bit of value overflow will be set and cannot be displayed in OUT.

It represents value overflow when M_8169 is set.

Instance：

Instruction List：

LD X000

DTOW D0 D2 // Convert the double integer D0D1 to an integer and store it in the register D2.

Ladder Diagram：


Double integer to Floating number DTOF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DTOF | Convert a 32-bit integer to a floating number | D/K/H,D

Instruction Description：

Double integer to Floating number instruction is applied to convert a double integer（IN） to a floating number（DTOF）and place the result to specified variable of OUT.

Instance：

Instruction List：

LD X000

DTOF D0 D2 // Convert the double integer D0D1 to an floating number and store it in the register D2D3.

Ladder Diagram：

说明: 说明: DTOF.JPG


BCD to Integer BIN

Corresponding Instruction | Annotation/Introduction | Operand（Register）
BIN | BCD to 16-bit integer | D/K/H/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

BCD to Integer instruction is applied to convert a BCD value to an integer and load the result to specified variable of OUT. Valid range of IN is 0~9999 of BCD.

It means invalid BCD conversion when M_8169 is set.

Instance：

Instruction List：

LD X000

BIN H0234 D0 // Convert 234 of BCD to an integer and store it in the register D0.

Ladder Diagram：

说明: 说明: BIN.JPG


Integer to BCD BCD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
BCD | 16-bit integer BCD | D/K/H/TV/CV/AI/AO/ V/Z,D/TV/CV/AO/V/Z

Instruction Description：

Integer to BCD instruction is applied to convert an integer to a BCD value and load the result to specified variable of OUT. Valid range of OUT is 0~9999 of BCD.

It means invalid BCD conversion when M_8168 is set.

Instance：

Instruction List：

LD X000

BCD D0 D1 // Convert the integer D0 to BCD and store it in the register D1.

Ladder Diagram：


ROUND

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ROUND | Convert a real number to a double integer value | D/K,D

Instruction Description：

This instruction is applied to convert a real number（IN）to a double integer value and load the result to specified variable of OUT. If the fractional part is equal to or greater than 0.5, it carries to an integer.

Instance：

Instruction List：

LD X000

ROUND K4.56 D0 // Convert the real number 4.56 to a double integer and store it in the register D0D1; 0.56>0.5, so the carry bit is 1 and the conversion result is 5

Ladder Diagram：


TRUNC

Corresponding Instruction | Annotation/Introduction | Operand（Register）
TRUNC | Convert 32-bit real numbers to 32-bit double integers | D/K,D

Instruction Description：

This instruction is applied to convert 32-bit real numbers（IN）to 32-bit double integers and load the integer part to a specified variable of OUT with the fractional part being discarded.

Instance：

Instruction List：

LD X000

TRUNC K4.56 D0 // Convert the real number 4.56 to double integer and store the conversion result (4) to the register D0D1.

Ladder Diagram：


Logic operation

Contents：

INVW

INVD

ANDW

ANDD

ORW

ORD

XORW

XORD


INVW

Corresponding Instruction | Annotation/Introduction | Operand（Register）
INVW | Invert the word | K/H/D/TV/CV/AI/AO/V/Z, D/TV/CV/AO/V/Z

Instruction Description：

This instruction executes the inversion operation to input word and loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

INVW D0 D1 //Invert D0 and input it to D1

Ladder Diagram：

说明: 说明: 说明: 说明: image002


Invert Double words INVD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
INVD | Invert double words | K/H/D,D

Instruction Description：

This instruction inverts input double words and loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

INVD D0 D2 // Invert D0D1 and input it to D1将D2D3

Ladder Diagram：

说明: 说明: INVD.JPG


And Word ANDW

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ANDW | And Word | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction executes AND operation to input words IN1and IN2; then loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

ANDW D0 D1 D2 // Execute AND command to D0 and D1; load the result to D2.

Ladder Diagram：

说明: 说明: image002


And Double Word ANDD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ANDD | And Double Word | K/H/D,K/H/D,D

Instruction Description：

This instruction executes AND operation to input double words IN1and IN2; then loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

ANDD D0 D2 D4 // Execute AND command to D0D1 and D2D3; load the result to D4D5.

Ladder Diagram：

说明: 说明: ANDD.JPG


Or Word ORW

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ORW | Or Word | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction executes OR operation to input words IN1and IN2; then loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

ORW D0 D1 D2 // Execute OR command to D0 and D1; load the result to D2

Ladder Diagram：

说明: 说明: 说明: image002


Or Double Word ORD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ORD | Or Double Word | K/H/D,K/H/D,D

Instruction Description：

This instruction executes OR operation to input double words IN1and IN2; then loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

ORD D0 D2 D4 // Execute OR command to D0D1 and D2D3; load the result to D4D5.

Ladder Diagram：

说明: 说明: ORD.JPG


XOR Word XORW

Corresponding Instruction | Annotation/Introduction | Operand（Register）
XORW | XOR Word | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction executes XOR operation to input words IN1and IN2; then loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

XORW D0 D1 D2 // Execute XOR command to D0 and D1; load the result to D2.

Ladder Diagram：

说明: 说明: image002


XOR Double Word XORD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
XORD | XOR Double Word | K/H/D,K/H/D,D

Instruction Description：

This instruction executes XOR operation to input double words IN1and IN2; then loads the result to the register of OUT.

Instance：

Instruction List：

LD X000

XORD D0 D2 D4 // Execute XOR command to D0D1 and D2D3; load the result to D4D5.

Ladder Diagram：

说明: 说明: XORD.JPG


Transmission

Contents:

MOV

MOVD

MOVF

MVBLK

MVDBLK


Move Word MOV

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MOV | Move words | D/TV/CV/K/H/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction copies input words（S）to output words （D ）without changing original values.

Instance：

Instruction List：

LD X000

MOV D0 D1 // Copy D0 to D1

Ladder Diagram：

说明: 说明: MOV.JPG


Move Double Word MOVD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MOVD | Move double words | D/K/H/CV32,D/CV32

Instruction Description：

This instruction copies input double words（S）to output double words （D ）without changing original values.

Instance：

Instruction List：

LD X000

MOVD D0 D2 // Copy D0D1 to D2D3

Ladder Diagram：

说明: 说明: 说明: MOVD.JPG


Move Real Number MOVF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MOVF | Move real numbers | D/K/AI/AO/CV32,D/CV32

Instruction Description：

This instruction copies input real numbers（S）to output real numbers（D ）without changing original values.

Instance：

Instruction List：

LD X000

MOVF D0 D2 // Copy D0D1 to D2D3

Ladder Diagram：

说明: 说明: MOVF.JPG


Move Block Word MVBLK

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MVBLK | Move block words | D/TV/CV/AI/AO/V/Z, D/TV/CV/AO/V/Z, D/K/H

Instruction Description：

This instruction copies words（N）from Input Address（S） to Output Address （D ）; Range of N is 1~256.

Instance：

Instruction List：

LD X000

MVBLK D0 D5 K10 // Copy ten words of D0~D9 to that of D5~D14.

Ladder Diagram：


Move Double Block Word MVDWBLK

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MVDBLK | Move double block words | D, D, D/K/H

Instruction Description：

This instruction copies double words（N）from Input Address（S） to Output Address （D ）; Range of N is 1~128.

Instance：

Instruction List：

LD X000

MVDBLK D0 D100 K10 // Copy ten double words of D0 D0(D1) ~ D18(D19) to that of D100(D101)~ D118(D119).

Ladder Diagram：


Floating- Point Calculation

Contents:

ADDF

SUBF

MULF

DIVF

SQRT

SIN

COS

TAN

LN

EXP


Add operation of Floating Number ADDF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ADDF | Add floating numbers | K/D/CV32,K/D/CV32,D/CV32

Instruction Description：

This instruction adds two 32-bit real numbers and generates one 32-bit real number result（OUT）.

IN1 + IN2 = OUT

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

ADDF D0 D2 D4 //D0D1 + D2D3 = D4D5

Ladder Diagram：

说明: 说明: 说明: 002.jpg


Subtraction operation of Floating Number SUBF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SUBF | Subtract floating numbers | K/D/CV32,K/D/CV32,D/CV32

Instruction Description：

This instruction subtracts two 32-bit real numbers and generates one 32-bit real number result（OUT）.

IN1 - IN2 = OUT

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

SUBF D0 D2 D4 //D0D1 - D2D3 = D4D5

Ladder Diagram：

说明: 说明: 说明: 002.jpg


Multiply operation of Floating Number MULF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MULF | Multiply floating numbers | K/D/CV32,K/D/CV32,D/CV32

Instruction Description：

This instruction multiplies two 32-bit real numbers and generates one 32-bit real number result（OUT）.

IN1 × IN2 = OUT

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

MULF D0 D2 D4 //D0D1 × D2D3 = D4D5

Ladder Diagram：

说明: 说明: 002.jpg


Division Operation of Floating Number DIVF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DIVF | Divide floating numbers | K/D/CV32,K/D/CV32,D/CV32

Instruction Description：

This instruction divides two 32-bit real numbers and generates one 32-bit real number result（OUT）.

IN1 ÷ IN2 = OUT

M_8170 Negative

M_8171 Zero

M_8172 Divisor is Zero

Instance：

Instruction List：

LD X000

LD X000

DIVF D0 D2 D4 //D0D1 ÷ D2D3 = D4D5

Ladder Diagram：

说明: 说明: 002.jpg


Square Root SQRT

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SQRT | Square Root | D/K/CV32,D/CV32

Instruction Description：

This instruction take the square root of a 32-bit real number and generates one 32-bit real number result（OUT）.

SQRT（IN）= OUT

M_8171 Result of zero

Instance：

Instruction List：

LD X000

SQRT K256 D0 // SQRT(256) = D0D1 = 16

Ladder Diagram：

：

说明: 说明: 002.jpg


SIN

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SIN | Sine function | D/K/CV32,D/CV32

Instruction Description：

This instruction operates triangular calculation to angle value IN and generates one 32-bit real number result（OUT）. Input angle is by unit of Angle; divide the radian by 1.745329E-2 （around PI/180，PI = 3.1415926）to transform the input radian to an angle.

SIN（IN）= OUT

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

SIN K30 D0 // SIN(30°) = D0D1 = 0.5

Ladder Diagram：

说明: 说明: 002.jpg


COS

Corresponding Instruction | Annotation/Introduction | Operand（Register）
COS | Cosine function | D/K/CV32,D/CV32

Instruction Description：

This instruction operates triangular calculation to angle value IN and generates one 32-bit real number result（OUT）. Input angle is by unit of Angle; divide the radian by 1.745329E-2 （around PI/180，PI = 3.1415926）to transform the input radian to an angle.

COS（IN）= OUT

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

COS K60 D0 // COS(60°) = D0D1 = 0.5

Ladder Diagram：

说明: 说明: 002.jpg


TAN

Corresponding Instruction | Annotation/Introduction | Operand（Register）
TAN | Tangent function | D/K/CV32,D/CV32

Instruction Description：

This instruction operates triangular calculation to angle value IN and generates one 32-bit real number result（OUT）. Input angle is by unit of Angle; divide the radian by 1.745329E-2 （around PI/180，PI = 3.1415926）to transform the input radian to an angle. TAN（IN）= OUT

M_8169 Overflow

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

TAN K45 D2 // TAN(45°) = D2D3 = 1

Ladder Diagram：

说明: 说明: 002.jpg


Natural Logarithm LN

Corresponding Instruction | Annotation/Introduction | Operand（Register）
LN | Natural logarithm function | D/K/CV32,D/CV32

Instruction Description：

This instruction operates Natural logarithm calculation to value IN and places the result to OUT.

LN (IN) = OUT

To obtain a logarithm of 10 as the base number from a natural logarithm, divide the natural by 2.302585 (about the natural logarithm of 10).

In order to promote any real number to a power of another real number, including the fractional index, combine the instructions of "natural exponent" and "natural logarithmic".

For example, to promote X to Y by power, enter the following instruction: EXP (Y * LN (X)).

Instance：

Instruction List：

LD X000

LN D0 D2 //LN（D0D1） = D2D3

Ladder Diagram：

说明: 说明: 002.jpg


Natural Exponent EXP

Corresponding Instruction | Annotation/Introduction | Operand（Register）
EXP | Natural exponential function | D/K/CV32,D/CV32

Instruction Description：

The instruction calculates INth power of e and places the result in OUT.

EXP (IN) = OUT

To promote a real number to another real number’s power, including the fractional index: Combine the "natural exponent" instruction with the "natural logarithmic" instruction. For example, to promote X to the power of Y, enter the following instruction:

EXP (Y * LN (X))。

E.g. ：third power of 5 = 5^3=EXP(3*LN(5))=125

Instance：

Instruction List：

LD X000

EXP K3 D2 //EXP（3） = D2D3 = e^3

Ladder Diagram：

说明: 说明: 002.jpg


Integer calculation

Contents:

ADD

ADDD

SUB

SUBD

MUL

MULW

MULD

DIV

DIVW

DIVD

INC

INCD

DEC

DECD


Add operation of 16-bit Integer ADD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ADD | 16-bit integer to 16-bit integer through add operation | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction （ADD）adds two 16-bit integers and generates a 16-bit result number（OUT）

IN1 ＋ IN2 = OUT

M_8169 Overflow

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

ADD D0 D1 D2 //D0 + D1 = D2

Ladder Diagram：

说明: 说明: ADD.JPG


Add operation of Double Integer ADDD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ADDD | Add operation of 32-bit integers | K/H/D/CV32,K/H/D/CV32,D/CV32

Instruction Description：

This instruction （ADDD）adds two 32-bit integers and generates a 32-bit result number（OUT）

IN1 ＋ IN2 = OUT

M_8169 Overflow

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

ADDD D0 D2 D4 //D0D1 + D2D3 = D4D5

Ladder Diagram：

说明: 说明: ADDD.JPG


Subtraction of 16-bit Integer SUB

Corresponding Instruction |  | Annotation/Introduction | Operand（Register）
SUB | Subtraction of 16-bit integers |  | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction （SUB）subtracts two 16-bit integers and generates a 16-bit result number（OUT）

IN1 - IN2 = OUT

M_8169 Overflow

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

SUB D0 D1 D2 //D0 - D1 = D2

Ladder Diagram：

说明: 说明: SUB.JPG


Subtraction of 32-bit Integer SUBD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SUBD | Subtraction of 32-bit integers | K/H/D/CV32,K/H/D/CV32,D/CV32

Instruction Description：

This instruction （SUBD）subtracts two 32-bit integers and generates a 32-bit result number（OUT）

IN1 - IN2 = OUT

M_8169 Overflow

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

SUBD D0 D2 D4 //D0D1 – D2D3 = D4D5

Ladder Diagram：

说明: 说明: SUBD.JPG


Multiply MUL

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MUL | Multiply | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D

Instruction Description：

This instruction （MUL）multiplies two 16-bit integers and generates a 32-bit result number（OUT）

IN1 × IN2 = OUT

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

MUL D0 D1 D2 //D0 × D1 = D2D3

Ladder Diagram：


Multiply 16-bit Integer MULW

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MULW | Multiply 16-bit integers | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction （MUL）multiplies two 16-bit integers and generates a 16-bit result number（OUT）

IN1 × IN2 = OUT

M_8169 Overflow

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

MULW D0 D1 D2 //D0 × D1 = D2

Ladder Diagram：

说明: 说明: MULW.JPG


Multiply 32-bit Integer MULD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MULD | Multiply 32-bit integers | K/H/D/CV32,K/H/D/CV32,D/CV32

Instruction Description：

This instruction （MULD）multiplies two 32-bit integers and generates a 32-bit result number（OUT）

IN1 × IN2 = OUT

M_8169 Overflow

M_8170 Negative

M_8171 Zero

Instance：

Instruction List：

LD X000

MULD D0 D2 D4 //D0D1 × D2D3 = D4D5

Ladder Diagram：

说明: 说明: MULD.JPG


Divide DIV

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DIV | Divide | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D

Instruction Description：

This instruction （DIV）divides a 16-bit integer by another one, and generates a 32-bit result number（OUT）, including a 16-bit quotient and a 16-bit remainder.

IN1 ÷ IN2 = OUT

M_8169 Overflow

M_8170 Result Negative

M_8171 Result Zero

M_8172 Divisor Zero

Instance：

Instruction List：

LD X000

DIV D0 D1 D2 //D0 ÷ D1 = D2D3 D2 stores the quotient while D3 stores the remainder.

Ladder Diagram：


Divide 16-bit Integer DIVW

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DIVW | Divide 16-bit integers | K/H/D/TV/CV/AI/AO/V/Z,K/H/D/TV/CV/AI/AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction （DIVW）divides a 16-bit integer by another one, and generates a 16-bit result number（OUT）.

IN1 ÷ IN2 = OUT

M_8169 Result Overflow

M_8170 Result Negative

M_8171 Result Zero

M_8172 Divisor Zero

Instance：

Instruction List：

LD X000

DIVW D0 D1 D2 //D0 ÷ D1 = D2

Ladder Diagram：

说明: 说明: DIVW.JPG


Divide 32-bit Integer DIVD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DIVD | Divide 32-bit integers | K/H/D/CV32,K/H/D/CV32,D/CV32

Instruction Description：

This instruction （DIVD）divides a 32-bit integer by another one, and generates a 32-bit result number（OUT）

IN1 ÷ IN2 = OUT

M_8169 Overflow

M_8170 Result Negative

M_8171 Result Zero

M_8172 Divisor Zero

Instance：

Instruction List：

LD X000

DIVD D0 D2 D4 //D0D1 ÷ D2D3 = D4D5

Ladder Diagram：

说明: 说明: DIVD.JPG


Add 1 to Integer INC

Corresponding Instruction | Annotation/Introduction | Operand（Register）
INC | Add 1 to Integer | K/H/D/TV/CV/AO/V/Z, D/TV/CV/AO/V/Z

Instruction Description：

This instruction （DIV）adds 1 to a 16-bit integer, and generates a 16-bit result number（OUT）.

IN + 1 = OUT

M_8169 Overflow

M_8170 Result Negative

M_8171 Result Zero

Instance：

Instruction List：

LD X000

INC D0 D0 //D0 + 1 = D0

Ladder Diagram：

说明: 说明: INC.JPG


Add 1 to Double Word INCD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
INCD | Add 1 to Double Word | K/H/D/CV32,D/CV32

Instruction Description：

This instruction （INCD）adds 1 to 32-bit integer and generates a 32-bit integer result（OUT）.

IN + 1 = OUT

M_8169 Overflow

M_8170 Result Negative

M_8171 Result Zero

Instance：

Instruction List：

LD X000

INCD D0 D0 //D0D1 + 1 = D0D1

Ladder Diagram：

说明: 说明: INCD.JPG


Subtract 1 from Integer DEC

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DEC | Subtract 1 from Word | K/H/D/TV/CV/ AO/V/Z,D/TV/CV/AO/V/Z

Instruction Description：

This instruction （DEC）subtracts 1 from a 16-bit integer, and generates a 16-bit result number（OUT）.

IN - 1 = OUT

M_8169 Overflow

M_8170 Result Negative

M_8171 Result Zero

Instance：

Instruction List：

LD X000

DEC D0 D0 //D0 - 1 = D0

Ladder Diagram：


Subtract 1 from Double Word DECD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DECD | Subtract 1 from Double Word | K/H/D/CV32,D/CV32

Instruction Description：

This instruction （DECD）subtracts 1 from a 32-bit integer, and generates a 32-bit result number（OUT）.

IN - 1 = OUT

M_8169 Overflow

M_8170 Result Negative

M_8171 Result Zero

Instance：

Instruction List：

LD X000

DECD D0 D0 //D0D1 - 1 = D0D1

Ladder Diagram：

说明: 说明: DECD.JPG


Timer

Contents:

TON

TONR

TOF


On-Delay Timer TON

Corresponding Instruction | Annotation/Introduction | Operand（Register）
TON | On-Delay Timer | TV,K/H/D

Instruction Description：

The TON instruction starts timing when the status of Enable Input End is "OFF". If the current value (TVx) reaches or exceeds the preset time (SV), the timer bit (Tx) would be "OFF" and the timer stops timing;

When the Enable Input End is "OFF", the on-delay timer is automatically reset, that is, the timer bit (Tx) is OFF and its current value (TVx) is 0;

Tx = T0 ~ T255, TVx = TV0 ~ TV255.

TON, TONR and TOF timers have three kinds of resolution. The resolution is determined by the timer number shown below. Each current value is a multiple of the time benchmark. For example, 50 in the 10 millisecond timer represents 500 milliseconds.

Timer Type | Resolution | Maximum | Timer Number
TON、TONR、TOF | 100ms | 3276.7 sec. | T0 – T199
 | 10ms | 327.67 sec. | T200 – T249
 | 1ms | 32.767 sec. | T250 – T255

Note:

TOF, TONR and TON cannot share the same timer number. For example, it’s impossible to exist at the same time TON TV32 D0 and TOF TV32 D0.

TON is available for single timing interval.

Any timer can be restored with the "Restoration" (RST) instruction:

Timer Bit = OFF, Timer Current Value = 0

Refresh modes of Timer:

FGs series PLC refreshes differently according to timers with different resolutions, so methods vary; please pay attention to conditions and requirements of resolution choice for timer.

(1) 1ms Timer: 1ms Timer refreshes every 1ms via the system, independent of scanning cycle and program processing resulting from it uses the interrupt refresh mode, so when the scan cycle goes beyond 1ms, it may refresh repeatedly in one cycle; its current values ​​(TVx) and (Tx) are not necessarily consistent within a scan cycle.

(2) 10ms Timer: 10ms Timer refreshes automatically in the system at the beginning of each scan cycle. Since it refreshes only once in every scan cycle, the timer bit (Tx) and the current value (TVx) are always consistent.

(3) 100ms Timer: 100ms Timer refreshes only when the timer instruction is executed, so if the 100ms Timer is activated while the timer instruction is not executed for each scan cycle or multiple times during one scan cycle, it will cause the timing inaccurate. 100ms Timer can be applied only in the timer instruction executed once in one scan cycle.

Instances of proper application of Timer:

(1) 1ms Timer: When being applied by a wrong way, the timer can generate a Y0 output with a width of the one scan cycle only when the timer refreshes from executions of T250 normally-closed contact to that of T250 normally-open contact, which has little possibility.

（2）10ms Timer: When being applied by a wrong way, the Y0 output would be never generated because the timer starts to refresh at the beginning of the scanning cycle when reaching the timing; in the example where the T200 is set, the timer would be reset once upon the execution of timer instruction (the current value and the timer bit are set to 0); when the normally-open contact T200 is executed, the T200 is always OFF and so is Y0, that is, it will never be set ON.

（3）100ms Timer: The T0 Timer generates definitely a Y0 output when it reaches the set value since 100ms Timer refreshes during the instruction execution.

Instance：

Instruction List：

Network 000

LD X000

TON TV10 D0 // When the Timer reaches D0, T10 = 1 （D0 is a variable that can also be replaced by a constant, such as K1.）

Network 001

LD T10

OUT Y000

Ladder Diagram：


On-Delay Memory Timer TONR

Corresponding Instruction | Annotation/Introduction | Operand（Register）
TONR | On-Delay Memory Timer | TV,K/H/D

Instruction Description：

The instruction starts timing when the status of Enable Input End is "OFF". If the current value (TVxxx) reaches or exceeds the preset time (SV), the timer bit (Txxx) would be "OFF".

When the Enable Input End is "OFF", it remains the current value of on-delay memory timer. You can cumulate time for multiple stages of OFF through preserving on-delay timers.

Txxx = T0 ~ T255, TVxxx = TV0 ~ TV255.

TON, TONR and TOF timers have three kinds of resolution. The resolution is determined by the timer number shown below. Each current value is a multiple of the time benchmark. For example, 50 in the 10 millisecond timer represents 500 milliseconds.

Timer Type | Resolution | Maximum | Timer Number
TON、TONR、TOF | 100ms | 3276.7 sec. | T0 – T199
 | 10ms | 327.67 sec. | T200 – T249
 | 1ms | 32.767 sec. | T250 – T255

Note:

TOF, TONR and TON cannot share the same timer number. For example, it’s impossible to exist at the same time TONR TV32 D0 and TON TV32 D0.

TONR is available for cumulating multiple timing intervals.

Any timer can be restored with the "Restoration" (RST) instruction:

Timer Bit = OFF, Timer Current Value = 0

Only TONR timer can be restored by RST instruction.

可用"复原"（RST）指令复原任何定时器。"复原"指令执行下列操作：

定时器位 = 断开，定时器当前值 = 0

只能用"复原"指令复原TONR定时器。

Instance：

Instruction List：

Network 000

LD X000

TONR TV251 K100 // When the Timer reaches K100, T251 = 1 （If K100 means the timing reaches 100*1ms, it can be represented by a variable.）

Network 001

LD T251

OUT Y000

Ladder Diagram：


Off-Delay Timer TOF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
TOF | Off-delay Timer | TV,K/H/D

Instruction Description：

This instruction is applied to delay the output for a certain while after closing the output. When checking the Enable Input, the current value is set to 0. The Timer keeps timing after the input OFF till reaching the set lasting time when it closes. If the input OFF time is shorter than the set value, the timer remains ON. The TOF instruction must start to time when it comes to a transformation from OFF to ON.

TON, TONR and TOF timers have three kinds of resolution. The resolution is determined by the timer number shown below. Each current value is a multiple of the time benchmark. For example, 50 in the 10 millisecond timer represents 500 milliseconds.

Timer Type | Resolution | Maximum | Timer Number
TON、TONR、TOF | 100ms | 3276.7 sec. | T0 – T199
 | 10ms | 327.67 sec. | T200 – T249
 | 1ms | 32.767 sec. | T250 – T255

Note:

TOF, TONR and TON cannot share the same timer number. For example, it’s impossible to exist at the same time TONR TV32 D0 and TON TV32 D0.

TOF is available to delay time for beyond OFF (or false) condition, such as cooling dynamo after OFF.

Any timer can be restored with the "Restoration" (RST) instruction:

Timer Bit = OFF, Timer Current Value = 0

After the restoration, TOF timer requires to transform the Enable Input from OFF to ON so as to restart.

Instance：

Instruction List：

Network 000

LD X000

TOF TV200 K1 //When the Timer reaches, T200 = 1 （If K1 represents the timing reaches 1*10ms, K2 means 2*10ms and so on; it can be replaced by a variable.）

Network 001

LD T200

OUT Y000

Ladder Diagram：

说明: 说明: 捕获


Counter

Contents:

CTU

CTUD

CTD


Up-Counter CTU

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CTU | Up-Counter | CV/CV32,K/H/D

Instruction Description：

The up-counter (CTU) instruction counts up from the current value each time the energy flow of up-count input is switched from OFF to ON. When the current value (CVxxx) is greater than or equal to the preset value (SV), the counter bit (Cxxx) turns on. RST Input being ON or the execution of RST instruction results to the counter being restored. The counter won’t stop counting until reaching the maximum value (32,767 or 2147483647).

Counter Range：CVxxx=CV0 ~ CV255；Cxxx= C0 ~ C255

Counter Type | Counter Bit | Maximum | Counter No.
CTU | 16-bit | 32767 | C0 – C199
 | 32-bit | 2147483647 | C200 – C234
 | 32-bit（High speed） | 2147483647 | C235 – C255

Note: Please don’t offer the same counter number to more than one counter (Up-counter and down-counter with the same number access the consistent current value) because each counter has one current value.

Instance：

Instruction List：

Network 000

LD X000

CTU CV0 D0 // The counter starts to count up from the current value of CV0; the set value (SV) is D0.

Network 001

LD C0

OUT Y000

Ladder Diagram：


Down-Counter CTD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CTD | Down-Counter | CV/CV32,K/H/D

Instruction Description：

The down-counter (CTU) instruction counts down from the current value each time the energy flow of down-count input is switched from OFF to ON. When the current value (CVxxx) is 0, the counter bit (Cxxx) turns on while the counter restores the counter bit（Cxxx）and loads the current value thorough the preset value （SV）when opening Load Input (LD). The counter won’t stop counting down until reaching the minimum value (16-bit: 32768, 32-bit: 2147483648).

Counter Range: CVxxx=CV0~ CV255；Cxxx= C0 ~ C255。

Counter Type | Counter Bit | Maximum | Counter No.
CTD | 16-bit | 32767 | C0 – C199
 | 32-bit | 2147483647 | C200 – C234
 | 32-bit（High speed） | 2147483647 | C235 – C255

Note: Please don’t offer the same counter number to more than one counter (Up-counter and down-counter with the same number access the consistent current value) because each counter has one current value.

Instance：

Instruction List：

Network 000

LD X000

CTD CV0 D0 // The counter starts to count down from the current value of CV0; the set value (SV) is D0.

Network 001

LD C0

OUT Y000

Ladder Diagram：


Up & Down-Counter CTUD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CTUD | Up & Down-Counter | CV/CV32,K/H/D

Instruction Description：

The counter (CTUD) instruction estimates the current value and set value each time the energy flow of up-count input is switched from OFF to ON. When the current value (CVxxx) is greater (smaller) than the preset value (SV), the counter (Cxxx) counts down (up) while the counter bit is 1 and the current value remains the same if the two values are equal. RST Input being ON or the execution of RST instruction results to the counter being restored. RST instruction is recommended to restore the counter.

Counter Range：CVxxx=CV0 ~ CV255；Cxxx= C0 ~ C255

Counter Type | Counter Bit | Maximum | Counter No.
CTUD | 16-bit | 32767 | C0 – C199
 | 32-bit | 2147483647 | C200 – C234
 | 32-bit（High speed） | 2147483647 | C235 – C255

Note: Please don’t offer the same counter number to more than one counter (counters with the same number access the consistent current value) because each counter has one current value.

Instance：

Instruction List：

Network 000

LD X000

CTUD CV0 D0 //The counter judges the values of CV0 and D0; then counts up or down判断from the current value; the set value（SV） is D0.

Network 001

LD C0

OUT Y000


Program Control

Contents:

FOR

NEXT

JMP

LBL

CALL

CALLM

TEST


FOR Loop

Corresponding Instruction | Annotation/Introduction | Operand（Register）
FOR | For loop | D/K/H

Instruction Description：

Execute this instruction if the precondition is on. This instruction must be applied in conjunction with the NEXT instruction, which two allow a program area to be specified where a series of instructions that are included will be repeated (CNT) times.

If it is not on, the program skips all the blocks during the FOR-NEXT instruction and executes the remaining instructions.

Note: Maximum nesting of FOR loop is 8.

Instance：

Instruction List：

LD X000

FOR K10 //cycle 10 times

…… //execute others

NEXT

Ladder Diagram：


Loop End of latest FOR NEXT

Corresponding Instruction | Annotation/Introduction | Operand（Register）
NEXT | Matched with FOR | None

Instruction Description：

It is always matched with latest NEXT instruction to end the FOR loop.

Instance：

Instruction List：

LD X000

FOR K10 // cycle 10 times

…… //execute others

NEXT

Ladder Diagram：


Internal Program Jump JMP

Corresponding Instruction | Annotation/Introduction | Operand（Register）
JMP | Jump within the program | K/H

Instruction Description：

Jump to the JMP instruction label and perform branch operations on the specified label (LBL) in the program.

When this instruction is accepted, the top stack value is always logic 1.

It’s available in main programs, subroutines, and interrupt subroutines.

"Jump" and its corresponding "label" instructions must always be in the same code segment (main program, subroutine or interrupt subroutine).

Instance：

Instruction List：

LD X000

JMP K0 // Jump to K0 if the top stack value is 1

…… // Range out of execution

LBL K0

……

Ladder Diagram

说明: 说明: image002


Internal Program Label LBL

Corresponding Instruction | Annotation/Introduction | Operand（Register）
LBL | Internal Program Label | K/H

Instruction Description：

Display the jumping location when applied in cooperation with JMP instruction.

Instance：

Instruction List：

LD X000

JMP K0 //Jump to K0 if the top stack value is 1

…… // Range out of execution

LBL K0

……

Ladder Diagram：


Call Subroutine CALL

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CALL | Call Subroutine | Subroutine ID

Instruction Description：

When the CALL instruction is valid, it will force the program to run the same subroutine as the subroutine ID number, and the next instruction to be executed by the calling subroutine will automatically return to the current CALL instruction.

When the CALL instruction is invalid, the program will automatically skip this CALL instruction and execute the next one.

Note:

1. When the instruction is input, the subroutine input corresponds to K10, the interrupt routine corresponds to K100, PID program corresponds to K200;

E.g.: The following ladder diagram, CALL instruction associated with the subroutine SBR_0 input: CALL K10 can be associated with the subroutine SBR_1 CALL K11, and so on.

2. The CALL subroutine calls 8 nested layers maximally.

Instance：

Instruction List：

LD X000

CALL SBR_0（SBR0） // Call subroutine SBR0

Ladder Diagram：

说明: 说明: 说明: image001


C Function Calls Function Function Block CALLM

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CALLM | C Function Calls Function function block | Function function block No.; word address (D,TV,CV,AO); Bit address(M,S,Y)

Instruction Description：

Compilation introduction of C function:

1) Each function function block has multiple functions, but the function for the ladder call is named void XXX (WORD W, BIT B) (note that the space should be the same), where XXX represents the function function block name; In order to facilitate the description, the function here is called "main function" while the others are "sub-functions”.

2) The main function must have no return value, that is, the void type, and the parameter form is fixed to (WORD W, BIT B).

3) Subfunctions have no form restrictions. But the form is not supposed to be the same as the main function with the void XXX (WORD W, BIT B), so as to avoid conflict with the main function; if the function form is necessary, the parameter name can include XXX (WORD w, BIT b), XXX (WORD D, BIT M), and so on instead of W, B, or , .

4) It would modify the function function block name if the sub-function you compile has the form of void XXX (WORD W, BIT B), the same as the main function; please re-modify the function and select a main function.

5) The current available flash of the C function function block: 0x1FF0 bytes; ram: 0x600 bytes. If the function quotes the mathematical library or other standard C library functions, it will take up a larger flash space and ram space.

Introduction of Main function:

The form of main functions must be void XXX (WORD W, BIT B), where XXX represents the name of the function function block, WORD W corresponds to the PLC register (D, TV, CV, AO), BIT B corresponds to the PLC register (M, S, Y).

Assume that the incoming parameters are W: D2, B: M3, then W [0] => D2, B [0] => M3, W [1] => D3, B [1] => M4, W[2] => D4, B [2] => M5, and so on. That is, W [n] (B [n]) is equal to the incoming register plus n.

Apply FW [n] to represent floating point numbers; note that floating number and double integer both occupies 4 bytes, i.e. two consecutive D; the same as W: D2, then FW [0] => D2D3, FW [1 = D4D5, FW [2] => D6D7, DW [0] => D2D3, DW [1] => D4D5 and so on.

Calculation formula: Suppose that the incoming parameters are W: Di, B: Mk, then W[n]==Di+n，B[n]==Mk+n，FW[n]==Di+2nDi+2n+1，DW[n]==Di+2nDi+2n+1

Operation for Double Word:

We can see from the above explanation that if the input parameter is W: D0, then W [0] => D0, it can only take a single word within D0; as for double word processing, it can employ the address to take values compulsively; mandatory values of integer arguments are D0 (D1) => * (int *) W, D100 (D101) => * (int *) (W +100), and so on.

Instance：

Function Function Block Init：

/**

Initialize the register

**/

void Init(WORD W, BIT B)

{

W[0] = 6;

W[1] = 4;

W[2] = 2;

W[3] = 7;

W[4] = 9;

W[5] = 1;

W[6] = 17;

}

Function Function Block Sort：

/**

Sort by descending order

W[0] is the element number of sorting

W[1] is the head address of elements

**/

void Sort(WORD W, BIT B)

{

short i;

short j;

short temp;

for(i=W[0]; i>1; i--)

{

for(j=1; j<i; j++)

if(W[j] < W[j+1])

{

temp= W[j];

W[j] = W[j+1];

W[j+1] = temp;

}

}

}

Instruction List：

LDP M0 // When M0 rising edge coming, execute the function function block Init so as for D[0]=6，D[1]=4，D[2]=2，D[3]=7，D[4]=9，D[5]=1，D[6]=17

CALLM K2 D0 M0 // K2 is a parameter generated by system that needs no worry.

LDP M1 // When M0 rising edge coming, execute the function function block Sort, in order to sort D[1]~D[6] by descending order; results are: D[1]=17，D[2]=9，D[3]=7，D[4]=4，D[5]=2，D[6]=1

CALLM K1 D0 M0 // K1 is a parameter generated by system that needs no worry.

LDWG D1 D2

AWG D3 D4

AWG D5 D6

OUT Y000 // If D1>D2>D3>D4>D5>D6, Y000 is 1

Ladder Diagram：

说明: 说明: 说明: 捕获

Instance（Double Word Operation）

/*****************************

FunctionName:GetNum

Move the Int in D0(D1) to D100(D101)

*****************************/

void GetNum(WORD W, BIT B)

{

int temp;

temp = *(int *)W;

*(int *)(W + 100) = temp;

}

Ladder Diagram：

说明: 说明: 说明: 捕获


Shift Instruction

Contents:

SHL

SHLD

SHR

SHRD

ROL

ROLD

ROR

RORD

SHRB

SHLB


Shift Word Left SHL

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SHL | Shift words left | D/K/H/TV/CV/AI/AO/V/Z,D/K/H,D/TV/CV/AO/V/Z

Instruction Description：

This instruction moves the input word (IN1) left by IN2 and loads the result into the output word (OUT). The shift instruction fills ach shift bit with 0. If the shift number (IN2) is greater than or equal to 16, the value would be shifted up to 16 times. If the shift number is greater than 0, the overflow memory bit (M_8166) adopts the last shifting bit value. If the shift operation result is 0, set the memory bit (M_8167) to 0.

M_8166 is set to the overflow bit for the last bit shifted out

M_8167 is set to the zero bit if the shift result is zero

Instance：

Instruction List：

LD X000

SHL D0 K1 D1 // Shift D0 left by one bit to D1

Ladder Diagram：

.. 说明: 说明: SHL.JPG


Shift Double Word Left SHLD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SHLD | Shift Double Word Left | D/K/H,D/K/H,D

Instruction Description：

This instruction moves the input double word (IN1) left by IN2 and loads the result into the output word (OUT). The shift instruction fills ach shift bit with 0. If the shift number (IN2) is greater than or equal to 32, the value would be shifted up to 32 times. If the shift number is greater than 0, the overflow memory bit (M_8166) adopts the last shifting bit value. If the shift operation result is 0, set the memory bit (M_8167) to 0.

M_8166 is set to the overflow bit for the last bit shifted out

M_8167 is set to the zero bit if the shift result is zero

Instance：

Instruction List：

LD X000

SHLD D0 K1 D2 // Shift D0D1 left by one bit to D2D3

Ladder Diagram：


Shift Word Right SHR

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SHR | Shift Word Right | D/K/H/TV/CV/AI/AO/V/Z,D/K/H,D/TV/CV/AO/V/Z

Instruction Description：

This instruction moves the input word (IN1) right by IN2 and loads the result into the output word (OUT). The shift instruction fills ach shift bit with 0. If the shift number (IN2) is greater than or equal to 16, the value would be shifted up to 16 times. If the shift number is greater than 0, the overflow memory bit (M_8166) adopts the last shifting bit value. If the shift operation result is 0, set the memory bit (M_8167) to 0.

M_8166 is set to the overflow bit for the last bit shifted out

M_8167 is set to the zero bit if the shift result is zero

Instance：

Instruction List：

LD X000

SHR D0 K1 D1 // Shift D0 right by one bit to D1

Ladder Diagram：


Shift Double Word Right SHRD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SHRD | Shift Double Word Right | D/K/H,D/K/H,D

Instruction Description：

This instruction moves the input double word (IN1) right by IN2 and loads the result into the output word (OUT). The shift instruction fills ach shift bit with 0. If the shift number (IN2) is greater than or equal to 32, the value would be shifted up to 32 times. If the shift number is greater than 0, the overflow memory bit (M_8166) adopts the last shifting bit value. If the shift operation result is 0, set the memory bit (M_8167) to 0.

M_8166 is set to the overflow bit for the last bit shifted out

M_8167 is set to the zero bit if the shift result is zero

Instance：

Instruction List：

LD X000

SHRD D0 K1 D2 // Shift D0D1 right by one bit to D2D3

Ladder Diagram：


Shift Bit Left SHLB

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SHLB | Shift Bit Left | X/Y/M/S/T/C, Y/M/S/T/C,D/K/H,D/K/H

Instruction Description：

The length of coil element source [SRC.] is n2; the length of target coil element [DST.] is n1; n2≤n1≤Max length of the target coil; it is meant to shift the n1-bit (length of shifting coil) element left by n2 bits. The instruction performs an n2-bit shifting.

As follows:

 | [SRC.] | [DST.] | n1 | n2
SHLB | Y0 | M0 | K8 | K2

Process of Instruction Execution：

(1) M7,M6 → Shift Out

(2) M5,M4 → M7,M6

(3) M3,M2 → M5,M4

(4) M1,M0 → M3,M2

(5) Y1,Y0 → M1,M0

说明: 说明: image002

Instance：

Instruction List：

LD X000

SHLB M0 Y0 K16 K1 // Shift out Y017, shift Y016 in Y017…then shift M0 in Y0

Ladder Diagram：

说明: 说明: image001


Shift Bit Right SHRB

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SHRB | Shift Bit Right | X/Y/M/S/T/C, Y/M/S/T/C,D/K/H,D/K/H

Instruction Description：

The length of coil element source [SRC.] is n2; the length of target coil element [DST.] is n1; n2≤n1≤Max length of the target coil; it is meant to shift the n1-bit (length of shifting coil) element right by n2 bits. The instruction performs an n2-bit shifting.

As follows:

 | [SRC.] | [DST.] | n1 | n2
SHRB | Y0 | M0 | K8 | K2

(1) Process of Instruction Execution：

(2) M1,M0 → Shift Out

(3) M3,M2 → M1,M0

(4) M5,M4 → M3,M2

(5) M7,M6 → M5,M4

(6) Y1,Y0 → M7,M6

Instance：

Instruction List：

LD X000

SHRB M0 Y000 K16 K1 // Shift out Y000, shift Y001 in Y000…then shift M0 in Y017

Ladder Diagram：


Shift Loop Word Left ROL

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ROL | Shift Loop Word Left | D/K/H/TV/CV/AI/AO/V/Z,D/K/H,D/TV/CV/AO/V/Z

Instruction Description：

This instruction rotates the input value（IN1） left by IN2 bits and load the result to the output word（OUT）. Rotation is circular. If the shifting bits（IN2） are greater than or equal to 16, 在旋转执行之前的移动位数（IN2）上执行模数16操作从而使移动位数在0至15之间。如果移动位数为0，则不执行旋转操作。如果执行旋转操作，旋转的最后一位数值被复制至溢出位（M_8166）。如果移动位数不是16的整倍数，旋转出的最后一位数值被复制至溢出内存位（M_8166）。如果旋转数值为0，设置0内存位（M_8167）。

M_8166 为移出的最后一个位设置为溢出位

M_8167 如果移位结果是零，则设置零位

实例：

指令表：

LD X000

ROL D0 K1 D1 //将D0循环左移1位输出到D1

梯形图：


循环双字左移 ROLD

对应命令 | 注释/说明 | 操作数（寄存器）
ROLD | 循环双字左移 | D/K/H,D/K/H,D

指令说明：

指令将输入字数值（IN1）向左旋转IN2位，并将结果载入输出字（OUT）。旋转具有循环性。如果移动位数（IN2）大于或等于32，在旋转执行之前的移动位数（IN2）上执行模数32操作。从而使移动位数在0至31之间。如果移动位数为0，则不执行旋转操作。如果执行旋转操作，旋转的最后一位数值被复制至溢出位（M_8166）。如果移动位数不是32的整倍数，旋转出的最后一位数值被复制至溢出内存位（M_8166）。如果旋转数值为0，设置0内存位（M_8167）。

M_8166 为移出的最后一个位设置为溢出位

M_8167 如果移位结果是零，则设置零位

实例：

指令表：

LD X000

ROLD D0 K1 D2 //将D0D1循环左移1位输出到D2D3

梯形图：


循环字右移 ROR

对应命令 | 注释/说明 | 操作数（寄存器）
ROR | 循环字右移 | D/K/H/TV/CV/AI/AO/V/Z,D/K/H,D/TV/CV/AO/V/Z

指令说明：

指令将输入字数值（IN1）向右旋转IN2位，并将结果载入输出字（OUT）。旋转具有循环性。如果移动位数（IN2）大于或等于16，在旋转执行之前的移动位数（IN2）上执行模数16操作。从而使移动位数在0至15之间。如果移动位数为0，则不执行旋转操作。如果执行旋转操作，旋转的最后一位数值被复制至溢出位（M_8166）。如果移动位数不是16的整倍数，旋转出的最后一位数值被复制至溢出内存位（M_8166）。如果旋转数值为0，设置0内存位（M_8167）。

M_8166 为移出的最后一个位设置为溢出位

M_8167 如果移位结果是零，则设置零位

实例：

指令表：

LD X000

ROR D0 K1 D1 //将D0循环右移1位输出到D1

梯形图：


循环双字右移 RORD

对应命令 | 注释/说明 | 操作数（寄存器）
RORD | 循环双字右移 | D/K/H,D/K/H,D

指令说明：

指令将输入字数值（IN1）向右旋转IN2位，并将结果载入输出字（OUT）。旋转具有循环性。如果移动位数（IN2）大于或等于32，在旋转执行之前的移动位数（IN2）上执行模数32操作。从而使移动位数在0至31之间。如果移动位数为0，则不执行旋转操作。如果执行旋转操作，旋转的最后一位数值被复制至溢出位（M_8166）。如果移动位数不是32的整倍数，旋转出的最后一位数值被复制至溢出内存位（M_8166）。如果旋转数值为0，设置0内存位（M_8167）。

M_8166 为移出的最后一个位设置为溢出位

M_8167 如果移位结果是零，则设置零位

实例：

指令表：

LD X000

RORD D0 K1 D2 //将D0D1循环右移1位输出到D2D3

梯形图：


Interrupt Instruction

Contents:

ATCH

DTCH

EI

DI


Interrupt binding ATCH

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ATCH | Interrupt binding | Interrupt subroutine of ID，K

Instruction:

This instruction associates the interrupt event number (EVNT) with the interrupt subroutine number (INT) and enables the interrupt event. Interrupt event numbers (EVNT) are as below:

Interrupt vector table:

Interrupt Number | Interrupt Event
K0 | Rising edge of X000 triggered
K1 | Falling edge of X000 triggered
K2 | Edge change of X000 triggered
K3 | Rising edge of X001 triggered
K4 | Falling edge of X001 triggered
K5 | Edge change of X001 triggered
K6 | Abort Timer 0 Note：Set value is D8173; timing range is 1~32767ms and resolution is 1ms
K7 | Abort Timer 1 Note：Set value is D8174; timing range is 1~32767ms and resolution is 1ms
Only multi-pulse PLC: FGm_32MT_A and FGm_64MT_A have following events
K8 | Pulse Y0 completes sending Interrupt
K9 | Pulse Y1 completes sending Interrupt
K10 | Pulse Y2 completes sending Interrupt
K11 | Pulse Y3 completes sending Interrupt
K12 | Pulse Y4 completes sending Interrupt
K13 | Pulse Y5 completes sending Interrupt
K14 | Pulse Y6 completes sending Interrupt
K15 | Pulse Y7 completes sending Interrupt
K16 | Pulse Y10 completes sending Interrupt
K17 | Pulse Y11 completes sending Interrupt
K18 | C235 Counting completes interruption
K19 | C236 Counting completes interruption
K20 | C237 Counting completes interruption
K21 | C238 Counting completes interruption
K22 | C239 Counting completes interruption
K23 | C240 Counting completes interruption
K24 | C241 Counting completes interruption
K25 | C242 Counting completes interruption
K26 | C243 Counting completes interruption
K27 | C244 Counting completes interruption
K28 | C245 Counting completes interruption
K29 | C246 Counting completes interruption
K30 | Interruption of rising edge of X2
K31 | Interruption of falling edge of X2
K32 | Interruption of edge of X2
K33 | Interruption of rising edge of X3
K34 | Interruption of falling edge of X3
K35 | Interruption of edge of X3
K36 | Interruption of rising edge of X4
K37 | Interruption of falling edge of X4
K38 | Interruption of edge of X4
K39 | Interruption of rising edge of X5
K40 | Interruption of falling edge of X5
K41 | Interruption of edge of X5

Note:

1. Edge change interrupt of Input port and Timing interrupt have less priority than other interrupts;

2. The external interrupt is not executed when a high-speed count or pulse interrupt is input with an external interrupt at the same time.

3. When several external interrupts are input in the meantime, only the first detected one is executed.

4. The total frequency of all external interrupts should not be too high.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
INT |  |  | Interrupt subroutine ID
EVNT | Word | K | Interrupt event number

Instance：

Instruction List：

Network 000

LDP M0

ATCH INTR_0（INTR0） K0 //Associate Interrupt event（EVNT）K0 with Interrupt subroutine INTR_0

EI //Enable Interrupt

Network 001

LDP M1

DTCH K0 //Release Interrupt

Network 002

LDP M2

DI //Inhibit Interrupt

Ladder Diagram


Release Interrupt DTCH

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DTCH | Release Interrupt | K

Instruction:

This instruction releases the association of Interrupt event number（EVNT） and inhabits the events;

Interrupt event numbers (EVNT) are as below:

Interrupt vector table:

Interrupt Number | Interrupt Event
K0 | Rising edge of X000 triggered
K1 | Falling edge of X000 triggered
K2 | Edge change of X000 triggered
K3 | Rising edge of X001 triggered
K4 | Falling edge of X001 triggered
K5 | Edge change of X001 triggered
K6 | Abort Timer 0 Note：Set value is D8173; timing range is 1~32767ms and resolution is 1ms
K7 | Abort Timer 1 Note：Set value is D8174; timing range is 1~32767ms and resolution is 1ms

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
EVNT | Word | K | Interrupt event number

Instance：

Instruction List：

Network 000

Network 000

LDP M0

ATCH INTR_0（INTR0） K0 // Associate Interrupt event（EVNT）K0 with Interrupt subroutine INTR_0

EI // Enable Interrupt

Network 001

LDP M1

DTCH K0 // Release Interrupt

Network 002

LDP M2

DI // Disable Interrupt

Ladder Diagram：


Enable Interrupt EI

Corresponding Instruction | Annotation/Introduction | Operand（Register）
EI | Enable Interrupt | NONE

Instruction:

This instruction enables overall associated interrupt events; it needs to enable global interrupts before executing Subroutine interrupts. When in RUN mode, the initial state is Inhibit Interrupt that enabling all interrupts. Disable Interrupt can prohibit the interrupt process; however, activated interrupt events are still in line.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute

Instance：

Instruction List：

Network 000

LDP M0

ATCH INTR_0（INTR0） K0 //Associate Interrupt event（EVNT）K0 with Interrupt subroutine INTR_0

EI // Enable Interrupt

Network 001

LDP M1

DTCH K0 Release Interrupt

Network 002

LDP M2

DI // Disable Interrupt

Ladder Diagram：


Disable Interrupt DI

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DI | Disable Interrupt | NONE

Instruction:

This instruction disables overall interrupt events.

When in RUN mode, the initial state is Inhibit Interrupt that enabling all interrupts. Disable Interrupt can prohibit the interrupt process; however, activated interrupt events are still in line.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute

Instance：

Instruction List：

Network 000

LDP M0

ATCH INTR_0（INTR0） K0 //Associate Interrupt event（EVNT）K0 with Interrupt subroutine INTR_0

EI // Enable Interrupt

Network 001

LDP M1

DTCH K0 Release Interrupt

Network 002

LDP M2

DI // Disable Interrupt

Ladder Diagram：


Real-time Clock

Contents:

TRD

TWR


Read Real-time Clock TRD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
TRD | Read Real-time Clock | D

Instruction:

This instruction reads the current time and date from hardware clock, and then loads it to 8 continuous D in Time buffer starting from the address T where it needs 2 bytes to represent year.

All data and time must be in BCD format (for example, 8211 means the year of 2013).

Please refer to the following table:

T（Dn – Dn+7） | Description | Information
0 | Year（2000 -- 2099） | Current year（BCD）
1 | Month（1 -- 12） | Current month（BCD）
2 | Day（1 -- 31） | Current day（BCD）
3 | Hour（0 -- 23） | Current hour（BCD）
4 | Minute（0 -- 59） | Current minute（BCD）
5 | Second（0 -- 59） | Current second（BCD）
6 | 00 | Reserve
7 | Weekday（0 -- 6） | Current weekday; 0=Sunday（BCD）

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
T | Word | D | Start address of register for saving time read

Instance：

Instruction List：

LD X000

TRD D0 //Read time to D0~D7

Ladder Diagram：


Write Real-time clock TWR

Corresponding Instruction | Annotation/Introduction | Operand（Register）
TWR | Write Real-time clock | D

Instruction:

This instruction writes the current time and date to hardware clock, and the current clock is saved in 8 continuous D of Time buffer starting from the address T where it needs 2 bytes to represent year.

All data and time must be in BCD format (for example, 8211 means the year of 2013).

Please refer to the following table:

T（Dn – Dn+7） | Description | Information
0 | Year（2000 -- 2099） | Current year（BCD）
1 | Month（1 -- 12） | Current month（BCD）
2 | Day（1 -- 31） | Current day（BCD）
3 | Hour（0 -- 23） | Current hour（BCD）
4 | Minute（0 -- 59） | Current minute（BCD）
5 | Second（0 -- 59） | Current second（BCD）
6 | 00 | Reserve
7 | Weekday（0 -- 6） | Determined by year, month and day and cannot be modified

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
T | Word | D | Start address of register for saving time read

Instance：

Instruction List：

LD X000

TWR D0 //Write the current time and date stored in D0~D7 to hardware clock

Ladder Diagram：


Communication Instruction

Contents:

MBUS


Modbus for Master Station communication MBUS （Unavailable for now ）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
MBUS | Call Modbus for Master station communication | K/H, Table ID, D

Instruction:

1. COM_ID: Select communication port, COM0 (232) or COM1 (485);

2. Table: Modbus Table ID of Master station, which can be added in the window of Project Manager if necessary;

3. WR: Dn, Dn + 1, where Dn is used to store the communication information code (see the table below), Dn + 1 to store the Modbus command number in the current Master station table,

4. Modify the configuration information: select Parameter Settings of COM Port , such as the Master station number, Baud rate, Parity bit, Timeout time, and then selection of the Modbus Master mode;

Note:

1. Execution of this instruction requires Master station mode of COM port (232/485) and to check Download configuration information to PLC, otherwise it’s ineffective; please refer to PLC Parameter Setting for details concerning settings;

2. Though the third operand WR of this instruction only needs to input Dn so as to represent the communication information code, Dn + 1 is also practical for returning the Modbus command number of the current master table, additionally the value of Dn + 1 cannot be modified elsewhere;

3. Timeout time of serial port communication can be set in the Master mode of Modbus and the default is 200ms; it defines itself 10 times of reconnection in internal PLC but users can adjust the timeout time according to the actual situation, for instance: when setting the timeout time to 200ms , PLC will re-send the data packet if nothing returns from the slave station in 200ms; if after 10 times of re-transmission within a total of 2s from the station and still nothing responds, it will return a communication error code 16: 0x10;

4. The returned communication info code is stored in Dn register during the PLC operation; its value is a decimal number, and the followings in table are hexadecimal numbers, such as: communication returns Dn value = 16, converted into Hexadecimal = 0x10, which means that communication timeout;

5．One same COM port can not communicate simultaneously with a number of slave stations, and users should note that access of internal PLC to external slave devices is a sequential implementation;

Communication Information Code：

Code | Infomation
0x01 | Illegal function code
0x02 | Illegal address
0x03 | Illegal data
0x04 | Operation failure of Slavestation
0x05 | Effective command; be in Processing
0x06 | Slave is busy
0x07 | Illegal data type
0x08 | Illegal command Number
0x09 | Illegal password
0x10 | Communication timeout
0x11 | Numerical value error: Value less than 0 or more than 255
0x12 | Setting error of Master-slave station
0x13 | Station number same with that designed by the instruction
0x14 | Element address overflow: data size received or sent exceeds element storage space
0x15 | Command execution failure
0x18 | Information frame error, including length error and check error
0x20 | Parameter cannot be modified
0x21 | Parameter cannot be modified when running
0x22 | Parameter is protected by password

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
COM_ID |  |  | Selected COM port
Table |  |  | Table identification of Modbus Master station
WR | Word | D | Store communication info code

Instance：

Add one Master station table first in Project Manager, as follows:

Instruction List：

LD X000

MBUS K0 K0 D0 //D0 stores communication information while D1 stores the serial number of instruction currently being executed

Ladder Diagram：

Operation flow of PLC ladder:

1. Execute first the instruction table with slave station number of 1 to which PLC sends data packages, and that returns information then; in this situation, D1 = 0;

2. During this situation, it will not execute the corresponding instruction even if the PLC has scanned it, until the slave device mentioned in the first instruction returns normally or it goes beyond the timeout time;

3. After the execution of first instruction, it will execute the second one by order when ladder scans again the first one, that is, PLC will send data packages to device with slave station number of 5 and wait for return information, in which case D1=1;

4. The third instruction is similar to the previous two, followed by the execution of the instruction cycle, in which case, D1 = 2;

5. It should be noted that, for the same COM port, it is impossible to communicate with multiple slave devices at the same time result from the sequential order, although the execution is so fast that can be seen as synchronous.


Pulse Output Instruction

Contents：

PLSF

DPLSF

PWM

DPWM

PLSY

DPLSY

PLSR

PLSRD

DPLSR

DPLSRD

PLSNEXT

PLSSTOP

ZRN

DZRN

PTO

DRVI

DDRVI


Frequency-variable Pulse Output PLSF/DPLSF

Corresponding Instruction | Annotation/Introduction | Operand（Register）
PLSF(16-bit)/DPLSF(32-bit) | Frequency-variable Pulse Output | Output frequency(K/H/D) Output pulse Y

Instruction:

1) For the transistor type GC controller, Y000 ~ Y001 ports are for high-speed pulse output: the output frequency range of 16-bit PLSF instruction is 0 ~ 65535Hz; the range of 32-bit DPLSF is 0Hz ~ 200KHz;

2) For the relay type GC controller, the maximum output frequency of all output ports is determined by the response time of the relay;

3) When the input terminal is "ON", it starts immediately continuous output pulse at the set pulse frequency, during which time the pulse frequency is adjustable until the Enable input of the pulse instruction is turned OFF. When the prerequisite condition of the pulse command is turned on, the continuous output pulse is started at the set pulse frequency, the process pulse frequency is adjustable until the precondition of the pulse command is off; can be used for the variable pulse frequency continuous output pulse;

4) There is no acceleration / deceleration time during frequency hopping;

5) This function can be used for motor jog control, pulse transmission without acceleration and deceleration process, so jog control speed can not be too high, with accelerated jog control can refer to the instruction PLSR / DPLSR / PLSRD / DPLSRD;

6) The instruction does not include direction output; port number of direction signal output and signal control can be customized and set by user, such as wiring diagram, direction signal output port Y2, Y3 and Z-phase input can be defined by the user.

Cumulative Pulse counting (Read and Write, only 0 can be written)：

Register | Pulse output Yn
D_8140(D_8141) | Y000
D_8142(D_8143) | Y001

Overflow flag of 32-bit cumulative pulse counting; overflow bit is 1 (Read only)：

Register | Pulse output Yn
M_8118 | Y000
M_8119 | Y001

Note：

1. Output frequency of DPLSF is 32-bit positive integer, occupying two consecutive D registers; output frequency of PLSF is 16-bit positive integer, occupying one D register;

2. Different pulse instructions cannot share the same serial number of pulses Y, such as it is illegal for DPLSR D0 D100 Y000 and PLSF D0 Y000 to exist at the same time, even when the prerequisite is OFF; if you want to operate on the same output port, the subroutine is recommended;

3. High-speed pulse output is for external high-speed devices; if pulse counting is needed, it can only apply the high-speed pulse input counter, instead of internal counter, neither counting by changes of Y edge;

4. The OFF time of transistor has the characteristic that it will be extended in case of light loads. So please set to increase the load current and resistance in response to the lighter load;

5. For pulse output Y0, register D8140 (D8141) accumulates its number of pulses; D8141 stores high 16-bit while D8140 stores lower 16-bit;

6. Cumulative Pulse counting register (D8140 ~ D8142) is important that can be can read and write but it has write-protection; it can apply MOVD instruction to write 0 to work as a clear register while it cannot write other values;

7. Because the pulse output of this instruction hasn’t direction, the pulse accumulation count register (D8140 ~ D8142) can only count in the positive direction;

8. During high-speed pulse output, values in the pulse accumulation count register (D8140 ~ D8142) are discontinuous and changeable; thus, it’d be better to operate number comparison instead of equality judgment.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
Frequency of Output（Hz） | Integer/Double integer | K/H/D | Set impulse frequency
Output pulse Y | BOOL | Y | Specified pulse output port

Instance：

Wiring Diagram：

Instruction List：

Network 000

LDP M8151 //Assign value when it arrives the rising edge of M8151; rising edge is a must to prevent PLC from repeating assignment

MOVD K400 D0 //Original frequency

Network 001

LDP M1

MOVD K900 D0 //Change the value of D0

Network 002

LDP M2

MOVD K650 D0 // Change the value of D0

Network 003

LDP M3

MOVD K500 D0 // Change the value of D0

Network 004

LD M0

DPLSF（or PLSF） D0 Y000 //When M0 is‘1’, output the pulse with the frequency of D0D1(or D0) via Y000; Otherwise stop the pulse output; the pulse output changes according to the value of D0D1.

Ladder Diagram：

Sequence Diagram：


Pulse Width Modulation PWM/DPWM

Corresponding Instruction | Annotation/Introduction | Operand（Register）
PWM(16-bit)/DPWM(32-bit) | Pulse Width Modulation | Output frequency(K/H/D) Output duty cycle(K/H/D) Output pulse Y

Instruction:

1) For the transistor type GC controller, Y000 ~ Y001 ports are for high-speed pulse output: the output frequency range of 16-bit PLSF instruction is 0 ~ 65535Hz while the duty cycle range is K0~K100; the frequency range of 32-bit DPLSF is 0Hz ~ 200KHz and that of duty cycle is K0~K100;

2) For the relay type GC controller, the maximum output frequency of all output ports is determined by the response time of the relay;

3) When the input terminal is "ON", it starts immediately continuous output pulse at the set pulse frequency, during which time the pulse frequency and duty cycle are adjustable until the Enable input of the pulse instruction is turned OFF. It can be used for the continuous output pulse with variable pulse frequency and duty cycle;

4) There is no acceleration / deceleration time during frequency hopping;

Cumulative Pulse counting (Read and Write)：

Register | Pulse output Yn
D_8140(D_8141) | Y000
D_8142(D_8143) | Y001

Overflow flag of 32-bit cumulative pulse counting; overflow bit is 1 (Read only)：

Register | Pulse output Yn
M_8118 | Y000
M_8119 | Y001

Note：

1. Output frequency of DPWM and duty cycle are 32-bit positive integer, occupying two consecutive D registers; those of PWM are 16-bit positive integer, occupying one D register;

2. High-speed pulse output is for external high-speed devices; if pulse counting is needed, it can only apply the high-speed pulse input counter, instead of internal counter, neither counting by changes of Y edge.

3. The OFF time of transistor has the characteristic that it will be extended in case of light loads. So please set to increase the load current and resistance in response to the lighter load;

4. For pulse output Y0, register D8140 (D8141) accumulates its number of pulses; D8141 stores high 16-bit while D8140 stores lower 16-bit;

5. Cumulative Pulse counting register (D8140 ~ D8142) is important that can be can read and write; it will operate Plus/Minus based on the new value when writing a new value;

6. Because the pulse output of this instruction hasn’t direction, the pulse accumulation count register (D8140 ~ D8142) can only count in the positive direction;

7. During high-speed pulse output, values in the pulse accumulation count register (D8140 ~ D8142) are discontinuous and changeable; thus it’d be better to operate number comparison instead of equality judgment;

8. The pulse frequency should not be far high for precise control of pulse width in case of frequency distortion;

9. Different pulse instructions cannot share the same serial number of pulses Y, such as it is illegal for DPLSR D0 D100 Y000 and PLSF D0 Y000 to exist at the same time, even when the prerequisite is OFF; if you want to operate on the same output port, the subroutine is recommended.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
Frequency of Output（Hz） | Integer/Double integer | K/H/D | Set impulse frequency
Duty cycle (%) | Integer/Double integer | K/H/D | Set duty cycle
Output pulse Y | Integer/Double integer | Y | Specified pulse output port

Instance：

Instruction List：

Network 000

LD M0

DPWM D0 D2 Y000 // When M0 is ‘1’, Output frequency at Y000 is D0D1 and duty cycle is percentage of D2D3 of the pulse.

Ladder Diagram： PWM1697

Instruction List：

Network 001

LD M0

PWM D0 D1 Y000 // When M0 is ‘1’, Output frequency at Y000 is D0 and duty cycle is percentage of D1 of the pulse.

Ladder Diagram： PWM1890


Single stage Pulse Output without acceleration or deceleration PLSY/DPLSY

Corresponding Instruction | Annotation/Introduction | Operand（Register）
PLSY(16-bit)/DPLSY(32-bit) | Single stage Pulse Output without acceleration or deceleration | Output frequency(K/H/D) Output pulse number (K/H/D) Output pulse Y

Instruction:

1）For the transistor type GC controller, Y000 ~ Y001 ports are for high-speed pulse output: the output frequency range of 16-bit PLSF instruction is 0 ~ 65535Hz; the range of 32-bit DPLSF is 0Hz ~ 200KHz;

2) For the relay type GC controller, the maximum output frequency of all output ports is determined by the response time of the relay;

3) This instruction can be applied to output a pulse at a certain frequency and with assigned pulse number. During the pulse output, the flag bit of Outputting of corresponding pulse is reset where pulse and frequency are adjustable;

4) There is no acceleration / deceleration time during frequency hopping;

5) This instruction can be applied for motor jog control; pulse output controls acceleration / deceleration, thus jog control speed should not be too high.

6) The instruction does not include direction output; port number of direction signal output and signal control can be customized and set by user, such as wiring diagram, direction signal output port Y2, Y3 and Z-phase input can be defined by the user.

Flag of Outputting Pulse (Read only)：

Register | Pulse output Yn
M_8134 | Y000
M_8135 | Y001

Cumulative Pulse counting (Read and Write, only 0 can be written)：

Register | Pulse output Yn
D_8140(D_8141) | Y000
D_8142(D_8143) | Y001

Overflow flag of 32-bit cumulative pulse counting; overflow bit is 1 (Read only)：

Register | Pulse output Yn
M_8118 | Y000
M_8119 | Y001

Note：

1. Output frequency of DPLSF is 32-bit positive integer, occupying two consecutive D registers; output frequency of PLSF is 16-bit positive integer, occupying one D register;

2. High-speed pulse output is for external high-speed devices; if pulse counting is needed, it can only apply the high-speed pulse input counter, instead of internal counter, neither counting by changes of Y edge.

3. The OFF time of transistor has the characteristic that it will be extended in case of light loads. So please set to increase the load current and resistance in response to the lighter load;

4. For pulse output Y0, register D8140 (D8141) accumulates its number of pulses; D8141 stores high 16-bit while D8140 stores lower 16-bit;

5. Cumulative Pulse counting register (D8140 ~ D8142) is important that can be can read and write; it will operate Plus/Minus based on the new value when writing a new value;

6. Because the pulse output of this instruction hasn’t direction, the pulse accumulation count register (D8140 ~ D8142) can only count in the positive direction;

7. During high-speed pulse output, values in the pulse accumulation count register (D8140 ~ D8142) are discontinuous and changeable; thus, it’d be better to operate number comparison instead of equality judgment;

8. When the output port Y is applied for pulse instruction, it’s unavailable for anywhere, that is, normal instructions can not execute ON or OFF operation on Y port.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
Frequency of Output（Hz） | Integer/Double integer | K/H/D | Set impulse frequency
Pulse Output Number | Integer/Double integer | K/H/D | Set impulse frequency
Output pulse Y | BOOL | Y | Specified pulse output port

Instance：

Instruction List：

Network 000

LDP M8151 ///Assign value when it arrives the rising edge of M8151; rising edge is a must to prevent PLC from repeating assignment

MOVD K400 D0 //Original frequency

Network 001

LDP M1

MOVD K900 D0 //Change the value of D0

Network 002

LDP M2

MOVD K650 D0 //Change the value of D0

Network 003

LDP M3

MOVD K500 D0 //Change the value of D0

Network 004

LD M0

DPLSY（or PLSY） D0 D2 Y000 //When M0 is‘1’, output the pulse with the frequency of D0D1(or D0) via Y000; when the pulse number meets the value of D3D2（or D2）, the output pulse stops and flag of outputting pulse M_8134 is reset.

Network 005

LDF M8134

RST M0 K1

Ladder Diagram：

Sequence Diagram：


Multiple Segment Pulse Output PLSR/DPLSR/PLSRD/DPLSRD

Corresponding Instruction | Annotation/Introduction | Operand（Register）
PLSR(16-bit)/DPLSR(32-bit) | Unidirectional relative position multiple segment pulse output | Element start address No. of assigned segmentation pulse output parameters (D) Value of assigned acceleration and deceleration (K/H) Or Element address number (D) Port number of assigned pulse output (Y)
PLSRD(16-bit)/DPLSRD(32-bit) | Bidirectional relative position multiple segment pulse output | Element start address No. of assigned segmentation pulse output parameters (D) Value of assigned acceleration and deceleration (K/H) Or Element address number (D) Port number of assigned pulse output (Y) Port number of assigned pulse output direction (Y)

Instruction:

1) For the transistor type GC controller, Y000 ~ Y001 ports are for high-speed pulse output: the output frequency range of 16-bit PLSF instruction is 0 ~ 65535Hz; the range of 32-bit DPLSF is 0Hz ~ 200KHz;

2) For the relay type GC controller, the maximum output frequency of all output ports is determined by the response time of the relay;

3) Set the values of multi-segment frequency and pulse number in the address of pulse parameters, a section of area where starts from Dn.

Ø 16-bit Instruction PLSR: Take D0 as the starting address as an example. D0 sets the maximum frequency of the first segment pulse; D1 sets the pulse number of first segment; D2 sets the maximum frequency of the second segment; D3 sets the pulse number of the second segment…Dn sets the maximum frequency of the (n+2)/2 rd segment; Dn+1 sets the pulse number of the (n+2)/2 th segment to 0 to indicate the end of the segment and segment number is unlimited.

Ø 32-bit Instruction DPLSR: Take D0 (double word) as the starting address as an example.D0 (double word) sets the maximum frequency of the first segment pulse; D2 (double word) sets the pulse number of first segment; D4 (Double word)sets the maximum frequency of the second segment; D6 (double word) sets the pulse number of the second segment…Dn sets the maximum frequency of the (n + 4) / 4th segment; Dn + 2 sets the pulse number of the (n + 4) / 4-th segment to 0 to indicate the end of the segment and segment number is unlimited.

4) Corresponding output frequency of 16-bit Instruction PLSR is 0¬32767Hz and the range of pulse number is K0-K32767; the output frequency of 21-bit PLSR instruction is from 0 to 32767Hz and the range of pulse number is K0-K2147483647; Acceleration / deceleration time means the acceleration / deceleration time from the starting frequency to a stable frequency. In one same instruction, the acceleration / deceleration time is the same that ranges from 0 to 65536ms.

Required relationship among set pulse frequency, pulse number and acceleration/deceleration time: (Starting Frequency Hz + End Frequency Hz) × (Acceleration / Deceleration time ms ÷ 1000) <= Pulse Number × 2.

5)When illegal or illogical parameter is set, it won’t ignore the error and the program will report an error with ERR red light ON if the flag bit of Whether Ignore Error is SET, resulting to the non-execution of error instruction while continuous execution of others. Users can read the error number in D8176 to check the cause. The error code is as follows. The error pulse position is available in D8108-D8111. After modification, download the program again, thus the error status will be canceled, and the program will run properly. When the M8070-M8073 is reset, errors will be ignored and ERR light will be OFF; but the error will still be detected and the corresponding register will show the wrong state. However it will send forcibly the pulse during when the pulse frequency may hop while the pulse number is still accurate.

Error Code（D8176） | Error Interpretation | Cause and Modification
23 | Paragraph number of multi-segment pulse instruction exceeds the maximum （Possibly without complete flag of segmentation） | It means end of instruction when frequency and pulse number of PLSR Instruction are zero; if an error is reported, it may be due to the lack of End flag or set paragraphs more than the default maximum paragraphs.
24 | The maximum pulse frequency of the first segment needs to be higher than the default starting frequency | The default starting frequency of first segment is 100HZ, thus the maximum of first segment shouldn’t be lower.
25 | Frequency lower than the minimum | Frequency shouldn’t be too low; please select Non-acceleration/deceleration instruction if low frequency is necessary.
26 | Pulse number of single segment less than the minimum | Pulse number of each segment shouldn’t be too small; otherwise the acceleration/deceleration operation is ineffective.
27 | Acceleration/deceleration time less than the minimum | Acceleration/deceleration time is so little that the hopping span of segment frequency is too big to start.
28 | Parameters don’t meet logical requirements of acceleration/deceleration. | Parameters don’t meet logical relationship and please modify them.
29 | The last segment doesn’t meet logical requirements of acceleration/deceleration; please give due consideration to pulse number. | The last segment will decrease by default the end frequency to zero without the need of user setting (except PTO instruction); please take consideration of pulse number of deceleration: （Starting Frequency Hz + End Frequency Hz）×（Acceleration/Deceleration Time ms÷1000） <= Pulse Number

6) The Pulse direction Y of Bidirectional relative position Multi-segment pulse output PLSRD / DPLSRD is determined only by the positive/negative of pulse number or pulse frequency set for the first segment. When the pulse number or frequency set in the first stage is positive, it has positive direction and the Y output is ON; while negative direction and Y output OFF when the pulse number or frequency is negative. For absolute position instructions, the pulse number represents the absolute position; positive or negative of each segment can be different and it will automatically change the direction.

7) This instruction can be applied for Jogging Advance and Jogging Retreat, Relative position multi-segment pulse output and Return to Origin.

Flag Bit of Outputting Pulse (Read only)：

Register | Pulse output Yn
M_8134 | Y000
M_8135 | Y001

Pulse Direction; 1 means Positive direction：

Register | Pulse output Yn
M_8102 | Y000
M_8103 | Y001

Overflow flag of 32-bit cumulative pulse counting; overflow bit is 1 (Read only)：

Register | Pulse output Yn
M_8118 | Y000
M_8119 | Y001

Cumulative pulse counting (Read/Write, only 0 can be written)：

Register | Pulse output Yn
D_8140(D_8141) | Y000
D_8142(D_8143) | Y001

Whether Ignore Error and continue sending pulse; 0 means Ignore by default and it will stop pulse output if 1 is set:

Register | Pulse output Yn
M_8070 | Y000
M_8071 | Y001

Check whether pulse numbers and frequencies of each segment set by users are correct; 1 means error (Read only)：

Register | Pulse output Yn
M_8086 | Y000
M_8087 | Y001

Current pulse segment (Read only)：

Register | Pulse output Yn
D_8124 | Y000
D_8125 | Y001

Position of error pulse segment; 0 means no error (Read only)：

Register | Pulse output Yn
D_8108 | Y000
D_8109 | Y001

Note：

1. Output frequency of DPLSR is 32-bit positive integer, occupying two consecutive D registers; output frequency of PLSF is 16-bit positive integer, occupying one D register;

2. High-speed pulse output is for external high-speed devices; if pulse counting is needed, it can only apply the high-speed pulse input counter, instead of internal counter, neither counting by changes of Y edge.

3. The OFF time of transistor has the characteristic that it will be extended in case of light loads. So please set to increase the load current and resistance in response to the lighter load;

4. For pulse output Y0, register D8140 (D8141) accumulates its number of pulses; D8141 stores high 16-bit while D8140 stores lower 16-bit;

5. Cumulative Pulse counting register (D8140 ~ D8142) is important that can be can read and write; it will operate Plus/Minus based on the new value when writing a new value;

6. Because this instruction has a direction, the pulse accumulation count register (D8140 ~ D8142) counts corresponding to the direction;

7. During high-speed pulse output, values in the pulse accumulation count register (D8140 ~ D8142) are discontinuous and changeable; thus it’d be better to operate number comparison instead of equality judgment;

8. When it has n segments of pulse, the pulse frequency addresses and pulse number addresses of each segment, the first, second, third, till the nth segment must be sequential, and addresses of the pulse frequency and pulse number must be 0, thus it can be applied to judge whether it is the end of the pulse; addresses of acceleration and deceleration time cannot follow immediately after the nth segment;

9. When the number of pulses is K-1 or Hffff (16-bit) / Hffffffff (32-bit), it indicates that the pulse will output and won’t switch to another segment until the PLSNEXT instruction executes.

10. The default starting frequency of first segment is 100HZ that the stabilized frequency of first one shouldn’t be lower than during high-speed pulse output.

11. The current pulse segment (D8124-D8133) records it only during pulse transmission and returns automatically to zero when the instruction is disabled.

12. When the output port Y is applied for pulse instruction, it’s unavailable for anywhere, that is, normal instructions can not execute ON or OFF operation on Y port.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
Address of Pulse parameters | Integer/Double integer | D | Starting address of set value of multi-segment frequency
Acceleration/ Deceleration time（ms） | Integer/Double integer | K/D | Starting address of set value of multi-segment pulse
Output pulse Y | BOOL | Y | Specific pulse output port
Direction Y | BOOL | Y | Pulse direction of PLSRD/DPLSRD

Instance：

Instruction List：

1）Jogging Advance and Jogging Retreat of Acceleration/ Deceleration

Set the first pulse number to K-1, and then the pulse outputs all the way. When it is set to M0, the motor accelerates gradually to the highest frequency while M0 continuous output; pulse output decelerates till stop if M0 OFF; when M0 is set again, the motor starts from zero to realize jogging function. With sparing acceleration/deceleration process, If the motor has the function of power-on self-locking (holding torque), the maximum frequency should not be set far high; if the mechanical transmission part has the function of reverse self-locking, please select a low speed for the highest frequency. It just needs to change the state of Y2 for jogging retreat.

Instruction List：

LD M8151

MOVD K1000 D0 //Maximum frequency of Jogging: 1000Hz

MOVD K-1 D2 //Output pulse all the way

FMOVD K0 D4 K2 //Complement mark of pulse segment

MOVD K1000 D100 // Acceleration/ Deceleration time 1000Ms

LD M0

OR M1

DPLSRD D0 D100 Y000 Y2 // DPLSRD instruction starts to work when M0 is set.

OUT M1

LDN M0

AND M1

PLSNEXT Y000 //Deceleration stops when M0 is OFF.

LDN M8134 // Reset M0 and M1 after stopping pulse output.

RST M1 K1

Ladder Diagram：

2）Relative position multi-segment pulse output

Instruction List：

Network 000

LD M8151

MOVD K1000 D0 // Maximum frequency of the first segment: 1000Hz

MOVD K1000 D2 //Pulse number of the first segment: 1000PLS

MOVD K500 D4 // Maximum frequency of the second segment: 500Hz

MOVD K2000 D6 // Pulse number of the second segment: 2000PLS

MOVD K3000 D8 // Maximum frequency of the third segment: 3000Hz

MOVD K2000 D10 // Pulse number of the third segment: 2000PLS

MOVD K800 D12 // Maximum frequency of the 4th segment: 800Hz

MOVD K3000 D14 // Pulse number of the 4th segment: 3000PLS

MOVD K3000 D16 // Maximum frequency of the 5th segment: 3000Hz

MOVD K4000 D18 // Pulse number of the 5th segment: 4000PLS

MOVD K1200 D20 // Maximum frequency of the 6th segment: 1200Hz

MOVD K3000 D22 // Pulse number of the 6th segment: 3000PLS

FMOVD K0 D24 K2 // Complement mark of pulse segment

MOVD K1000 D100 // Acceleration/ Deceleration time 1000Ms

Network 001

LD M0

DPLSR D0 D100 Y000// PLSR instruction starts to work when M0 is set.

Network 002

LDF M8134 //Complement mark of pulse transmission

RST M0 K1 //Reset M0

Ladder Diagram：

Sequence Chart：

3）Return to Origin

In the following figure, this method of Return to Origin requires two input signals of sensor, a deceleration signal X0 and an origin signal X1, respectively. When the deceleration signal X0 is input, the motor starts to decelerate immediately till to the return speed and then enter into a steady state. When the origin signal is input, it stops sending pulse immediately.

Instruction List：

LD M8151

MOVD K1000 D0 //Running speed 1000Hz

MOVD K-1 D2 //Output pulse all the way

MOVD K200 D4 //Return speed 200Hz

MOVD K-1 D6 // Output pulse all the way

FMOVD K0 D8 K2 // Complement mark of pulse transmission

MOVD K1000 D100 // Acceleration/ Deceleration time 1000Ms

LD M0

DPLSRD D0 D100 Y000 Y2 // DPLSRD instruction starts to work when M0 is set.

LDP X0 // Deceleration signal X0

PLSNEXT Y000 //Rising edge of X0, Deceleration

LDP X1 //Origin signal X1

PLSSTOP Y000 //Rising edge of X1, Stop immediately

LDF M8134 // RST M0 after stopping pulse sending

RST M1 K1

Ladder Diagram：


Switch Pulse PLSNEXT

Corresponding Instruction | Annotation/Introduction | Operand（Register）
PLSNEXT | Switch pulse segment | Port number of pulse output Y

Instruction：

PLSNEXT instruction can switch the pulse to the frequency of next pulse segment when pulse output instructions of PLSR / DPLSR / DPLSR / PLSRD / DPLSRD reach the maximum frequencies of the current segment and output stabilization. If M0 is OFF-> ON, it will enter immediately into the next segment of pulse output during the acceleration / deceleration time.

Note:

1. During the process of pulse output acceleration / deceleration, the execution of this instruction is invalid; execute PLSNEXT instruction when the last pulse reaches the highest frequency and the output is stable, thus the pulse output will be terminated in deceleration time;

2. This instruction can only switch the pulse segments of PLSR / DPLSR / PLSRD / DPLSRD instructions.

3. Only edge triggering is applied for PLSNEXT instruction, otherwise it will cause pulse transmission disorder.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
Output pulse Y | BOOL | Y | Specific pulse output port

Instance：

Instruction List：

Network 000

LD M8151

MOVD K1000 D0 //The highest frequency of the first segment: 1000Hz

MOVD K-1 D2 //The pulse number of the first segment reaches the maximum; the pulse always outputs if at a stable frequency; it waits or PLSNEXT instruction.

MOVD K500 D4 // The highest frequency of the second segment: 500Hz

MOVD K999999999 D6 // The pulse number of the second segment: 999999999PLS

FMOVD K0 D8 K2 // Complement mark of pulse segment

MOVD K1000 D100 // Acceleration/ Deceleration time: 1000ms

Network 001

LD M0

DPLSR D0 D100 Y000// PLSR instruction starts to work when M0 is set.

Network 002

LDF M8134 //Complete pulse sending

RST M0 K1 //Reset M0

Network 003

LDP X000 //Trigger the rising edge of X000

PLSNEXT Y000 //Switch pulse segment of Y000

Ladder Diagram：

Sequence Diagram：


Stop Pulse PLSSTOP

Corresponding Instruction | Annotation/Introduction | Operand（Register）
PLSSTOP | Pulse stops outputting | Port number of pulse output Y

Instruction：

When the terminal of Enable Input is OFFàON, Yn stops pulse output at once; PLSSTOP is triggered by rising edge

Note:

1. PLSSTOP is triggered by the rising edge;

2. Please notice that the way to stop pulse output is an immediate stop.

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
Output pulse Y | BOOL | Y | Specific pulse output port

Instance：

Instruction List：

Network 000

LDP M0 //Rising edge of M0 is triggered.

RLSSTOP Y000 //Y000 stops pulse output.

Ladder Diagram：


Return to Origin ZRN/DZRN/DZRND

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ZRN（16-bit）/DZRN（32-bit） | Return to Origin | Returning speed（K/H/D） Creeping speed（K/H/D） Signal of Approaching Point（X/M） Output pulse（Y）

Instruction：

When the terminal of Enable Input is ON, ZRN/DZRN/DZRND instructions output first pulses at the creeping speed; when Signal of Approaching Point is set, it will decelerate at once from Creeping speed and frequency to Returning speed and frequency; when the signal is reset, it stops pulse output. If the terminal is OFF, pulse output stops immediately.

Flag of Pulse being sending (Read only)：

Register | Pulse output Yn
M_8134 | Y000
M_8135 | Y001

Cumulative pulse counting (Read/Write, only 0 can be written)：

Register | Pulse output Yn
D_8140(D_8141) | Y000
D_8142(D_8143) | Y001

Acceleration/Deceleration time of Return to Origin (Read/Write)：

Register | Pulse output Yn
D_8076 | Y000
D_8077 | Y001

Note:

1. After the execution of Return to Origin instruction, the Cumulative pulse counting register (D8140 ~ D8142) of corresponding output port will be cleared automatically as the origin;

Effective operands of Instruction：

I/O | Type | Operand | Description
EN | BOOL |  | Execute when connecting Enable Input; otherwise not execute
Returning speed | Integer/Double integer | K/H/D | Set Returning speed
Creeping speed | Integer/Double integer | K/H/D | Set Creeping speed
Signal of Approaching Point | Integer/Double integer | X/M | Specific Signal of Approaching Point
Output pulse Y | BOOL | Y | Specific pulse output port

Instance：

Instruction List：

Network 000

LD M8151

MOV K1000 D0 //Creeping speed; pulse frequency: 1000Hz

MOV K200 D2 // Returning speed; pulse frequency: 200Hz

MOV K500 D8076 //Deceleration time: 500ms

Network 001

LD M0

ZRN D0 D2 X0 Y0 //When M0 is 1,Y0 outputs the pulse with the frequency of D0; it outputs then from the speed of D0 to D2 in the time of D8076 when X0 receives a rising edge; it will stop pulse output shortly after X0 receiving a falling edge.

Ladder Diagram：

Instruction List：

Network 000

LD M8151

MOVD K1000 D0 // Creeping speed; pulse frequency: 1000Hz

MOVD K200 D2 // Returning speed; pulse frequency: 200Hz

MOVD K500 D8076 // Deceleration time: 500ms

Network 001

LD M0

DZRN D0 D2 M0 Y0 // When M0 is 1,Y0 outputs the pulse with the frequency of D0; it outputs then from the speed of D0 to D2 in the time of D8076 when X0 receives a rising edge; it will stop pulse output shortly after X0 receiving a falling edge.

Ladder Diagram：

Sequence Diagram:


Relative position multi-segment pulse control PTO（32-bit）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
PTO(32-bit) | Relative position multi-segment pulse control | Staring address No. of pulse parameter of specific segment (D) Specific pulse output port No. (Y) Specific pulse output port direction. （Y）

Instruction：

1) For the transistor type GC controller, Y000 ~ Y001 ports are for high-speed pulse output: the output frequency range of 16-bit PLSF instruction is 0 ~ 65535Hz; the range of 32-bit DPLSF is 0Hz ~ 200KHz;

2) For the relay type GC controller, the maximum output frequency of all output ports is determined by the response time of the relay;

3）Addresses of parameter settings are in an area starting from Dn. E.g., D0 (D1) sets the total number of pulse segments, D2 (D3) sets the starting frequency of the first pulse, D4 ​​(D5) sets the end frequency of the first, D6 (D7) sets the pulse number of the first, D8 (D9) sets the starting frequency of the second pulse… Dn + 1 (Dn + 2) sets the max frequency of the (n+6)/6th segment pulse, Dn + 3 (Dn + 4) sets the ending frequency of the (n+6)/6th segment pulse, Dn + 5 (Dn + 6) sets the pulse number of the (n+6)/6th segment;

4）During the process of pulse output, the frequency accelerates from the starting frequency till the end one without acceleration setting, and the steps of this acceleration process is the pulse number of this segment, as shown in the sequence diagram;

5) The direction signal is specified in the instruction, where Y3 is specified as the direction output and its direction is determined by the value in the register address.

Pulse direction, 1 means Positive direction (Read Only)：

Register | Pulse output Yn
M_8102 | Y000
M_8103 | Y001

Cumulative pulse counting (Read/Write, only 0 can be written)：

Register | Pulse output Yn
D_8140(D_8141) | Y000
D_8142(D_8143) | Y001

Current pulse segment (Read only)：

Register | Pulse output Yn
D_8124 | Y000
D_8125 | Y001

Position of error pulse segment; 0 means no error (Read only)：

Register | Pulse output Yn
D_8108 | Y000
D_8109 | Y001

Note：

1. When it is in the Nth segment, addresses of pulse frequencies and pulse numbers of the first, second, third,…Nth segment must be successive and continuous;

2. The OFF time of transistor has the characteristic that it will be extended in case of light loads. So please set to increase the load current and resistance in response to the lighter load;

3. For pulse output Y0, register D8140 (D8141) accumulates its number of pulses; D8141 stores high 16-bit while D8140 stores lower 16-bit;

4. Cumulative Pulse counting register (D8140 ~ D8142) is important that can be can read and write; it will operate Plus/Minus based on the new value when writing a new value;

5. Because this instruction has a direction, the pulse accumulation count register (D8140 ~ D8142) counts corresponding to the direction;

6. During high-speed pulse output, values in the pulse accumulation count register (D8140 ~ D8142) are discontinuous and changeable; thus, it’d be better to operate number comparison instead of equality judgment;

7. The default starting frequency of first segment is 100HZ that the stabilized frequency of first one shouldn’t be lower than during high-speed pulse output.

8. The current pulse segment (D8124-D8125) records it only during pulse transmission and returns automatically to zero when the instruction is disabled.

9. For PTO, it cannot switch to next segment pulse by the instruction of PLSNEXT.

Instance：

Instruction List：

Network 000

LD M8151

MOVD K7 D0 //Total segment number is 7

MOVD K1 D2 //Direction sigh, 0 or 1; set the state of Y3 in this program

MOVD K200 D4 //Starting frequency of the first segment: 200HZ

MOVD K400 D6 //End frequency of the first segment: 400HZ

MOVD K1000 D8 // Pulse number of the first segment: 1000PLS

MOVD K400 D10 // Starting frequency of the second segment: 400HZ

MOVD K650 D12 // End frequency of the second segment 650HZ

MOVD K2000 D14 // Pulse Number of the second segment 2000PLS

MOVD K650 D16 // Starting frequency of the 3rd segment: 650HZ

MOVD K900 D18 // End frequency of the 3rd segment:900HZ

MOVD K5000 D20 // Pulse number of the 3rd segment:5000PLS

MOVD K900 D22 // Starting frequency of the 4th segment: 900HZ

MOVD K900 D24 // End frequency of the 4th segment:900HZ

MOVD K4000 D26 // Pulse number of the 4th segment:4000PLS

MOVD K900 D28 / Starting frequency of the 5th segment: 900HZ

MOVD K650 D30 // End frequency of the 5th segment: 650HZ

MOVD K3000 D32 // Pulse number of the 5th segment: 3000PLS

MOVD K650 D34 // Starting frequency of the 6th segment: 650HZ

MOVD K500 D36 // End frequency of the 6th segment: 500HZ

MOVD K2500 D38 // Pulse number of the 6th segment: 2500PLS

MOVD K500 D40 // Starting frequency of the 7th segment: 500HZ

MOVD K0 D42 // End frequency of the 7th segment: 0HZ

MOVD K1500 D44 // Pulse number of the 7th segment: 1500PLS

Network 001

LD M0

PTO D0 Y0 Y3 //Data start from D0, Pulse output Y0, Direction Y3

Ladder Diagram：

Sequence Diagram:


Relative position single-segment pulse output DRVI/DDRVI

Corresponding Instruction | Annotation/Introduction | Operand（Register）
DRVI(16-bit)/DDRVI(32-bit) | Relative position single-segment pulse output | Output frequency (K/H/D) Output pulse number (K/H/D) Output pulse Y

Instruction:

1) For the transistor type GC controller, Y000 ~ Y001 ports are for high-speed pulse output; for one-way pulse, the output frequency range of 16-bit instruction is 0 ~ 32767Hz and that of pulse number is K0~K32767; the ranges of 32-bit instruction are 0Hz ~ 200KHz and K0~K2147483647, respectively;

2) For the relay type GC controller, the maximum output frequency of all output ports is determined by the response time of the relay;

3）This instruction is applied to output pulses at certain frequency and with certain pulse number; at the beginning, it accelerates uniformly from 100HZ to a specific speed so as to output at a constant speed; in the end, it decelerates to zero; thus, it finishes one segment pulse;

4）Required relationship among set pulse frequency, pulse number and acceleration/deceleration time: (Starting Frequency Hz + End Frequency Hz) × (Acceleration / Deceleration time ms ÷ 1000) <= Pulse Number × 2

When illegal or illogical parameter is set, it won’t ignore the error and the program will report an error with ERR red light ON if the flag bit of Whether Ignore Error is SET, resulting to the non-execution of error instruction while continuous execution of others. Users can read the error number in D8176 to check the cause. The error code is listed in PLSR instruction. The error pulse position is available in D8108-D8109. After modification, download the program again, thus the error status will be canceled, and the program will run properly.

5）Function: Position control of single-segment ladder

Flag of being Outputting Pulse (Read only)：

Register | Pulse output Yn
M_8134 | Y000
M_8135 | Y001

Cumulative Pulse counting (Read and Write, only 0 can be written)：

Register | Pulse output Yn
D_8140(D_8141) | Y000
D_8142(D_8143) | Y001

Whether Ignore Error and continue sending pulse; 0 means Ignore by default and it will stop pulse output if 1 is set (Read &Write):

Register | Pulse output Yn
M_8070 | Y000
M_8071 | Y001

Acceleration/Deceleration time of Relative position (Read &Write):

Register | Pulse output Yn
D_8092 | Y000
D_8093 | Y001

Note：

1. Different pulse instructions cannot share the same serial number of pulses Y, such as it is illegal for DPLSR D0 D100 Y000 and PLSF D0 Y000 to exist at the same time, even when the prerequisite is OFF; if you want to operate on the same output port, the subroutine is recommended;

2. High-speed pulse output is for external high-speed devices; if pulse counting is needed, it can only apply the high-speed pulse input counter, instead of internal counter, neither counting by changes of Y edge;

3. The OFF time of transistor has the characteristic that it will be extended in case of light loads. So please set to increase the load current and resistance in response to the lighter load;

4. For pulse output Y0, register D8140 (D8141) accumulates its number of pulses; D8141 stores high 16-bit while D8140 stores lower 16-bit;

5. Cumulative Pulse counting register (D8140 ~ D8142) is important that can be can read and write but it has write-protection; it can apply MOVD instruction to write 0 to work as a clear register while it cannot write other values;

6. Because this instruction has a direction, the pulse accumulation count register (D8140 ~ D8158) counts corresponding to the direction;

7. During high-speed pulse output, values in the pulse accumulation count register (D8140 ~ D8142) are discontinuous and changeable; thus, it’d be better to operate number comparison instead of equality judgment;

Instance：

Instruction List：

Network 000

LD M8151

MOV K10000 D0 //Number of output pulse

MOV K1000 D2 //Frequency of output pulse

MOV K500 D8092 //Acceleration/Deceleration time: 500ms

Network 001

LD M0

DRVI D0 D2 Y1 Y6 // DRVI starts to work when M0 is set

Ladder Diagram：

Instruction List：

Network 000

LD M8151

MOVD K10000 D0 // Number of output pulse

MOV K1000 D2 //Frequency of output pulse

MOV K500 D8092 //Acceleration/Deceleration time: 500ms

Network 001

LD M0

DDRVI D0 D2 Y0 Y6 // DDRVI starts to work when M0 is set


High-speed Counting Instruction

Content：

HCNT


High-speed Counting HCNT

Corresponding Instruction | Annotation/Introduction | Operand（Register）
HCNT | High-speed counting of pulse input | CV，K/H/D

Instruction:

 | Address Serial No. of High-speed Counting | Input port wiring of high-speed counter
 |  | X000 | X001 | X002 | X003 | X004 | X005 | X006 | X007
Single-phrase counter without Enable / Reset | C235 | U/D |  |  |  |  |  |  |
 | C236 |  | U/D |  |  |  |  |  |
Single-phrase counter with specific Enable / Reset | C241 | U/D | R |  |  |  |  |  |
 | C244 | U/D | R |  |  |  |  | S |
Single-phrase double counter | C246 | U | D |  |  |  |  |  |
 | C247 | U | D | R |  |  |  |  |
 | C249 | U | D | R |  |  |  | S |
A/B phrase counter | C251 | A | B |  |  |  |  |  |
 | C252 | A | B | R |  |  |  |  |
 | C254 | A | B | R |  |  |  | S |

As shown in the above table, where U means counting up, D counting down, R resetting counter (the counter will be cleared if the corresponding X pin of R reaches the rising edge), S enabling counter (it will enable the specific counter when the corresponding X pin of S reaches the rising edge), AB means AB phase.

When a certain input port (e.g. X000) is occupied by a high-speed counter (e.g. C235), other counters (e.g. C241, C244, C246, etc.) cannot use this input port in the ladder diagram, otherwise the counter will not work properly.

C235 ~ C245 count direction control bits, respectively, corresponding to M8035 ~ M8045. For example, when M8035 is 0, C235 is counting up; when M8035 is 1, C235 counts down.

Counting range: -2,147,483,648 ~ +2,147,483,647; when the count value beyond this range, will have overflow or underflow phenomenon.

Direction control bit of C235~C245 respectively corresponds toM8035~M8045; e.g. when M8035 is 0, C235 counts up while it counts down when M8035 is 1.

Counting rang: -2,147,483,648 ~ +2,147,483,647；it arise a problem of overflow or underflow when the counting value is out of range.

Note：

1. During the operation of high-speed counting input or interrupt input, it is recommended to apply twisted shielded pair as the cable of corresponding input port and to connect the shield to ground (terminal or signal earth) so as to improve the anti-interference performance;

2. Terminals used by this kind of counter cannot work for other input counters, nor other common inputs;

3. The OFF time of transistor has the characteristic that it will be extended in case of light loads. So please set to increase the load current and resistance in response to the lighter load.

Instance：

Single-phrase counter without Enable / Reset

Instruction List：

Network 000

LD M8035

OUT Y000

Network 001

LD M0

HCNT CV235 K1000 //When M0 is‘1’ and M8035 is‘0’,pulse input of CV235 to X000 counts up; it will set C235 if the counting reaches 1000.

Network 002

LD C235

OUT Y001

Network 003

LDP M1

RST C235 K1 //Clear C235 and CV235 when it arrives the rising edge of M1.

Ladder Diagram：

Single-phrase counter with specific Enable / Reset

Instruction List：

Network 000

LD M0

HCNT CV244 K1000 //When M0 is‘1’ and it arrives the rising edge of X006, execute CV244; afterwards, it counts up the pulse input of CV244 to X000（M8044 is 0）; it will set C244 when the counting reaches 1000.

//If M0 turns ‘0’ and then turns again into ‘1’, it needs the rising edge X006 to start again the counter.

Network 001

LD C244

OUT Y001

Network 002

LDP M1

RST C244 K1 // Clear C244 and CV244 when it arrives the rising edge of M1 or when a rising edge is given to X001.

Ladder Diagram：

Single-phrase double counter

Instruction List：

Network 000

LD M0

HCNT CV249 K1000 // When M0 is‘1’ and it arrives the rising edge of X006, execute CV249; afterwards, it counts up the pulse input of CV249 to X000 and counts down the pulse input to X001; it will set C249 when the counting reaches 1000.

// If M0 turns ‘0’ and then turns again into ‘1’, it needs the rising edge X006 to start again the counter.

Network 001

LD C249

OUT Y001

Network 002

LDP M1

RST C249 K1 // Clear C249 and CV249 when it arrives the rising edge of M1 or when a rising edge is given to X002.

Ladder Diagram：

A/B phrase counter

A/B phrase counter has two modes of counting; it controls A/B phrase counter C251~C254相计via M8051~M8054; when the corresponding M is ‘0’, it is in the mode of double frequency while in the mode of quadruplicated frequency when it’s ‘1’, as shown below：

Double Frequency Mode：

Quadruplicated Frequency Mode：

Instruction List：

Network 000

LD M0

HCNT CV254 K1000 // When M0 is‘1’ and it arrives the rising edge of X006, execute CV254; afterwards, it counts the AB-phrase pulse of CV254 to X000 and X001; it will set C254 when the counting reaches 1000.

// If M0 turns ‘0’ and then turns again into ‘1’, it needs the rising edge X006 to start again the counter.

Network 001

LD C254

OUT Y001

Network 002

LDP M1

RST C254 K1 // Clear C254 and CV254 when it arrives the rising edge of M1 or when a rising edge is given to X002.

Ladder Diagram：


Miscellaneous Function Instruction

Contents：

LOG

POW

FACT

CMP

CMPD

CMPF

ZCP

ZCPD

ZCPF

NEG

NEGD

XCH

XCHD

XCHF

CML

CMLD

SMOV

FMOV

FMOVD


Base-10 Logarithm operation (LOG)

Corresponding Instruction | Annotation/Introduction | Operand（Register）
LOG | Base-10 Logarithm operation | IN：D/K, OUT：D

Instruction:

Execute a base-10 logarithm operation of the floating-point number in the register （IN）and send the result to the register（OUT）.

Instance：

Instruction List：

LD M1

LOG K1000 D4 //Result of execution D4（D5） = 3.0

Ladder Diagram：


X to the power of Y （POW）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
POW | Calculate X to the power of Y | B（底数）：D/K, E（指数）：D/K, P（幂）：D

Instruction：

Base the floating-point number in the register（B）, take that in register （E） as the exponent and execute power operation; then send the result to the register（P）.

Instance：

Instruction List：

LD M3

POW K10 K3 D0 // Result of execution D0(D1) = 1000.0

Ladder Diagram：


Calculates the factorial of N （FACT）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
FACT | Calculates the factorial of N | D/H/K/TV/CV/AO/AI/V/Z, D(32位)

Instruction:

Calculates the factorial of N in register（IN）; the max value of N is 12; send then the result to the register（OUT）.

Instance：

Instruction List：

LD M3

FACT K4 D0 //Result of execution D0（D1） = 24

Ladder Diagram：


Word Comparison （CMP）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CMP | Word Comparison | D/H/K/CV/TV/AI/AO/V/Z, D/H/K/CV/TV/AI/AO/V/Z, Y/M/S(occupy continuous 3 bits)

Instruction：

Compare words of IN1 and IN2 and send the result to register OUT：

When OUT is Y000

If IN1 > IN2: Y000=‘1’

If IN1 == IN2: Y001=‘1’

If IN1 < IN2: Y002=‘1’

Instance：

Instruction List：

LD M0

CMP D0 D1 M100 // Compare D0 and D1

LD M100

OUT M1000 // If D0 > D1, M100= ON

LD M101

OUT M1001 // If D0 == D1, M101= ON

LD M102

OUT M1002 // If D0 < D1, M102= ON

Ladder Diagram：


Double Word Comparison (CMPD)

对应命令 | 注释/说明 | 操作数（寄存器）
CMPD | Compare double words | D/H/K, D/H/K, Y/M/S(occupy continuous 3 bits)

Instruction：

Compare double words of IN1 and IN2 and send the result to register OUT：

When OUT is Y000

If IN1 > IN2: Y000=‘1’

If IN1 == IN2: Y001=‘1’

If IN1 < IN2: Y002=‘1’

Instance：

Instruction List：

LD M0

CMPD D0 D2 M100 // Compare D0（D1） and D2（D3）

LD M100

OUT M1000 // If D0（D1）> D2（D3）, M100= ON

LD M101

OUT M1001 // If D0（D1）== D2（D3）, M101= ON

LD M102

OUT M1002 // If D0（D1）< D2（D3）, M102= ON

Ladder Diagram：


Word Interval Comparison （ZCP）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ZCP | Compare Word Interval | IN1：D/H/K/TV/CV/AI/AO/V/Z, IN2：D/H/K/TV/CV/AI/AO/V/Z, IN：D/H/K/TV/CV/AI/AO/V/Z, OUT：Y/M/S(occupy continuous 3 bits)

Instruction：

Compare the value of IN with the lower limit IN1 and upper limit IN2; send then the comparison result to OUT.

The lower limit cannot be greater than the upper limit IN2.

Number comparison is executed via algebra and all data are in signed binary numbers.

Instance：

Instruction List：

LD M0

ZCP K100 K200 D0 Y000 //When D0 < K100, Y000 = ON;

// When K100 <= D0 <= K200, Y001 = ON;

// When D0 > K200, Y002 = ON;

Ladder Diagram：


Floating Number Comparison （CMPF）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CMPF | Compare Floating numbers | D /K, D /K, Y/M/S(occupy continuous 3 bits)

Instruction：

Compare floating numbers of IN1 and IN2 and send the result to register OUT：

When OUT is Y000

If IN1 > IN2: Y000=‘1’

If IN1 == IN2: Y001=‘1’

If IN1 < IN2: Y002=‘1’

Instance：

Instruction List：

LD M0

CMPF D0 D2 M100 // Compare D0（D1） and D2（D3）

LD M100

OUT M1000 // If D0（D1）> D2（D3）, M100= ON

LD M101

OUT M1001 // If D0（D1）== D2（D3）, M101= ON

LD M102

OUT M1002 // If D0（D1）< D2（D3）, M102= ON

Ladder Diagram：


Double Word Interval Comparison （ZCPD）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ZCPD | Compare double word intervals | IN1：D/H/K, IN2：D/H/K, IN：D/H/K, OUT：Y/M/S(occupy continuous 3 bits)

Instruction：

Compare the value of IN with the lower limit IN1 and upper limit IN2; send then the comparison result to OUT.

The lower limit cannot be greater than the upper limit IN2.

Number comparison is executed via algebra and all data are in signed binary numbers.

Instance：

Instruction List：

LD M0

ZCPD K100 K200 D0 Y000 //When D0（D1） < K100, Y000 = ON;

// When K100 <= D0（D1）<= K200, Y001 = ON;

// When D0（D1） > K200, Y002 = ON;

Ladder Diagram：


Floating Number Interval Comparison （ZCPF）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
ZCPF | Compare floating number intervals | IN1：D /K, IN2：D /K, IN：D//K, OUT：Y/M/S(occupy continuous 3 bits)

Instruction：

Compare the value of IN with the lower limit IN1 and upper limit IN2; send then the comparison result to OUT.

The lower limit cannot be greater than the upper limit IN2.

Number comparison is executed via algebra and all data are in signed binary numbers.

Instance：

Instruction List：

LD M0

ZCPF K100 K200 D0 Y000 // When D0（D1） < K100.0, Y000 = ON;

// When K100.0 <= D0（D1）<= K200.0, Y001 = ON;

// When D0（D1） > K200.0, Y002 = ON;

Ladder Diagram：


Complementation Operation of Word （NEG）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
NEG | Complementation Operation of Word | IN：D/K/H/AI/AO/CV/TV/V/Z, OUT：D/CV/TV/AO/V/Z

Instruction：

Execute the complementation operation to the value in the register（IN） and then send the result to register（OUT）.

Instance：

Instruction List：

LD M0

NEG H00AA D0 // //Result of execution D0 = 0x7F56 = 32598;

Ladder Diagram：


Complementation Operation of Double Word （NEGD）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
NEGD | Complementation Operation of Double Word | IN：D/K/H, OUT：D

Instruction：

Execute the complementation operation to the value in the register（IN） and then send the result to register（OUT）.

Instance：

Instruction List：

LD M0

NEGD K1000 D0 // Result of execution D0（D1） = 0x7FFFFC18 = 2147482648;

Ladder Diagram：


Word Exchange（XCH）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
XCH | Exchange and transmission of Word | OUT1：D/AO/CV/TV/V/Z, OUT2：D/AO/CV/TV/V/Z

Instruction：

Exchange the values of registers（OUT1）and （OUT2）

Instance：

Instruction List：

LDP M7

XCH D5 D6 // Before the execution of this instruction, if D5 = 100， D6 = 50, then D5 = 50, D6 = 100 afterwards.

Ladder Diagram：


Double Word Exchange （XCHD）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
XCHD | Exchange and transmission of Double Word | OUT1：D OUT2：D

Instruction：

Exchange the values of registers（OUT1）and （OUT2）

Instance：

Instruction List：

LDP M8

XCHD D0 D2 // Before the execution of this instruction, if D0（D1） = 100， D2(D3) = 50, then D0（D1） = 50， D2(D3) = 100 after the arrival of rising edge of M8.

Ladder Diagram：


Floating Number Exchange （XCHF）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
XCHF | Exchange and transmission of Floating Number | OUT1：D OUT2：D

Instruction：

Exchange the values of registers（OUT1）and （OUT2）

Instance：

Instruction List：

LDP M8

XCHF D0 D2 // Before the execution of this instruction, if D0（D1） = 123.456， D2(D3) = 789.123, then D0（D1） = 789.123， D2(D3) = 123.456 after the arrival of rising edge of M8.

Ladder Diagram：


Negation and Transmission of Word （CML）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CML | Negation and Transmission of Word | D/H/K/AO/AI/CV/TV/V/Z, D/AO/CV/TV/V/Z

Instruction：

Negate the source operand（IN）bit by bit and then transmit the result to the register OUT.

Instance：

Instruction List：

LD M5

CML HFF55 D0 // Result of execution D0 = 0x00AA = 170

Ladder Diagram：


Negation and Transmission of Double Word（CMLD）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
CMLD | Negation and Transmission of Double Word | D/H/K，D

Instruction：

Negate the source operand（IN）bit by bit and then transmit the result to the register OUT.

Instance：

Instruction List：

LD M6

CMLD HFF55FF55 D0 // Result of execution D0(D1) = 0x00AA00AA = 11141290

Ladder Diagram：


Shift and Transmission SMOV

Corresponding Instruction | Annotation/Introduction | Operand（Register）
SMOV | Shift and Transmission | D/AI/AO/TV/CV/V/Z, H/K, H/K, D/AO/TV/CV/V/Z, H/K

Instruction：

This instruction converts first the binary source data（D1）to that in BCD and then SMOV it to realize the distribution and combination of data. Shift the first two bits right from the forth bit of the BCD code of source data to the third and second bits of target D2 while the fourth and the first bit of D2 remain unchanged. Afterwards, BCD code of D2 is converted automatically o a binary number, that is, the contents of D2. Error occurs if the value of BCD code exceeds 9999.

Instance：

Instruction List：

LDP M1

MOV K4321 D1

MOV K8888 D2

LD M1

SMOV D1 K4 K2 D2 K3 // When W1=1, execute D2 = 8438

Ladder Diagram：


Word Multicast （FMOV）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
FMOV | Word Multicast | SRC：D/H/K/AI/AO/TV/CV/V/Z, DST ：D/AO/CV/TV/V/Z, N ：D/K/H

Instruction：

Transmit the source data（SRC）to specific N elements starting from the target (DST); data in these N elements are all same.

Instance：

Instruction List：

LD M1

FMOV K100 D5 K5 //Execute D5—D9=100

Ladder Diagram：


Double Word Multicast （FMOVD）

Corresponding Instruction | Annotation/Introduction | Operand（Register）
FMOVD | Double Word Multicast | SRC : D/H/K, DST : D, N : D/K/H

Instruction：

Transmit the source data（SRC）to specific N elements starting from the target (DST); data in these N elements are all same.

Instance：

Instruction List：

LD M4

FMOVD K100 D0 K4 // Result of the execution D0（D1），D2（D3），D4（D5），D6（D7）=100

Ladder Diagram：


PID Instruction

GC controller can operate PID control, including fuzzy PID and manual PID, together with PID self-tuning. It supports up to 10 loops of PID control (including 8 of temperature control).

PID is a proportional - integral - differential control algorithm for closed - loop control systems.

According to the PID algorithm, PID controller calculates the output of the controller on the basis of the difference value between the set value (given) and the actual value (feedback) of the controlled object, and then controls the actuator to influence the controlled object.

As a closed-loop control with negative feedback, PID control can restrain disturbance in closed-loop system caused by various factors, so that the feedback experiences a given change.

Depending on the control requirements of the specific project, it is possible to employ a part of its function in practical applications, such as PI (proportional-integral) control, where there is no differential control.

Before applying this instruction, please ensure a certain basis for PID control.

Instruction：

PID in GC controller functions via the PID Instruction Function. Execute the PID function block by the timing (according to the sampling time), and provided by PID operational rule, calculate the controlled quantity according to the given preset, feedback, proportional-integral-derivative data.

PID function block exchanges data through a PID loop table with the length of 17 bytes in the D data storage area in the development. Therefore, each PID function block needs to specify 5 items when is called: the number of PID control loop, start address of control loop table (in D), set value of PID, PID output (this address is related to the output form of loop table; 0 means to output as bit, 1 means as word), and sampling number setting of PID self-tuning.

Parameters interpretation of PID：

Loop: PID function block supports up to 10 PID loops (including 8 of temperature control).

Process Variable：

KP: Proportional Element; once a system error occurs, the controller immediately functions to control, so as to enable the object controlled by PID run towards the direction of reducing error; the control effect depends on the proportionality coefficient Kp, a 32-bit floating point number.

TI: Integration time (ms); TI determines the variation rate of controller’s output when the deviation value is constant; the shorter the TI, the faster the deviation gets corrected. A too short integral time may cause instability.

The length of TI is equivalent to the time required for the output variation to be equal to the deviation value, that is, the time required for the output to turn twice of the initial step deviation, under a given step reference and the gain of "1".

If the integration time is set to the maximum value, it is equivalent to be without integral effect. If it is set to 0, KI is 0, and the data type is 32-bit floating point

TD: differential time (ms); when the deviation value changes, the differential effect adds a peak falling by time to the output. The longer the TD, the greater the change in output. The differential enforces the sensitivity of the control to the disturbance, which means the greater the rate of change of the deviation, the stronger the differential control effect. The differential is equivalent to the predictive adjustment of the feedback trend. If it is set to 0, KD is 0 then; the data type is 32-bit floating point.

PID control dead zone: Under the effect of PID, when the deviation is smaller than the dead zone value, PID stops the calculation and to maintain the output of previous state; the data type is 32-bit floating point.

Sampling time (ms): This is refresh time during the data input and PID output, which needs to be set to different values according to the system, but it shouldn’t be less than the scanning cycle; the data type is 32-bit floating point.

Setpoint floor / setpoint high limit: the output of PID is limited to this interval

Direction: 1 indicates positive direction of PID output (heating), 0 means reverse output

Auto tuning state: 0 means the tuning is complete; 1 means being applied; 2 means the tuning fails.

Sampling number of tuning: When PID self-tuning is applied (i.e., state of self-tuning is 1), this value represents PID needs to complete tuning within the set point, otherwise, it judges a failure (when it is set to K30, it means that PID auto-tuning fails if it hasn’t completed the tuning till the end of the 30 sampling periods, where the status of auto-tuning is 2).

Output: When the output type is 0, this value represents the opening time of bit unit while it is invalid if the output type is 1.

PID input: Storage address of sampling value

PID output: When this address is a bit unit (ensure the output type of 0), the PID control is the positive pulse width of this element; when this address is a word unit, PID outputs the calculation result here.

PID setpoint: Set the PID final target value

PID mode:

PID of GC controller is divided into manual mode and fuzzy PID for user’s choice according to different systems.

Manual PID

Execute PID operation according to the parameters input by user, or complete the [arameter settings through PID auto-tuning.

PID Self-Tuning:

Prerequisites

(1) The self-tuning loop must be in automatic mode (the state of auto-tuning is 1);

(2) The output of PID can cause the system to oscillate near the set point;

(3) Before self-tuning, the system needs to check the following parameters (sampling time, limits of setpoint, PID direction, state 1 of tuning, output type, setpoint);

(4) During the self-tuning process (in state 1), if the system fails to generate oscillation near the set point during the sampling period of N (N = self-tuning sampling points), the state will be set to 2, indicating that the tuning fails.

Process of Self-tuning

Execute it when the auto-tuning status is 1 and the PID instruction is enabled. The system will first compare the set point with the measured value; when the latter is greater than the former, the PID will output negatively, resulting to the first zero intersection event; when the latter is less than the former, PID outputs positively, resulting again to a zero-crossing event; after the 10th zero-crossing event, it completes the entire sequence sampling of PID tuning and then the system will automatically update the PID parameters, thus, the system starts PID control, with the state of PID tuning cleared to 0, which means the completion of tuning.

The peak-to-peak variables during the self-tuning process and the generation velocity of zero-crossing events are directly related to the dynamic characteristics of the control process.

The following figure shows the PID self-tuning process, where the system captures first 10 zero-crossing events, and then outputs PID parameters and turns to PID control if the ten events meet the sequence of PID tuning.

The following figure shows the process of PID control; it adds anti-integral saturation to the PID instruction of GC controller added, speeding up the system reaction.

Reasons for failure of PID self-tuning

(1) The system cannot generate 10 zero-crossing events, such as heater power in heating system too low to heat up or system failure of cooling, etc.

(2) The system fails to get the tuning sequence due to disorder of input signal, that is sampling measured values.

(3) Parameter settings, such as too long or too short sampling time, unreasonable thresholds, direction error, error of self-tuning state settings and too small sampling number.


Register Introduction of Samkoon GC Controller

LB, LW and RWI are available registers of HMI while SAMSOAR is for internal controller (PLC).

SamDraw reserves some registers for special applications and users must refer to the related instructions when using these registers, including LB (Local Memory Bit); LW (Local Memory Register) and RWI (Formula Index).

LB: LB0-LB4095 and LB3000-LB3999 belong to the area of power failure protection;

LW: LW0-LW4095 and LW3000-LW3999 belong to the area of power failure protection.

RWI: RWI0~RWI4095.

View application rules of SAMSOAR


LB

System Reserved Register -LB

Address | Meaning | Note
1000~1009 | Initialization Settings ON | Enable the initialization ON when system starts
4010 | Download Recipe | Write the data of this RWI to device if it is triggered; reset after execution
4011 | Upload Recipe | Read the formula data of device to RWI register if it is triggered; reset after execution
4012 | Save Recipe | Preserve the recipe data from recipe index register to specific register assigned by RWI50
4013 | Recipe Downloading Indication | ON if formula is being written to device; OFF after the end of downloading (Read)
4014 | Recipe Uploading Indication | ON if formula is being read to device; OFF after the end of uploading (Read)
4015 | Restart HMI | Restart system if it is triggered ON
4016 | Backlight Control | Close Backlight when it is ON; Open Backlight when it is OFF
4017 | Status indication of COM1 | Show the current status of communication between HMI and PLC (read) 1：Communication failure 0： Successful communication
4018 | Status indication of COM2 | Show the current status of communication between HMI and PLC (read) 1：Communication failure 0： Successful communication
4019 | Whether to allow modifying COM1 parameters | Value of 1 means modification of COM1 parameters is available; otherwise not
4020 | Whether to allow modifying COM2 parameters | Value of 1 means modification of COM2 parameters is available; otherwise not
4021 | Whether to upgrade password | 1: Save password into Flash 0: Do not save
4022 | Whether to upgrade screensaver | 1: Save the screensaver into Flash 0: Do not save
4023 | Whether to indicate communication failure | 0: PLC NO RESPONE in case of communication failure 1：No indication


LW

Address | Meaning | Note
4000 | Local time: second | Bcd code; effective value range: 0-59
4001 | Local time: minute | Bcd code; effective value range: 0-59
4002 | Local time: hour | Bcd code; effective value range: 0-23
4003 | Local time: day | Bcd code; effective value range: 1-31
4004 | Local time: month | Bcd code; effective value range: 1-12
4005 | Local time: year | Bcd code; effective value range: 0-9999
4006 | Local time: week | Bcd code; effective value range: 1-7
4007 | Current system level | Display the safety level of current basic windows: 1~8
4008 | Password of current system level | Display the current permission password; effective value: password of Level 1, 2 or others
4009
4010 | Password of Level 1 | Display level 1 password set during the configuration
4011
4012 | Password of Level 2 | Display level 2 password set during the configuration
4013
4014 | Password of Level 3 | Display level 3 password set during the configuration
4015
4016 | Password of Level 4 | Display level 4 password set during the configuration
4017
4018 | Password of Level 5 | Display level 5 password set during the configuration
4019
4020 | Password of Level 6 | Display level 6 password set during the configuration
4021
4022 | Password of Level 7 | Display level 7 password set during the configuration
4023
4024 | Password of Level 8 | Display level 8 password set during the configuration
4025
4026 | Screen saver time | Display specific screen saver time
4027 | Flicker circle of Indicator light | Flicker circle of Indicator light; the minimum value is 0.2s
4028 | X coordinate in case of touch | Value of X coordinate in case of touch
4029 | Y coordinate in case of touch | Value of Y coordinate in case of touch
4030 | Touch state | 1-Touch; 0-Release
4031 | Checking of COM1 | Communication parameter; checking
4032 | Baud rate of COM1 | Communication parameter; baud rate
4033 | Stop Bit of COM1 | Communication parameter; stop bit
4034 | Data Length of COM1 | Communication parameter; data length
4035 | HMI Address of COM1 | Communication parameter; HMI address
4036 | PLC Address of COM1 | Communication parameter; PLC address
4037 | PLC brand of COM1 | Communication parameter; manufacturer, i.e. PLC brand
4038 | PLC model of COM1 | Communication parameter; model, i.e. CPU model
4039 | Checking of COM2 | Communication parameter; checking
4040 | Baud rate of COM2 | Communication parameter; baud rate
4041 | Stop Bit of COM2 | Communication parameter; stop bit
4042 | Data Length of COM2 | Communication parameter; data length
4043 | HMI Address of COM2 | Communication parameter; HMI address
4044 | PLC Address of COM2 | Communication parameter; PLC address
4045 | PLC brand of COM 2 | Communication parameter; manufacturer, i.e. PLC brand
4046 | PLC model of COM 2 | Communication parameter; model, i.e. CPU model
4047 | Current number of historical alarms | For Alarm control
4048 | Current number of historical records | For Alarm control
4049 | Software version number | 1====3.1 2====3.2 3====3.3
4050 | Touch sound | 0：Touch sound; 1：without touch sound
4051 | Chinese/English keyboard | 1：Chinese keyboard; 2：English keyboard
4052 | Alarm sound | 0：Alarm sound; 1：without alarm sound
4053~4054 | Upper limit value of control input | Upper limit value of control input（32 bit）
4055~4056 | Lower limit value of control input | Lower limit value of control input（32 bit）
4057~4067 | Input data of Keyboard | Display data that can be input by the current keyboard （ASCII）
4073 | Times of clocking timeout | Times of clocking timeout in certain models
4074 | Command frames of COM 1 | Command frames of COM 1 in one second
4075 | Command frames of COM 2 | Command frames of COM 2 in one second
4076 | Times of COM 1 receiving error frames | Times of COM 1 receiving error frames in one second
4077 | Times of COM 2 receiving error frames | Times of COM 2 receiving error frames in one second

Note: LW [4073] is applied to count times of communication timeout in EA special model.


RWI

Address | Meaning | Note
RWI0 | Recipe number register | Display the recipe specified by the recipe number.
RWI1 | Recipe memory address | Specify a recipe number to display corresponding recipe data in RWI


SamkoonSoar System Registers

System Registers
Register | Range | Storage Unit | Power-off Protection Range
Input Contact X | [0,128) | BOOL | N/A
Output Coil Y | [0,128) | BOOL | N/A
Analog Input Register AI | [0,32) | WORD | N/A
Analog Output Register AO | [0,32) | WORD | N/A
Bit Register M | [0,8192) | BOOL | [7488, 7504), [7504, 8000)
Data Register D | [0,8192) | WORD | [5952, 5968), [5968, 8000)
Index Register V | [0,8) | WORD | N/A
Index Register Z | [0,8) | WORD | N/A
System State Register S | [0,1000) | BOOL | [600, 1000)
Counter CV | [0, 235)Low-speed，[235, 256)High-speed | [0, 200)WORD, [200, 256)DWORD | [100, 200) , [220,235)
Timer TV | [0,256) | WORD | N/A
Counter Switch C | [0,256) | BOOL | N/A
Timer Switch T | [0,256) | BOOL | N/A

System Special Function Registers
Register | Function | Read &Write
Analog Register AI & AO
AI_0 | Integer from of the first channel for voltage/current/temperature AI（Display range：0~65535/set in S/W） | Read
AI_1 | Integer from of the second channel for voltage/current/temperature AI（Display range：0~65535/set in S/W） | Read
AI_2 | Reserved | Read
AI_3 | Reserved | Read
AI_4 | Reserved | Read
AI_5 | Reserved | Read
AI_6 | Reserved | Read
AI_7 | Reserved | Read
AI_26 | Reserved | Read
AI_27 | Reserved | Read
AI_28(AI_29) | Reserved | Read
AI_30(AI_31) | Reserved | Read
AO_30 | Reserved | Read & Write
AO_31 | Reserved | Read & Write
Data Register D
D_5952~D_5967 | For PLC System | Read
D_8060 | X000 Filter time (0~32767ms) | Read & Write
D_8061 | X001 Filter time (0~32767ms ) | Read & Write
D_8062 | X002 Filter time (0~32767ms ) | Read & Write
D_8063 | X003 Filter time (0~32767ms ) | Read & Write
D_8064 | X004 Filter time (0~32767ms ) | Read & Write
D_8065 | X005 Filter time (0~32767ms ) | Read & Write
D_8066 | X006 Filter time Filter time (0~32767ms ) | Read & Write
D_8067 | X007 Filter time (0~32767ms ) | Read & Write
D_8068 | X010 Filter time (0~32767ms ) | Read & Write
D_8069 | X011 Filter time (0~32767ms ) | Read & Write
D_8070 | X012 Filter time (0~32767ms ) | Read & Write
D_8071 | X013 Filter time (0~32767ms ) | Read & Write
D_8072 | X014 Filter time (0~32767ms ) | Read & Write
D_8073 | X015 Filter time (0~32767ms ) | Read & Write
D_8074 | X016 Filter time (0~32767ms ) | Read & Write
D_8075 | X017 Filter time (0~32767ms ) | Read & Write
D_8076 | Y000 Acceleration/Deceleration time of Return to Origin | Read & Write
D _8077 | Y001 Acceleration/Deceleration time of Return to Origin | Read & Write
D_8078 | Y002 Acceleration/Deceleration time of Return to Origin | Read & Write
D_8079 | Y003 Acceleration/Deceleration time of Return to Origin | Read & Write
D_8092 | Y000 Acceleration/Deceleration time of Absolute, Relative Position Instruction | Read & Write
D_8093 | Y001 Acceleration/Deceleration time of Absolute, Relative Position Instruction | Read & Write
D_8094 | Y002 Acceleration/Deceleration time of Absolute, Relative Position Instruction | Read & Write
D_8095 | Y003 Acceleration/Deceleration time of Absolute, Relative Position Instruction | Read & Write
D_8108 | Y000 Serial number of error pulse segment（For multi-segment pulses） | Read
D_8109 | Y001 Serial number of error pulse segment（For multi-segment pulses） | Read
D_8110 | Y002 Serial number of error pulse segment（For multi-segment pulses） | Read
D_8111 | Y003 Serial number of error pulse segment（For multi-segment pulses） | Read
D_8124 | Y000 Current pulse segment（For multi-segment pulses） | Read
D_8125 | Y001 Current pulse segment（For multi-segment pulses） | Read
D_8126 | Y002 Current pulse segment（For multi-segment pulses） | Read
D_8127 | Y003 Current pulse segment（For multi-segment pulses） | Read
D_8140(D_8141) | 32-bit Cumulative Pulse counting of Y000 | Read & Write
D_8142(D_8143) | 32-bit Cumulative Pulse counting of Y001 | Read & Write
D_8144(D_8145) | 32-bit Cumulative Pulse counting of Y002 | Read & Write
D_8146(D_8147) | 32-bit Cumulative Pulse counting of Y003 | Read & Write
D_8173 | Set value of 0 if Interrupt Timer; range of set values: 1~32767ms | Read & Write
D_8174 | Set value of 1 if Interrupt Timer; range of set values: 1~32767ms | Read & Write
D_8175 | Scanning cycle（ms） | Read
D_8176 | Serial number of ERROR state | Read
D_8177 | Serial number of overflow code | Read
Coil Register M
M_7488~M_7503 | For PLC System | Read
M_8035~M_8045 | Reserved | Read & Write
M_8051 | Frequency Multiplication Setting of High-speed Counter C251（Double—Quadruple frequency, 0-double frequency） | Read & Write
M_8052 | Frequency Multiplication Setting of High-speed Counter C252（Double—Quadruple frequency, 0-double frequency） | Read & Write
M_8053 | Reserved | Read & Write
M_8054 | Frequency Multiplication Setting of High-speed Counter C254（Double—Quadruple frequency, 0-double frequency） | Read & Write
M_8055 | Reserved | Read & Write
M_8070 | Whether to ignore error in Y000 and continue to send pulse; 0 means Ignore by default while 1 means stopping pulse output. | Read & Write
M_8071 | Whether to ignore error in Y001 and continue to send pulse; 0 means Ignore by default while 1 means stopping pulse output. | Read & Write
M_8072 | Whether to ignore error in Y002 and continue to send pulse; 0 means Ignore by default while 1 means stopping pulse output. | Read & Write
M_8073 | Whether to ignore error in Y003 and continue to send pulse; 0 means Ignore by default while 1 means stopping pulse output. | Read & Write
M_8086 | Check the validity of pulse numbers and frequencies set by users of each segment in Y000（For multi-segment pulses） | Read
M_8087 | Check the validity of pulse numbers and frequencies set by users of each segment in Y001（For multi-segment pulses） | Read
M_8088 | Check the validity of pulse numbers and frequencies set by users of each segment in Y002（For multi-segment pulses） | Read
M_8089 | Check the validity of pulse numbers and frequencies set by users of each segment in Y003（For multi-segment pulses） | Read
M_8102 | Pulse direction of Y000; 1 means positive direction. | Read
M_8103 | Pulse direction of Y001; 1 means positive direction. | Read
M_8104 | Pulse direction of Y002; 1 means positive direction. | Read
M_8105 | Pulse direction of Y003; 1 means positive direction. | Read
M_8118 | Overflow flag of Cumulative Pulse counting of Y000; 1 means overflow. | Read
M_8119 | Overflow flag of Cumulative Pulse counting of Y001; 1 means overflow. | Read
M_8120 | Overflow flag of Cumulative Pulse counting of Y002; 1 means overflow. | Read
M_8121 | Overflow flag of Cumulative Pulse counting of Y003; 1 means overflow. | Read
M_8134 | Pulse of Y000 being output | Read
M_8135 | Pulse of Y001 being output | Read
M_8136 | Pulse of Y002 being output | Read
M_8137 | Pulse of Y003 being output | Read
M_8150 | Connect the first scanning cycle; connect a scanning cycle | Read
M_8151 | Close during program running | Read
M_8152 | Break during program running | Read
M_8153 | RTC Low battery voltage（ 1-ERROR 0-OK ） | Read
M_8154 | DC24V Error（ 1-ERROR 0-OK ） | Read
M_8155 | IO Configuration error（ 1-ERROR 0-OK ） | Read
M_8156 | PLC Hardware error（ 1-ERROR 0-OK ） | Read
M_8157 | Refresh Output Error（ 1-ERROR 0-OK ） | Read
M_8158 | 10ms Clock Pulse Output（ 1-HIGH 0-LOW ） | Read
M_8159 | 100ms Clock Pulse Output（ 1-HIGH 0-LOW ） | Read
M_8160 | 1sec Clock Pulse Output（ 1-HIGH 0-LOW ） | Read
M_8161 | 1min Clock Pulse Output（ 1-HIGH 0-LOW ） | Read
M_8162 | Clear all memory in Non-Lock area（ 1-CLEAR 0-NONE ） | Read & Write
M_8163 | Clear all memory in Lock area（ 1-CLEAR 0-NONE ） | Read & Write
M_8164 | Forbid all output（ 1-DISABLE 0-ENABLE ） | Read & Write
M_8165 | Direction of Shift Bit Instruction（ 1-LEFT 0-RIGHT ） | Read
M_8166 | Overflow bit of Shift instruction（1-ERROR 0-OK ） | Read
M_8167 | Zero flag of Shift instruction（ 1-ERROR 0-OK ） | Read
M_8168 | Error flag of BCD conversion（ 1-ERROR 0-OK ） | Read
M_8169 | Overflow of operation result（ 1-ERROR 0-OK ） | Read
M_8170 | Negative operation result（1-ERROR 0-OK ） | Read
M_8171 | Zero for Operation result（ 1-ERROR 0-OK ） | Read
M_8172 | Zero for divisor（ 1-ERROR 0-OK ） | Read
M_8173 | Offset address overflow（ 1-ERROR 0-OK ） | Read
M_8174 | Error status（ 1-ERROR 0-OK ） | Read
M_8175 | Sunning status（ 1-RUN 0-STOP ） | Read


创新 专业 引领 共赢

深圳市显控科技股份有限公司

Shenzhen Samkoon Technology Corporation Ltd

地址：深圳市南山区高新中区深圳软件园一期1栋3楼

Address：ShenZhen Software Park 1st Building 3rd floor,the middle road of

High-tech zone，NanShan district,ShenZhen,China

电话(TEL)：0755—29419028 0755—29419038

0755—29419068 0755—29419098

传真（FAX）：0755-29455559

E-Mail：samkoon@samkoon.com.cn

Website：Http://www.samkoon.com.cn


库函数附录

函数名称 | 函数功能
void CACI( WORD W , BIT B ) | 圆面积的计算【半径为整数】
void RPCI ( WORD W , BIT B ) | 圆周长的计算【半径为整数】
void CRCC( WORD W , BIT B ) | CRC校验生成
void DDO( WORD W , BIT B ) | 输入数据【整数】从大到小排序
void DSL( WORD W , BIT B ) | 输入数据【整数】从小到大排序
void CACF( WORD W , BIT B ) | 圆面积的计算【半径为浮点数】
void RPCF( WORD W , BIT B ) | 圆周长的计算【半径为浮点数】
void PCF( WORD W , BIT B ) | 求幂运算【底数为浮点数】
void NL10( WORD W , BIT B ) | 自然对数【以10为底数】
void NLO( WORD W , BIT B ) | 自然对数【以e为底数】
void ASSH ( WORD W , BIT B ) | 已知三角形的两直角边求斜边
void FAAS( WORD W , BIT B ) | 已知三角形一直角边和斜边求另一直角边
void QEF( WORD W , BIT B ) | 一元二次方程【浮点数】
void DSF32( WORD W , BIT B ) | 多个32位【浮点数】数据求和
void MDPF( WORD W , BIT B ) | 多个数据【浮点数】的乘积
void EIOF( WORD W , BIT B ) | 一元一次方程【浮点数】
void PCI( WORD W , BIT B ) | 求幂运算【底数为整数】
void FAC( WORD W , BIT B ) | 阶乘求法
void ITF( WORD W , BIT B ) | 反三角函数
void QEI( WORD W , BIT B ) | 一元二次方程【整数】
void SUMI16( WORD W , BIT B ) | 多个16位【整数】数据求和
void MULI( WORD W , BIT B ) | 多个数据【整数】的乘积
void EIOI( WORD W , BIT B ) | 一元一次方程【整数】


分支结构程序

关系运算符和表达式

在程序中经常需要比较两个量的大小关系， 以决定程序下一步的工作。比较两个量的运算符称为关系运算符。 在Ｃ语言中有以下关系运算符：

< 小于

<= 小于或等于

> 大于

>= 大于或等于

== 等于

!= 不等于

关系运算符都是双目运算符，其结合性均为左结合。关系运算符的优先级低于算术运算符，高于赋值运算符。在六个关系运算符中，<,<=,>,>=的优先级相同，高于==和!=，==和!=的优先级相同。

关系表达式

关系表达式的一般形式为： 表达式 关系运算符 表达式 例如：a+b>c-d,x>3/2,'a'+1<c,-i-5*j==k+1；都是合法的关系表达式。由于表达式也可以又是关系表达式。因此也允许出现嵌套的情况，例如：a>(b>c),a!=(c==d)等。关系表达式的值是“真”和“假”，用“1”和“0”表示。

1.逻辑运算符和表达

逻辑运算符Ｃ语言中提供了三种逻辑运算符 && 与运算　|| 或运算　! 非运算 与运算符&&和或运算符||均为双目运算符。具有左结合性。 非

运算符!为单目运算符，具有右结合性。逻辑运算符和其它运算符优先级的关系可表示如下：

按照运算符的优先顺序可以得出：

a>b && c>d等价于(a>b) && (c>d)

!b==c||d<a等价于((!b)==c)||(d<a)

a+b>c && x+y<b等价于((a+b)>c) && ((x+y)<b)

逻辑运算的值

逻辑运算的值也为“真”和“假”两种，用“1”和“0 ”来表示。其求值规则如下：

1.与运算&&参与运算的两个量都为真时，结果才为真，否则为假。例如，5>0 && 4>2,由于5>0为真，4>2也为真，相与的结果也为真。

2.或运算||参与运算的两个量只要有一个为真，结果就为真。两个量都为假时，结果为假。例如：5>0||5>8,由于5>0为真，相或的结果也就为真

3.非运算!参与运算量为真时，结果为假；参与运算量为假时，结果为真。

例如：!(5>0)的结果为假。

虽然Ｃ编译在给出逻辑运算值时，以“1”代表“真”，“0 ”代表“假”。 但反过来在判断一个量是为“真”还是为“假”时，以“0”代表“假”，以非“0”的数值作为“真”。例如：由于5和3均为非“0”因此5&&3的值为“真”，即为1。

又如：5||0的值为“真”，即为1。

逻辑表达式逻辑表达式的一般形式为：表达式 逻辑运算符 表达式 其中的表达式可以又是逻辑表达式，从而组成了嵌套的情形。例如：(a&&b)&&c根据逻辑运算符的左结合性，上式也可写为： a&&b&&c 逻辑表达式的值是式中各种逻辑运算的最后值，以“1”和“0”分别代表“真”和“假”。

2.if语句

用if语句可以构成分支结构。它根据给定的条件进行判断， 以决定执行某个分支程序段。Ｃ语言的if语句有三种基本形式。

1.第一种形式为基本形式 if(表达式) 语句； 其语义是：如果表达式的值为真，则执行其后的语句，否则不执行该语句。

3.第二种形式为if-else形式

if(表达式)

语句1；

else

语句2；

其语义是：如果表达式的值为真，则执行语句1，否则执行语句2 。

输入两个整数，输出其中的大数。改用if-else语句判别a,b的大小，若a大，则输出a，否则输出b。

3.第三种形式为if-else-if形式

前二种形式的if语句一般都用于两个分支的情况。当有多个分支选择时，可采用if-else-if语句，其一般形式为：

if(表达式1)

语句1；

else if(表达式2)

语句2；

else if(表达式3)

语句3；

…

else if(表达式m)

语句m；

else

语句n；

其语义是：依次判断表达式的值，当出现某个值为真时，则执行其对应的语句。然后跳到整个if语句之外继续执行程序。 如果所有的表达式均为假，则执行语句n 。 然后继续执行后续程序。

在使用if语句中还应注意以下问题

(1) 在三种形式的if语句中，在if关键字之后均为表达式。 该表达式通常是逻辑表达式或关系表达式， 但也可以是其它表达式，如赋值表达式等，甚至也可以是一个变量。例如： if(a=5) 语句；if(b) 语句； 都是允许的。只要表达式的值为非0，即为“真”。如在if(a=5)…；中表达式的值永远为非0，所以其后的语句总是要执行的，当然这种情况在程序中不一定会出现，但在语法上是合法的。

又如，有程序段：

if(a=b)

printf("%d",a)；

else

printf("a=0")；本语句的语义是，把b值赋予a，如为非0则输出该值，否则输出“a=0”字符串。这种用法在程序中是经常出现的。

(2) 在if语句中，条件判断表达式必须用括号括起来，在语句之后必须加分号。

(3) 在if语句的三种形式中，所有的语句应为单个语句，如果要想在满足条件时执行一组(多个)语句，则必须把这一组语句用{} 括起来组成一个复合语句。但要注意的是在}之后不能再加分号。

例如：

if(a>b){

a++；

b++；

}

else{ a=0；

b=10；

}

4.条件运算符和条件表达式

如果在条件语句中，只执行单个的赋值语句时， 常可使用条件表达式来实现。不但使程序简洁，也提高了运行效率。

条件运算符为?和：，它是一个三目运算符，即有三个参与运算的量。由条件运算符组成条件表达式的一般形式为：

表达式1? 表达式2： 表达式3

其求值规则为：如果表达式1的值为真，则以表达式2 的值作为条件表达式的值，否则以表达式2的值作为整个条件表达式的值。 条件表达式通常用于赋值语句之中。

例如条件语句：

if(a>b) max=a；

else max=b；

可用条件表达式写为 max=(a>b)?a:b；执行该语句的语义是：如a>b为真，则把a赋予max，否则把b 赋予max。

使用条件表达式时，还应注意以下几点：

1. 条件运算符的运算优先级低于关系运算符和算术运算符，但高于赋值符。因此 max=(a>b)?a:b可以去掉括号而写为 max=a>b?a:b

2. 条件运算符?和：是一对运算符，不能分开单独使用。

3. 条件运算符的结合方向是自右至左。


Break语句

break语句只能用在switch 语句或循环语句中， 其作用是跳出switch语句或跳出本层循环，转去执行后面的程序。由于break语句的转移方向是明确的，所以不需要语句标号与之配合。break语句的一般形式为： break； 上面例题中分别在switch语句和for语句中使用了break 语句作为跳转。使用break语句可以使循环语句有多个出口，在一些场合下使编程更加灵活、方便。


Continue语句？

continue语句只能用在循环体中，其一般格式是：

continue；

其语义是：结束本次循环，即不再执行循环体中continue 语句之后的语句，转入下一次循环条件的判断与执行。应注意的是，本语句只结束本层本次的循环，并不跳出循环。


C语言数据类型

1.整型量

整型量包括整型常量、整型变量。整型常量就是整常数。在Ｃ语言中，使用的整常数有八进制、十六进制和十进制三种。

2.整型常量

1.八进制整常数八进制整常数必须以0开头，即以0作为八进制数的前缀。数码取值为0～7。八进制数通常是无符号数。

以下各数是合法的八进制数：

015(十进制为13)　0101(十进制为65)　0177777(十进制为65535)

以下各数不是合法的八进制数：

256(无前缀0) 03A2(包含了非八进制数码)　-0127(出现了负号)

2.十六进制整常数

十六进制整常数的前缀为0X或0x。其数码取值为0~9，A~F或a~f。

以下各数是合法的十六进制整常数：

0X2A(十进制为42)　　0XA0 (十进制为160)　　0XFFFF (十进制为65535)

以下各数不是合法的十六进制整常数：

5A (无前缀0X)　　0X3H (含有非十六进制数码)

3.十进制整常数

十进制整常数没有前缀。其数码为0～9。

以下各数是合法的十进制整常数：

237 -568 65535 1627

以下各数不是合法的十进制整常数：

023 (不能有前导0)　23D (含有非十进制数码)。

在程序中是根据前缀来区分各种进制数的。因此在书写常数时不要把前缀弄错造成结果不正确。

4.整型常数的后缀在16位字长的机器上，基本整型的长度也为16位，因此表示的数的范围也是有限定的。十进制无符号整常数的范围为0～65535，有符号数为-32768～+32767。八进制无符号数的表示范围为0～0177777。十六进制无符号数的表示范围为0X0～0XFFFF或0x0～0xFFFF。如果使用的数超过了上述范围，就必须用长整型数来表示。长整型数是用后缀“L”或“l”来表示的。例如：

十进制长整常数 158L (十进制为158) 358000L (十进制为-358000)

八进制长整常数 012L (十进制为10) 077L (十进制为63)　0200000L (十进制为65536)。

十六进制长整常数 0X15L (十进制为21) 0XA5L (十进制为165)　0X10000L (十进制为65536)。

    长整数158L和基本整常数158 在数值上并无区别。但对158L，因为是长整型量，Ｃ编译系统将为它分配4个字节存储空间。而对158，因为是基本整型，只分配2 个字节的存储空间。因此在运算和输出格式上要予以注意，避免出错。无符号数也可用后缀表示，整型常数的无符号数的后缀为“U”或“u”。例如： 358u,0x38Au,235Lu 均为无符号数。前缀，后缀可同时使用以表示各种类型的数。如0XA5Lu表示十六进制无符号长整数A5，其十进制为165。

3.整型变量

整型变量可分为以下几类：

1.基本型

类型说明符为int，在内存中占2个字节，其取值为基本整常数。

2.短整量

类型说明符为short int或short'C110F1。所占字节和取值范围均与基本型相同。

3.长整型

类型说明符为long int或long ，在内存中占4个字节，其取值为长整常数。

4.无符号型

类型说明符为unsigned。

无符号型又可与上述三种类型匹配而构成：

(1)无符号基本型类型说明符为unsigned int或unsigned。

(2)无符号短整型类型说明符为unsigned short

(3)无符号长整型类型说明符为unsigned long

各种无符号类型量所占的内存空间字节数与相应的有符号类型量相同。但由于省去了符号位，故不能表示负数。 下表列出了ARM中各类整型量所分配的内存字节数及数的表示范围。

类型说明符　　　 　数的范围 　　　　 分配字节数

int 　　　　　　-2147483648~2147483647　　　　　 ■■■■

short int 　　　-2147483648~2147483647　　　　　 ■■■■

signed int 　　 -2147483648~2147483647　 　　　　 ■■■■

unsigned int 　 0~4294967295 　　　　　　 ■■■■

long int 　-922337203685477808~922337203685477807　 ■■■■■■■■

unsigned long 　0~18446744073709551615 　　　　 ■■■■■■■■

4.整型变量的说明

变量说明的一般形式为： 类型说明符 变量名标识符，变量名标识符，...；例如：

int a,b,c； (a,b,c为整型变量)

long x,y； (x,y为长整型变量)

unsigned p,q； (p,q为无符号整型变量)

在书写变量说明时，应注意以下几点：

1.允许在一个类型说明符后，说明多个相同类型的变量。各变量名之间用逗号间隔。类型说明符与变量名之间至少用一个空格间隔。

2.最后一个变量名之后必须以“；”号结尾。

3.变量说明必须放在变量使用之前。一般放在函数体的开头部分。

[Practice] //1int a,b；

short int c；

short d=100；

a=d-20；

b=a+d；

c=a+b+d；

d=d-a+c-b；

5.实型常量

实型也称为浮点型。实型常量也称为实数或者浮点数。在Ｃ语言中，实数只采用十进制。它有二种形式： 十进制数形式指数形式

1.十进制数形式

由数码0~ 9和小数点组成。例如：0.0，.25，5.789，0.13，5.0，300.，-267.8230等均为合法的实数。

2.指数形式

由十进制数，加阶码标志“e”或“E”以及阶码(只能为整数，可以带符号)组成。其一般形式为a E n (a为十进制数，n为十进制整数)其值为 a*10,n　如： 2.1E5 (等于2.1*10,5), 3.7E-2 (等于3.7*10,)-2*)　0.5E7 (等于0.5*10,7), -2.8E-2 (等于-2.8*10,)-2*)以下不是合法的实数 345 (无小数点)　E7 (阶码标志E之前无数字)　 -5 (无阶码标志)　53.-E3 (负号位置不对)　2.7E (无阶码)。

标准Ｃ允许浮点数使用后缀。后缀为“f”或“F”即表示该数为浮点数。如356f和356.是等价的。

6.实型变量

实型变量分为两类：单精度型和双精度型，其类型说明符为float 单精度说明符，double 双精度说明符。在Turbo C中单精度型占4个字节(32位)内存空间，其数值范围为3.4E-38～3.4E+38，只能提供七位有效数字。双精度型占8 个字节(64位)内存空间，其数值范围为1.7E-308～1.7E+308，可提供16位有效数字。

实型变量说明的格式和书写规则与整型相同。

例如： float x,y； (x,y为单精度实型量)

       double a,b,c； (a,b,c为双精度实型量)

实型常数不分单、双精度，都按双精度double型处理。

a ■■■■

b ■■■■■■■■

a<---33333.33333

b<---33333.33333333333；；

[Practice] //floatint a=32；

float b；

double d；

b=12345678；

d=b*100；

d=d+a；

d=d+58.123456；

7.字符型量

字符型量包括字符常量和字符变量。

字符常量

字符常量是用单引号括起来的一个字符。例如'a','b','=','+','?'都是合法字符常量。在Ｃ语言中，字符常量有以下特点：

1.字符常量只能用单引号括起来，不能用双引号或其它括号。

2.字符常量只能是单个字符，不能是字符串。

3.字符可以是字符集中任意字符。但数字被定义为字符型之后就

不能参与数值运算。如'5'和5 是不同的。'5'是字符常量，不能参与运算。

8.字符变量

字符变量的取值是字符常量，即单个字符。字符变量的类型说明符是char。字符变量类型说明的格式和书写规则都与整型变量相同。

例如：

char a,b； 每个字符变量被分配一个字节的内存空间，因此只能存放一个字符。字符值是以ASCII码的形式存放在变量的内存单元之中的。如x的

十进制ASCII码是120，y的十进制ASCII码是121。对字符变量a,b赋予'x'和'y'值： a='x'；b='y'；实际上是在a,b两个单元内存放120和121的二进制代码：

a　0 1 1 1 1 0 0 0

b　0 1 1 1 1 0 0 1

所以也可以把它们看成是整型量。 Ｃ语言允许对整型变量赋以字符值，也允许对字符变量赋以整型值。在输出时，允许把字符变量按整型量输出，也允许把整型量按字符量输出。整型量为二字节量，字符量为单字节量，当整型量按字符型量处理时， 只有低八位字节参与处理。

[Practice] //charint a=49；

char b；

char d；

b=a+10；

d=a+b；

[Practice] //char c1,c2；

c1='a'；c2='b'；

c1=c1-32；c2=c2-32；

9.字符串常量

字符串常量是由一对双引号括起的字符序列。例如： "CHINA" ，"C program:" ， "$12.5" 等都是合法的字符串常量。字符串常量和字符常量是不同的量。它们之间主要有以下区别：

1.字符常量由单引号括起来，字符串常量由双引号括起来。

2.字符常量只能是单个字符，字符串常量则可以含一个或多个字符。

3.可以把一个字符常量赋予一个字符变量，但不能把一个字符串常量赋予一个字符变量。在Ｃ语言中没有相应的字符串变量。

4.字符常量占一个字节的内存空间。字符串常量占的内存字节数等于字符串中字节数加1。增加的一个字节中存放字符"\0"(ASCII码为0)。这是字符串结束的标志。例如，字符串 "C program"在内存中所占的字节为：C program\0。字符常量'a'和字符串常量"a"虽然都只有一个字符，但在内存中的情况是不同的。

'a'在内存中占一个字节，可表示为：a

"a"在内存中占二个字节，可表示为：a\0符号常量

10.符号常量

在Ｃ语言中，可以用一个标识符来表示一个常量，称之为符号常量。符号常量在使用之前必须先定义，其一般形式为：

#define 标识符 常量

其中#define也是一条预处理命令，称为宏定义命令，其功能是把该标识符定义为其后的常量值。一经定义，以后在程序中所有出现该标识符的地方均代之以该常量值。习惯上符号常量的标识符用大写字母，变量标识符用小写字母，以示区别。

#define PI 3.14159

void main(){

float s,r；

r=5；

s=PI*r*r；

printf("s=%f\n",s)；

}

由宏定义命令定义PI 为3.14159 s,r定义为实数　5->r　PI*r*r->s

显示程序结果 float s,r；　r=5；　s=PI*r*r；本程序在主函数之前由宏定义命令定义PI 为3.14159，在程序中即以该值代替PI 。s=PI*r*r等效于s=3.14159*r*r。应该注意的是，符号常量不是变量，它所代表的值在整个作用域内不能再改变。也就是说，在程序中，不能再用赋值语句对它重新赋值。


For语句

for语句是Ｃ语言所提供的功能更强，使用更广泛的一种循环语句。其一般形式为：

for(表达式1；表达式2；表达3)

语句；

表达式1　通常用来给循环变量赋初值，一般是赋值表达式。也允许在for语句外给循环变量赋初值，此时可以省略该表达式。

表达式2　通常是循环条件，一般为关系表达式或逻辑表达式。

表达式3　通常可用来修改循环变量的值，一般是赋值语句。

这三个表达式都可以是逗号表达式， 即每个表达式都可由多个表达式组成。三个表达式都是任选项，都可以省略。

一般形式中的“语句”即为循环体语句。for语句的语义是：

1.首先计算表达式1的值。

2.再计算表达式2的值，若值为真(非0)则执行循环体一次，否则跳出循环。

3.然后再计算表达式3的值，转回第2步重复执行。在整个for循环过程中，表达式1只计算一次，表达式2和表达式，3则可能计算多次。循环体可能多次执行，也可能一次都不执行。

在使用for语句中要注意以下几点

1.for语句中的各表达式都可省略，但分号间隔符不能少。如：for(；表达式；表达式)省去了表达式

<1>for(表达式；；表达式)省去了表达式

<2>for(表达式；表达式；)省去了表达式

<3>for(；；)省去了全部表达式。

2.在循环变量已赋初值时，可省去表达式1，如例3.27即属于这种情形。如省去表达式2或表达式3则将造成无限循环， 这时应在循环体内设法结束循环。

3.循环体可以是空语句。

#include"stdio.h"

void main(){

int n=0；

printf("input a string:\n")；

for(；getchar()!='\n'；n++)；

printf("%d",n)；

}

本例中，省去了for语句的表达式1，表达式3也不是用来修改循环变量，而是用作输入字符的计数。这样， 就把本应在循环体中完成的计数放在表达式中完成了。因此循环体是空语句。应注意的是，空语句后的分号不可少，如缺少此分号，则把后面的printf 语句当成循环体来执行。反过来说，如循环体不为空语句时， 决不能在表达式的括号后加分号， 这样又会认为循环体是空语句而不能反复执行。这些都是编程中常见的错误，要十分注意。


C语言程序设计初步

Ø Ｃ程序的语句

Ø 分支结构程序

Ø switch语句

Ø 循环结构程序

Ø for语句

Ø break语句

Ø continue语句

Ø 小结


C程序的语句

Ｃ程序的执行部分是由语句组成的。 程序的功能也是由执行语句实现的。

C语句可分为以下五类：

1.表达式语句

2.控制语句

3.复合语句

4.空语句

1.表达式语句

表达式语句由表达式加上分号“；”组成。其一般形式为： 表达式； 执行表达式语句就是计算表达式的值。例如： x=y+z；赋值语句y+z； 加法运算语句，但计算结果不能保留，无实际意义i++；自增1语句，i值增1

2.控制语句

控制语句用于控制程序的流程， 以实现程序的各种结构方式。

它们由特定的语句定义符组成。Ｃ语言有九种控制语句。可分成以下三类：

(1) 条件判断语句

    if语句，switch语句

(2) 循环执行语句

    do while语句，while语句，for语句

(3) 转向语句

    break语句，goto语句，continue语句，return语句

3.空语句

只有分号“；”组成的语句称为空语句。 空语句是什么也不执行的语句。在程序中空语句可用来作空循环体。例如 while(getchar()!='\n')； 本语句的功能是，只要从键盘输入的字符不是回车则重新输入。这里的循环体为空语句。

4.赋值语句

赋值语句是由赋值表达式再加上分号构成的表达式语句。 其一般形式为： 变量=表达式； 赋值语句的功能和特点都与赋值表达式相同。它是程序中使用最多的语句之一。在赋值语句的使用中需要注意以下几点：

1.由于在赋值符“=”右边的表达式也可以又是一个赋值表达式，因此，下述形式变量=(变量=表达式)；是成立的，从而形成嵌套的情形。其展开之后的一般形式为：变量=变量=…=表达式；

例如：

a=b=c=d=e=5；按照赋值运算符的右接合性，因此实际上等效于：

e=5；

d=e；

c=d；

b=c；

a=b；

2.注意在变量说明中给变量赋初值和赋值语句的区别。给变量赋初值是变量说明的一部分，赋初值后的变量与其后的其它同类变量之间仍必须用逗号间隔，而赋值语句则必须用分号结尾。

3.在变量说明中，不允许连续给多个变量赋初值。 如下述说明是错误的： int a=b=c=5 必须写为 int a=5,b=5,c=5； 而赋值语句允许连续赋值

4.注意赋值表达式和赋值语句的区别。赋值表达式是一种表达式，它可以出现在任何允许表达式出现的地方，而赋值语句则不能。

下述语句是合法的： if((x=y+5)>0) z=x；语句的功能是，若表达式x=y+5大于0则z=x。下述语句是非法的： if((x=y+5；)>0) z=x； 因为=y+5；是语句，不能出现在表达式中。


Switch语句

Ｃ语言还提供了另一种用于多分支选择的switch语句，其一般形式为：

switch(表达式){

case常量表达式1: 语句1；

case常量表达式2: 语句2；

…

case常量表达式n: 语句n；

default : 语句n+1；

}

其语义是：计算表达式的值。 并逐个与其后的常量表达式值相比较，当表达式的值与某个常量表达式的值相等时，即执行其后的语句，然后不再进行判断，继续执行后面所有case后的语句。 如表达式的值与所有case后的常量表达式均不相同时，则执行default后的语句。

在使用switch语句时还应注意以下几点：

1.在case后的各常量表达式的值不能相同，否则会出现错误。

2.在case后，允许有多个语句，可以不用{}括起来。

3.各case和default子句的先后顺序可以变动，而不会影响程序执行结果。

4.default子句可以省略不用。


循环结构程序

循环结构是程序中一种很重要的结构。其特点是，在给定条件成立时，反复执行某程序段，直到条件不成立为止。 给定的条件称为循环条件，反复执行的程序段称为循环体。Ｃ语言提供了多种循环语句，可以组成各种不同形式的循环结构。

1.while语句

while语句的一般形式为： while(表达式)语句； 其中表达式是循环条件，语句为循环体。

while语句的语义是：计算表达式的值，当值为真(非0)时， 执行循环体语句。

使用while语句应注意以下几点：

1.while语句中的表达式一般是关系表达或逻辑表达式，只要表达式的值为真(非0)即可继续循环。

2.循环体如包括有一个以上的语句，则必须用{}括起来，组成复合语句。

3.应注意循环条件的选择以避免死循环。

2.do-while语句

do-while语句的一般形式为：

do语句；

while(表达式)；

其中语句是循环体，表达式是循环条件。

do-while语句的语义是：

先执行循环体语句一次， 再判别表达式的值，若为真(非0)则继续循环，否则终止循环。

do-while语句和while语句的区别在于do-while是先执行后判断，因此do-while至少要执行一次循环体。而while是先判断后执行，如果条件不满足，则一次循环体语句也不执行。

while语句和do-while语句一般都可以相互改写。

在本例中，循环条件改为--n，否则将多执行一次循环。这是由于先执行后判断而造成的。

对于do-while语句还应注意以下几点：

1.在if语句，while语句中， 表达式后面都不能加分号， 而在 do-while语句的表达式后面则必须加分号。

2.do-while语句也可以组成多重循环，而且也可以和while语句相互嵌套。

3.在do和while之间的循环体由多个语句组成时，也必须用{}括起来组成一个复合语句。

4.do-while和while语句相互替换时，要注意修改循环控制条件。


更改PLC状态

单击菜单栏的在线->更改PLC状态命令或者直接单击工具栏上的 [image] 更改PLC状态图标，会打开如图4-1的更改PLC状态对话框：

图4-1更改PLC状态对话框

1、单击“获取PLC运行状态”按钮，可以得到当前连接的PLC状态。

2、“PLC置为RUN”按钮，可以将PLC改为运行状态。

3、“PLC置为STOP ”按钮，可以将PLC改为停止状态。

注意：在设置PLC停止和运行状态的时候请务必确认好相关的安全信息，防止PLC突然停机或开机导致财产损失或人员损伤！


通信协议

一、MODBUS简介

FGs系列PLC采用的是MODBUS通信协议。Modbus 协议是应用于控制器上的一种通用语言。通过此协议，控制器相互之间、控制器经由网络和其它设备之间可以通信。通讯采用应答方式，由主机发起请求，从机执行请求并且

应答。PLC最大从站数为127个，设置的范围为1~127。PLC支持广播模式，广播地址为00。

二、接口方式

目前PLC支持MODBUS通信的接口为RS232、RS485以及USB接口。

串口通信默认的数据格式为：9600bps、8位数据位、1位停止位，无校验。波特率的可设置范围是：4800bps、9600bps、19200bps、38400bps、57600bps、115200bps

三、协议格式

协议支持的是MODBUS的RUT模式

从机地址

功能码

数据

CRC高字节

CRC低字节

四、功能码描述

本系列PLC支持的功能码如下：

功能码 | 名称 | 作用 | 支持的寄存器
0x01 | 读取线圈状态 | 取得一组逻辑线圈的当前状态（ON/OFF） | Y、X、M、S、T、C
0x02 | 读取输入状态 | 取得一组开关输入的当前状态（ON/OFF） | X
0x03 | 读取保持寄存器 | 在一个或多个保持寄存器中取得当前的二进制值 | D、TV、CV
0x05 | 强置（写）单线圈 | 写一个逻辑线圈的通断状态 | Y、M、S、T、C
0x06 | 预置（写）单寄存器 | 把具体二进值装入一个数据寄存器 | D、TV、CV
0x08 | 回送诊断校验 | 把诊断校验报文送从机，以对通信处理进行评鉴 | 无
0x0f | 强置（写）多线圈 | 强置（写）一串连续逻辑线圈的通断 | Y、M、S、T、C
0x10 | 预置（写）多寄存器 | 把具体的二进制值装入一串连续的保持寄存器 | D、TV、CV


SAMSOAR Developer编辑界面

SAMSOR Developer软件一共分为三大部分构成：工具栏、树形目录、梯形图编辑区域；如图3-1所示：

图3-1


扩展模块使用

扩展模块是在PLC基本单元功能的扩展和延伸，直观上达到了输入输出点数的增加，更重要的是增加了用户项目开发的灵活性和便利性。

目前所支持的模块有FGs-E8X、FGs-E8T、FGs-E8R、FGs-E8X8T、FGs-E8X8R、FGs-E16T、FGs-E16R、FGs-E4AI、FGs-E2AO、FGs-E4AI2AO、FGs-E4TC。

FGs-E系列PLC扩展模块不仅具有强大的逻辑处理、数据运算、高速处理等功能，而且具有基本的输入输出、 A/D、 D/A转换等功能， 通过使用输入输出模块、模拟量模块、 温度控制模块等等，使FGs-E系列的PLC 在温度、流量、 液位、压力等过程控制系统中得到了广泛的应用。

1、模块型号及功能

型号 | 功能
FGs-E8X | 8通道数字量输入模块
FGs-E8T | 8通道数字量晶体管输出模块
FGs-E8R | 8通道数字量继电器输出模块
FGs-E8X8T | 8通道数字量输入，8通道数字量晶体管输出模块
FGs-E8X8R | 8通道数字量输入，8通道数字量继电器输出模块
FGs-E16X | 16通道数字量输入模块
FGs-E16T | 16通道数字量晶体管输出模块
FGs-E16R | 16通道数字量继电器输出模块
FGs-E4AI | 4通道模拟量输入（12-bit）模块，输入电压电流均可选
FGs-E2AO | 2通道模拟量输出（16-bit）模块，输出电压电流均可选
FGs-E4AI2AO | 4通道模拟量输入（12-bit），2通道模拟量输出（16-bit）模块，输入输出电压电流均可选
FGs-E4TC | 4通道模拟量输入（16-bit）模块，输入PT100、K型热电偶均可选

FGs-E系列扩展模块可以安装在FGs系列PLC的主单元、扩展模块右边：

* 输入输出开关量序号为八进制

* 输入输出模拟量序号为十进制，每个模块固定占四个寄存器，如有缺失通道则不作使用

* PLC本体最多可以外接8个扩展模块，种类不受限制，可以为输入输出开关量，也可以是模拟量、温度控制模块等，但同一类型的寄存器个数不能超过系统支持的最大寄存器数量，超过无效。

2、SAMSOAR Developer中的配置

模块在使用时，首先需要在 PLC 的上位机编程软件 SAMSOAR Developer中进行相应的配置，方可正常使用模块。 下面以模块 FGs-E4AI2AO 为例，说明如何在SAMSOAR Developer中进行配置，步骤如下所示：
A、 打开编程软件，如下图所示

点击上图中的图标（箭头处），将弹出系统参数设置对话框，如下图所示

然后选择“扩展模块设置”，将切换到“扩展模块设置”页面，如下图所示：

勾选“使用扩展功能”，启动扩展模块功能，如下图所示：

然后选择目标模块类型，并勾选“启用”来激活此模块，此时模块类型列表中会显示出对应序号的模块类型（FGs-E4AI2AO为例），

点击输入部分的“通道”右侧的下拉框进行通道切换，勾选“启用”后，相应的通道才可以使用，不同的通道有不同的通道参数，参数主要包括：模式、平均采样次数、采样当前值、数字量范围；输出部分与输入雷同。需要注意的是每个模拟量模块都会固定占用4个AI或4个AO寄存器，即使没有使用。另外系统根据模块的序列和相应模块的类型自动在对话框页面右下方提示模块寄存器的地址。

3、模拟量输入输出模块FGs-E4AI2AO

本章主要介绍 FGs-E4AI2AO模块的规格、端子说明、输入定义号的分配、 工作
模式设定、 外部连接以及模数转换图。

3.1. 模块特点及规格

FGs-E4AI2AO模拟量输入输出模块将 4点模拟输入数值（电
压输入， 电流输入）转换成数字值，并且把他们传输到 PLC 主单元，同时还可以将2点模拟量输出的数值（电压输入， 电流输入）转换成模拟量的输出。

* 4通道模拟量输入：电压输入或电流输入自由选择，其中电压输入有0～
5V、 0～10V 两种模式；电流输入有 4～20mA 模式。
 * 12 位的高精度模拟量输入和16位的高精度模拟量输出。
 * 作为FGs-E系列的特殊功能模块，最多可在 PLC 主单元
右边连接6台 FGs-E4AI2AO 模块。
 * FGs-E4AI2AO模拟、数字部分电源隔离处理。

模块规格

项目 | 电压输入 | 电流输入 | 电压输出 | 电流输出
模拟量输入范围 | 0～5V、 0～10V | 4～20mA | 0～5V、 0～10V | 4～20mA
最大输入输出范围 | ±15V | 0～40mA | ±15V | 0～40mA
数字输入输出范围 | 12位二进制数 |  | 16位二进制数
分辨率 | 1/4095（ 12Bit） |  | 1/65535（16Bit）
综合精确度 | 1‰ |  | 1‰
转换速度 | 20ms/通道 |  | 20ms/通道
模拟量用电源 | DC24V±10%， 100mA

3.2. 端子说明

端子信号

模拟量输入/输出/485 | 通道 | 端子名 | 信号名
模拟量输入 | 输入CH0 | A+ | A模拟量+
 |  | RA | 如果是电流输入需与A+短接
 |  | A- | A模拟量-
 | 输入CH1 | B+ | B模拟量+
 |  | RB | 如果是电流输入需与B+短接
 |  | B- | B模拟量-
 | 输入CH2 | C+ | C模拟量+
 |  | RC | 如果是电流输入需与C+短接
 |  | C- | C模拟量-
 | 输入CH3 | D+ | D模拟量+
 |  | RD | 如果是电流输入需与D+短接
 |  | D- | D模拟量-
模拟量输出 | 输出CH0 | AOV | A输出+（电压）
 |  | AOI | A输出+（电流）
 |  | C0 | A输出-
 | 输出CH1 | BOV | B输出+（电压）
 |  | BOI | B输出+（电流）
 |  | C1 | B输出-
485 | - | 485A | 485通讯+
 | - | 485B | 485通讯-

注：485只作从机使用

3.3 输FGs-E4AI2AO 接线示意图

3.3.1模拟量电压输入

3.3.2模拟量电流输入

3.3.3 模拟量电压输出

3.3.4 模拟量电流输出

3.4 输入输出定义号分配

第一个扩展模块寄存器定义号

通道 | AD信号 | DA信号
输入CH0 | AI8 | -
输入CH1 | AI9 | -
输入CH2 | AI10 | -
输入CH3 | AI11 | -
输出CH0 | - | AO4
输出CH1 | - | AO5

第二个扩展模块寄存器定义号

通道 | AD信号 | DA信号
输入CH0 | AI12 | -
输入CH1 | AI13 | -
输入CH2 | AI14 | -
输入CH3 | AI15 | -
输出CH0 | - | A8
输出CH1 | - | A9

第三个扩展模块寄存器定义号

通道 | AD信号 | DA信号
输入CH0 | AI16 | -
输入CH1 | AI17 | -
输入CH2 | AI18 | -
输入CH3 | AI19 | -
输出CH0 | - | A12
输出CH1 | - | A13

第四个扩展模块寄存器定义号

通道 | AD信号 | DA信号
输入CH0 | AI20 | -
输入CH1 | AI21 | -
输入CH2 | AI22 | -
输入CH3 | AI23 | -
输出CH0 | - | A16
输出CH1 | - | A17

第五个扩展模块寄存器定义号

通道 | AD信号 | DA信号
输入CH0 | AI24 | -
输入CH1 | AI25 | -
输入CH2 | AI26 | -
输入CH3 | AI27 | -
输出CH0 | - | A20
输出CH1 | - | A21

第六个扩展模块寄存器定义号

通道 | AD信号 | DA信号
输入CH0 | AI28 | -
输入CH1 | AI29 | -
输入CH2 | AI30 | -
输入CH3 | AI31 | -
输出CH0 | - | A24
输出CH1 | - | A25

3.6 模数转换图

0~5V模拟量输入数字量对应关系

0~10V模拟量输入数字量对应关系

4~20mA模拟量输入数字量对应关系

同样的道理也适用于模拟量输出，不过输出的精度是16bit，即1/65535。

4 模拟量温度模块FGs-E4TC

本章主要介绍 FGs-E4TC模块的规格、端子说明、输入定义号的分配、 工作
模式设定、 外部连接以及模数转换图。

4.1 FGs-E4TC模块特点及规格

FGs-E4TC模拟量输入输出模块将 4点温度的模拟量转换成数字值，并且把他们传输到 PLC 主单元。

* 4通道温度模拟量输入：支持K型热电偶或PT100热电阻两种传感器。
 * 16 位的高精度模拟量输入。
 * 作为FGs-E系列的特殊功能模块，最多可在 PLC 主单元
右边连接6台 FGs-E4AI2AO 模块。
 * FGs-E4TC模拟、数字部分电源隔离处理。

模块规格

项目 | PT100 | K型热电偶
数字输入输出范围 | 16位二进制数
分辨率 | 1/65535（ 16 Bit）
综合精确度 | 1‰
转换速度 | 20ms/通道
模拟量用电源 | DC24V±10%， 100mA

4.2 FGs-E4TC端子说明

FGs-E4TC端子信号

模拟量输入/485 | 通道 | 端子名 | 信号名
温度输入 | 输入CH0 | A0 | CH0热电阻、热电偶输入端
 |  | A1 | CH0热电阻、热电偶输入公共端
 |  | A3 | CHO热电阻A1同色端（三线制）
 | 输入CH1 | B0 | CH1热电阻、热电偶输入端
 |  | B1 | CH1热电阻、热电偶输入公共端
 |  | B3 | CH1热电阻B1同色端（三线制）
 | 输入CH2 | C0 | CH2热电阻、热电偶输入端
 |  | C1 | CH2热电阻、热电偶输入公共端
 |  | C3 | CH2热电阻C1同色端（三线制）
 | 输入CH3 | D0 | CH3热电阻、热电偶输入端
 |  | D1 | CH3热电阻、热电偶输入公共端
 |  | D3 | CH3热电阻D1同色端（三线制）
485 | - | 485A | 485通讯+
 | - | 485B | 485通讯-

注：485只作从机使用

4.3 输FGs-E4TC 接线示意图

4.3.1 K型热电偶

4.3.2 PT100型热电阻

4.4 FGs-E4TC 输入输出定义号分配

第一个扩展模块寄存器定义号

通道 | AD信号
输入CH0 | AI8
输入CH1 | AI9
输入CH2 | AI10
输入CH3 | AI11

第二个扩展模块寄存器定义号

通道 | AD信号
输入CH0 | AI12
输入CH1 | AI13
输入CH2 | AI14
输入CH3 | AI15

第三个扩展模块寄存器定义号

通道 | AD信号
输入CH0 | AI16
输入CH1 | AI17
输入CH2 | AI18
输入CH3 | AI19

第四个扩展模块寄存器定义号

通道 | AD信号
输入CH0 | AI20
输入CH1 | AI21
输入CH2 | AI22
输入CH3 | AI23

第五个扩展模块寄存器定义号

通道 | AD信号
输入CH0 | AI24
输入CH1 | AI25
输入CH2 | AI26
输入CH3 | AI27

第六个扩展模块寄存器定义号

通道 | AD信号
输入CH0 | AI28
输入CH1 | AI29
输入CH2 | AI30
输入CH3 | AI31

5 数字量模块

FGs-E8X\FGs-E8T\FGs-E8R\FGs-E8X8T\FGs-E8X8R\FGs-E16X\FGs-E16T\FGs-E16R

5.1 模块特点及规格

FGs-E8X\FGs-E8T\FGs-E8R\FGs-E8X8T\FGs-E8X8R\FGs-E16X\FGs-E16T\FGs-E16R数字量输入输出模块,每个基本单元可扩展 8 个模块，模块种
类丰富，外形小巧，为更多的输入和输出点提供了可能，满足了实际生产需要。

* 晶体管输出的频率最大为200Hz，继电器则建议不要超过10Hz

* 数字量输入采用兼容设计，可以根据SS的状态来选择NPN输入或是PNP输入，接收的动作间隔最快不能超过200Hz

5.2 数字量模块端子说明

FGs-E8X、FGs-E8T、FGs-E8R、FGs-E8X8T、FGs-E8X8R（FGs-E8T、FGs-E8X8T的COM0\COM1\COM2内部短接）

FGs-E16X

FGs-E16T、FGs-E16R（FGs-E16T的COM0\COM1\COM2内部短接，COM10\COM11\COM12内部短接）


前言

深圳市显控自动化技术有限公司是一家潜心于工业可视触摸控制产品---人机界面核心技术的研发与攻克，专业开发、制造、销售最先进的工控产品的民族高科技企业！经过六年多的沉淀与升华，深圳显控公司厚积薄发，以其强劲的研发创新能力、不基于任何系统、100%完全自主知识产权的核心技术和高性价比的优势深深引领我国及全球相关行业。

由于笔者水平有限，手册中难免有许多不妥与错误之处，诚请读者批评指正。若您需要更进一步的获得更多的技术支持请通过以下方式与我们联系，我们将真诚为您服务。

深圳市显控自动化技术有限公司

Shenzhen Samkoon Automation Technology Co.,Ltd

地址：深圳市南山区高新中区深圳软件园一期1栋3楼

Address：ShenZhen Software Park 1st Building 3rd floor,

the middle road of High-tech zone，

NanShan district,ShenZhen,China

电话(Tel)：0755—29419068 0755—29419038

0755—29419068 0755—29419098

传真(Fax)：0755-29455559

E-Mail：szsamkoon@163.com

网址(Web)：Http://www.samkoon.com.cn


SamkoonSoar对计算机的硬件需求

SamkoonSoar硬件最低要求是：

· 最低Pentium 3-800MHz计算机。为有更佳性能，推荐Pentium 4-1GHz以上的计算机。

· 内存在Windows 98系统运行时，最少需要64M以上内存；在Windows 2000系统上运行时，最少需要128M以上的内存；在Windows XP上运行时，最少需要128M以上内存。推荐使用256M以上内存。

· 硬盘空间，安装SamkoonSoar至少需要50M。推荐可用硬盘空间至少在100M以上，如果没有足够的硬盘空间，SamkoonSoar无法安装；

· 显示卡:Windows系统兼容，含有1MB以上的显示内存，可工作于1024*768分辨率以上，32位真彩色；

· 计算机带USB接口；

· 两键鼠标和键盘。

低于以上配置的计算机，SamkoonSoar在计算机上运行有可能无法安装和运行。

推荐配置：

· CPU：使用相当于Intel公司的Pentium 800或以上级别的CPU；

· 内存：256M以上；

· 显卡：Windows系统兼容，含有1MB以上的显示内存，可工作于1024*768分辨率以上，32位真彩色；

硬盘：40G以上。


Redirect Page

Page Loader

If there is a security warning at the top of the page please click it and select "Allow blocked content".

If redirection does not occur click this link:


Contents

get link | sync toc | << | >>
*** No Title Found *** A_INPUT.htm
*** No Title Found *** A_INPUTIMME.htm
*** No Title Found *** ALT.htm
*** No Title Found *** ALTP.htm
*** No Title Found *** Appendix.htm
*** No Title Found *** ASSIST.htm
*** No Title Found *** ASSIST_CML_DW.htm
*** No Title Found *** ASSIST_CML_W.htm
*** No Title Found *** ASSIST_CMP_DW.htm
*** No Title Found *** ASSIST_CMP_F.htm
*** No Title Found *** ASSIST_CMP_W.htm
*** No Title Found *** ASSIST_FACT.htm
*** No Title Found *** ASSIST_FMOV_DW.htm
*** No Title Found *** ASSIST_FMOV_W.htm
*** No Title Found *** ASSIST_LOG.htm
*** No Title Found *** ASSIST_NEG_DW.htm
*** No Title Found *** ASSIST_NEG_W.htm
*** No Title Found *** ASSIST_POW.htm
*** No Title Found *** ASSIST_SMOV.htm
*** No Title Found *** ASSIST_XCH_DW.htm
*** No Title Found *** ASSIST_XCH_F.htm
*** No Title Found *** ASSIST_XCH_W.htm
*** No Title Found *** ASSIST_ZCP_DW.htm
*** No Title Found *** ASSIST_ZCP_F.htm
*** No Title Found *** ASSIST_ZCP_W.htm
*** No Title Found *** B_INPUT.htm
*** No Title Found *** B_INPUTIMME.htm
*** No Title Found *** BasicOperations.htm
*** No Title Found *** BitLogical.htm
*** No Title Found *** C_BranchStructure.htm
*** No Title Found *** C_Break.htm
*** No Title Found *** C_Continue.htm
*** No Title Found *** C_DataType.htm
*** No Title Found *** C_For.htm
*** No Title Found *** C_languageEntry.htm
*** No Title Found *** C_Programming.htm
*** No Title Found *** C_Statement.htm
*** No Title Found *** C_Switch.htm
*** No Title Found *** C_While.htm
*** No Title Found *** ChangePLCstate.htm
*** No Title Found *** CMPOP_EQ.htm
*** No Title Found *** CMPOP_G.htm
*** No Title Found *** CMPOP_GE.htm
*** No Title Found *** CMPOP_L.htm
*** No Title Found *** CMPOP_LE.htm
*** No Title Found *** CMPOP_NE.htm
*** No Title Found *** CommentEditMode.htm
*** No Title Found *** Communication.htm
*** No Title Found *** CompareElem.htm
*** No Title Found *** Contact.htm
*** No Title Found *** CONVERT_BCD2I.htm
*** No Title Found *** CONVERT_DI2I.htm
*** No Title Found *** CONVERT_DI2R.htm
*** No Title Found *** CONVERT_I2BCD.htm
*** No Title Found *** CONVERT_I2DI.htm
*** No Title Found *** CONVERT_ROUND.htm
*** No Title Found *** CONVERT_TRUNC.htm
*** No Title Found *** Counter.htm
*** No Title Found *** COUNTER_TYPE_CTD.htm
*** No Title Found *** COUNTER_TYPE_CTU.htm
*** No Title Found *** DeviceDrivers.htm
*** No Title Found *** EditAndSystemcomponents.htm
*** No Title Found *** EditInterface.htm
*** No Title Found *** Elementmoniter.htm
*** No Title Found *** ElemInit.htm
*** No Title Found *** ElemNoteView.htm
*** No Title Found *** ElemSerchReplce.htm
*** No Title Found *** ElemUsed.htm
*** No Title Found *** F32CALC_ADD.htm
*** No Title Found *** F32CALC_COS.htm
*** No Title Found *** F32CALC_DIV.htm
*** No Title Found *** F32CALC_EXP.htm
*** No Title Found *** F32CALC_LN.htm
*** No Title Found *** F32CALC_MUL.htm
*** No Title Found *** F32CALC_SIN.htm
*** No Title Found *** F32CALC_SORT.htm
*** No Title Found *** F32CALC_SUB.htm
*** No Title Found *** F32CALC_TAN.htm
*** No Title Found *** FEDGE.htm
*** No Title Found *** FloatingPoint.htm
*** No Title Found *** Foreword.htm
-family:"Times New Roman";mso-hansi-font-family: "Times New Roman"'>一、硬件参数表 一、软件的安装

*** No Title Found *** INTCALC_ADD_DI.htm
*** No Title Found *** INTCALC_ADD_I.htm
*** No Title Found *** INTCALC_DEC_DW.htm
*** No Title Found *** INTCALC_DEC_W.htm
*** No Title Found *** INTCALC_DIV.htm
*** No Title Found *** INTCALC_DIV_DI.htm
*** No Title Found *** INTCALC_DIV_I.htm
*** No Title Found *** INTCALC_INC_DW.htm
*** No Title Found *** INTCALC_INC_W.htm
*** No Title Found *** INTCALC_MUL.htm
*** No Title Found *** INTCALC_MUL_DI.htm
*** No Title Found *** INTCALC_MUL_I.htm
*** No Title Found *** INTCALC_SUB_DI.htm
*** No Title Found *** INTCALC_SUB_I.htm
*** No Title Found *** IntegerArithmetic.htm
*** No Title Found *** Interrupt.htm
*** No Title Found *** INTERRUPT_ATCH.htm
*** No Title Found *** INTERRUPT_DISI.htm
*** No Title Found *** INTERRUPT_DTCH.htm
*** No Title Found *** INTERRUPT_ENI.htm
*** No Title Found *** INY.htm
*** No Title Found *** LGCCALC_INV_DW.htm
*** No Title Found *** LGCCALC_INV_W.htm
*** No Title Found *** LGCCALC_WAND_DW.htm
*** No Title Found *** LGCCALC_WAND_W.htm
*** No Title Found *** LGCCALC_WOR_DW.htm
*** No Title Found *** LGCCALC_WOR_W.htm
*** No Title Found *** LGCCALC_WXOR_DW.htm
*** No Title Found *** LGCCALC_WXOR_W.htm
*** No Title Found *** LogicOperation.htm
*** No Title Found *** Macro.htm
*** No Title Found *** MacroIntroduction.htm
*** No Title Found *** MacroRun.htm
*** No Title Found *** MBUS.htm
*** No Title Found *** MEF.htm
*** No Title Found *** Menu.htm
*** No Title Found *** MEP.htm
*** No Title Found *** MonitorMode.htm
n>

在编辑梯形图的

*** No Title Found *** Move.htm
*** No Title Found *** MV_BLKMOV_DW.htm
*** No Title Found *** MV_BLKMOV_W.htm
*** No Title Found *** MV_MOV_DW.htm
*** No Title Found *** MV_MOV_F.htm
*** No Title Found *** MV_MOV_W.htm
*** No Title Found *** Newpro.htm
*** No Title Found *** NewProStep.htm
*** No Title Found *** OCIOL_RST.htm
*** No Title Found *** OCIOL_RSTIMME.htm
*** No Title Found *** OCIOL_SETIMME.htm
*** No Title Found *** OCOIL_IMME.htm
*** No Title Found *** OCOIL_NORMAL.htm
*** No Title Found *** OCOIL_SET.htm
*** No Title Found *** OneDimensionalArray.htm
*** No Title Found *** OperatorExpression.htm
*** No Title Found *** OrderSerch.htm
*** No Title Found *** OrderSys.htm
*** No Title Found *** ParaSettings.htm
*** No Title Found *** PlcCheck.htm
*** No Title Found *** PlcParameterSetting.htm
*** No Title Found *** PlcRead.htm
*** No Title Found *** PLCsoftTitle.htm
*** No Title Found *** PlcWrite.htm
*** No Title Found *** PLSF.htm
*** No Title Found *** PLSNEXT.htm
*** No Title Found *** PLSR.htm
*** No Title Found *** PLSSTOP.htm
*** No Title Found *** PLSY.htm
*** No Title Found *** PrgCtrl.htm
*** No Title Found *** PRGCTRL_CALL.htm
*** No Title Found *** PRGCTRL_CALLM.htm
*** No Title Found *** PRGCTRL_FOR.htm
*** No Title Found *** PRGCTRL_JMP.htm
*** No Title Found *** PRGCTRL_LBL.htm
*** No Title Found *** PRGCTRL_NEXT.htm
*** No Title Found *** PRGCTRL_TEST.htm
*** No Title Found *** ProRun.htm
*** No Title Found *** PulseOutput.htm
*** No Title Found *** PWM.htm
*** No Title Found *** QuickStart.htm
*** No Title Found *** REDGE.htm
*** No Title Found *** RTC.htm
*** No Title Found *** RTC_RDRTC.htm
*** No Title Found *** RTC_SETRTC.htm
*** No Title Found *** Shift.htm
*** No Title Found *** SHIFT_ROLDW.htm
*** No Title Found *** SHIFT_ROLW.htm
*** No Title Found *** SHIFT_RORDW.htm
*** No Title Found *** SHIFT_RORW.htm
*** No Title Found *** SHIFT_SHLB.htm
*** No Title Found *** SHIFT_SHLDW.htm
*** No Title Found *** SHIFT_SHLW.htm
*** No Title Found *** SHIFT_SHRB.htm
*** No Title Found *** SHIFT_SHRDW.htm
*** No Title Found *** SHIFT_SHRW.htm
*** No Title Found *** SoftRequire.htm
*** No Title Found *** Summary.htm
*** No Title Found *** Summary1.htm
*** No Title Found *** Systemcomponents.htm
>一、SAMSOAR Developer硬件最低要求是：

*** No Title Found *** SystemSetting.htm
*** No Title Found *** SystemStay.htm
*** No Title Found *** Term.htm
*** No Title Found *** Timer.htm
*** No Title Found *** TIMER_TOF.htm
*** No Title Found *** TIMER_TON.htm
*** No Title Found *** TIMER_TONR.htm
*** No Title Found *** Toolbar.htm
*** No Title Found *** TransformElem.htm
*** No Title Found *** UnderstandSamkoonSoar.htm
*** No Title Found *** VariableTypes.htm
F32CALC_ADD.files
*** No Title Found *** F32CALC_ADD.files\header.htm
F32CALC_COS.files
*** No Title Found *** F32CALC_COS.files\header.htm
F32CALC_DIV.files
*** No Title Found *** F32CALC_DIV.files\header.htm
F32CALC_EXP.files
*** No Title Found *** F32CALC_EXP.files\header.htm
F32CALC_LN.files
*** No Title Found *** F32CALC_LN.files\header.htm
F32CALC_SIN.files
*** No Title Found *** F32CALC_SIN.files\header.htm
F32CALC_SORT.files
*** No Title Found *** F32CALC_SORT.files\header.htm
F32CALC_TAN.files
*** No Title Found *** F32CALC_TAN.files\header.htm
INTCALC_DEC_DW.files
*** No Title Found *** INTCALC_DEC_DW.files\header.htm
MV_BLKMOV_DW.files
*** No Title Found *** MV_BLKMOV_DW.files\header.htm
MV_BLKMOV_W.files
*** No Title Found *** MV_BLKMOV_W.files\header.htm
MV_MOV_DW.files
*** No Title Found *** MV_MOV_DW.files\header.htm
MV_MOV_F.files
*** No Title Found *** MV_MOV_F.files\header.htm
MV_MOV_W.files
*** No Title Found *** MV_MOV_W.files\header.htm
PlcCheck.files
*** No Title Found *** PlcCheck.files\header.htm
SHIFT_SHLDW.files
*** No Title Found *** SHIFT_SHLDW.files\header.htm


SamDraw综述

深圳市显控自动化技术有限公司

Shenzhen Samkoon Automation Technology Co.,Ltd

联系方式

---------------------------------

·地 址：深圳市宝安区西乡洲石公路恒丰工业城C6栋

·邮 编：518103

·电 话：0755-29419038 29419068

·传 真：0755-29455559

·Email：szsamkoon@163.com

·网 站：http://www.samkoon.com.cn


SAMSOAR Developer 的安装及卸载过程

一、软件的安装

SAMSOAR Developer 是专为标准Microsoft Windows系统设计的32位应用软件。安装软件前，请确认该计算机的软件和硬件是否符合安装的最低需求。

使用随产品配送的安装盘来安装SAMSOAR Developer。具体安装步骤如下：

l 启动Windows；

l 双击安装文件 [image] ，会弹出如下图1-1所示对话框：

图1-1

通过该对话框可以选择安装的语言，点击“确定”按钮。

l 在弹出的“欢迎使用”对话框中点击“下一步”，如图1-2所示：

图1-2

l 在弹出的“选择目标位置”对话框中可以选择程序的安装目录， 在安装之前请确定磁盘是否有有足够的剩余空间，否则的话会导致安装失败。程序默认路径为“C:\Program Files\SAMSoar Developer”，用户可以根据自己实际情况选择安装，如图1-3所示，然后点击下一步。

图1-3

l 在弹出的“选择开始菜单”对话框中点击“下一步”，如图1-4所示：

图1-4

l 然后在弹出的对话框中选择下一步，如图1-5

图1-5

l 此时会弹出提示选择安装的对话框，在确认选择无误的情况下请点击“安装”按钮，如图1-6所示：

图1-6

l 此时会弹出提示选择安装的对话框，在确认选择无误的情况下请点击“安装”按钮，如图1-7所示：

图1-7

l 安装程序正在将SAMSoar Developer安装到指定目录下，请等待直到程序安装完毕，此时会弹出安装完成对话框，如图1-8所示：

图1-8

l 点击完成按钮，至此SAMSoar Developer已经成功安装到您的计算机当中

二、软件的卸载

l 想要卸载SAMSoar Developer的话可以点击开始->程序->SAMSoar Developer下的卸载SAMSoar Developer选项；如图1-9所示：

图1-9

l 此时会弹出是否确定卸载对话框，如图1-10所示：

图1-10

l 点击确定的话会弹出卸载进度对话框 如图1-11所示：

图1-11

l 至此软件将从本地计算机移除。


SamDraw 系统保留寄存器

系统保留寄存器

本章介绍SamDraw系统保留的寄存器。

SamDraw保留了一些寄存器用于特殊用途，使用者在使用这些寄存器的时候，必须参照相关说明，这些寄存器包括有LB(本地内存位)；LW(本地内存寄存器)；RWI(配方索引)；

LB：LB0~LB4095，LB3000-LB3999属于断电保持区域；

LW：LW0~LW4095，LW3000-LW3999属于断电保持区域；

RWI：RWI0~RWI4095；

l LB

l LW

l RWI


函数功能块

函数功能块是指通过编写C语言函数来实现梯形图的功能，它使PLC的功能变得更加强大。使用C语言编写函数，很多情况下几行C语言代码就可以实现复杂的梯形图功能，特别是涉及数学运算的时候。

    SAMSOAR Developer提供的函数功能块，全面兼容标准C 语言(ANSI C89)。由于介绍C 语言的各种书籍非常多，资料容易找到，故本章不会详细介绍语法和基础知识，主要帮助复习下函数功能块设计有相关的基础。

本章将首先简要讲解C语言基本知识，及宏指令相关的使用，及注意事项。

C语言入门

C语言程序设计初步

函数功能块功能简介

库函数附录


如何启动宏指令功能进行程序设计

本节主要介绍宏指令基本功能，简要说明相关控件功能及如何使用。

进入宏指令设计的方式：

1、右键点击树形框中的 “函数功能块”弹出菜单 [image] ->选择 “添加函数功能块”->弹出如图1-1的编辑界面：

图1-1

或者选择 “添加库函数”->弹出如图1-2的界面：

图1-2

此界面显示的是库函数。不可编辑。然后点击确定进入如图1-3所示的编辑界面：

图1-3

也可以点击 [image] 按钮进入图1-2的界面选择如图1-4所示的库函数：

图1-4

2、若编辑完成，可点击 [image] 按钮进行编译，编译结果如图2-1和图2-2所示：

图2-1

图2-1这样表示程序无错误，编译通过。

图2-2

像图2-2这样表示程序有错误需要检查。

3、点击 [image] 可以将调试信息框隐藏或者显示。如图3-1：

图3-1


SamkoonSoar创建新工程

当工程设计人员需要新建一个工程时，将需要进行此操作。选择文件菜单中的新建命令或者选择工具栏菜单中的新建工程按钮 [image] ，SamkoonSoar将会弹出“新建工程对话框”，可以选择勾上设置工程名，然后选择存储工程的路径，并为该工程取一个名字，选择工程对应的PLC型号。点击确定完成新建工程进入图元编辑窗口，点击取消退出对话框。如图1-1：

图1-1

也可以直接选择好工程对应的PLC型号后点击确定进入图元编辑窗口。如图1-2：

图1-2


SamkoonSoar创建工程基本步骤

本章介绍创建新工程的基本步骤。

内容：

用SamkoonSoar创建一个新的工程


置位输出线圈 –(S)

对应命令 | 注释/说明 | 操作数（线圈）
SET | 置位输出线圈 | Y/M/S/T/C,K/H

指令说明：

指令置位从地址位（BIT）开始的（N）个线圈，最大点数根据操作数类型设定。

实例：

指令表：

LD X000

SET Y000 K16 //置位Y000~Y015

梯形图：


SamDraw 离线模拟

工程模拟

SamDraw5.0支持两种工程组态模拟方式：在线模拟与离线模拟，以帮助您更好的编辑与调试您的工程组态

您可以点击下方的链接进一步了解两种模拟方式的具体实现方法：

l 离线模拟

l 在线模拟


一维数值组

数组在程序设计中，为了处理方便， 把具有相同类型的若干变量按有序的形式组织起来。这些按序排列的同类数据元素的集合称为数组。在Ｃ语言中，数组属于构造数据类型。一个数组可以分解为多个数组元素，这些数组元素可以是基本数据类型或是构造类型。因此按数组元素的类型不同，数组又可分为数值数组、字符数组、指针数组、结构数组等各种类别。

    本章介绍数值数组和字符数组，其余的在以后各章陆续介绍。数组类型说明在Ｃ语言中使用数组必须先进行类型说明。数组说明的一般形

式为： 类型说明符数组名 [常量表达式]，……； 其中，类型说明符是任一种基本数据类型或构造数据类型。数组名是用户定义的数组标识符。 方括号中的常量表达式表示数据元素的个数，也称为数组的长度。

例如：

int a[10]； 说明整型数组a，有10个元素。

float b[10],c[20]； 说明实型数组b，有10个元素，实型数组c，有20个元素。

char ch[20]； 说明字符数组ch，有20个元素。

对于数组类型说明应注意以下几点：

1.数组的类型实际上是指数组元素的取值类型。对于同一个数组，其所有元素的数据类型都是相同的。

2.数组名的书写规则应符合标识符的书写规定。

3.数组名不能与其它变量名相同，例如：

void main()

{

int a；

float a[10]；

……

}是错误的。

4.方括号中常量表达式表示数组元素的个数，如a[5]表示数组a有5个元素。但是其下标从0开始计算。因此5个元素分别为a[0],a[1],a[2],a[3],a[4]。

5.不能在方括号中用变量来表示元素的个数， 但是可以是符号常数或常量表达式。例如：

#define FD 5

void main()

{

int a[3+2],b[7+FD]；

……

}

是合法的。但是下述说明方式是错误的。

void main()

{

int n=5；

int a[n]；

……

}

6.允许在同一个类型说明中，说明多个数组和多个变量。

例如： int a,b,c,d,k1[10],k2[20]；

1.数组元素的表示方法

    数组元素是组成数组的基本单元。数组元素也是一种变量，其标识方法为数组名后跟一个下标。 下标表示了元素在数组中的顺序号。数组元素的一般形式为：数组名[下标] 其中的下标只能为整型常量或整型表达式。如为小数时，C编译将自动取整。例如，a[5],a[i+j],a[i++]都是合法的数组元素。数组元素通常也称为下标变量。必须先定义数组， 才能使用下标变量。在Ｃ语言中只能逐个地使用下标变量，而不能一次引用整个数组。

    初始化赋值的一般形式为： static 类型说明符数组名[常量表达式]={值，值……值}； 其中static表示是静态存储类型，Ｃ语言规定只有静态存储数组和外部存储数组才可作初始化赋值(有关静态存储，外部存储的概念在第五章中介绍)。在{ }中的各数据值即为各元素的初值， 各值之间用逗号间隔。例如： static int a[10]={ 0,1,2,3,4,5,6,7,8,9 }； 相当于a[0]=0；a[1]=1...a[9]=9；

2.Ｃ语言对数组的初始赋值还有以下几点规定：

1.可以只给部分元素赋初值。当{ }中值的个数少于元素个数时，只给前面部分元素赋值。例如： static int a[10]={0,1,2,3,4}；表示只给a[0]～a[4]5个元素赋值，而后5个元素自动赋0值。

2.只能给元素逐个赋值，不能给数组整体赋值。 例如给十个元素全部赋1值，只能写为：static int a[10]={1,1,1,1,1,1,1,1,1,1}；而不能写为： static int a[10]=1；

3.如不给可初始化的数组赋初值，则全部元素均为0值。

4. 如给全部元素赋值，则在数组说明中， 可以不给出数组元素的个数。例如： static int a[5]={1,2,3,4,5}；可写为： static int a[]={1,2,3,4,5}；动态赋值可以在程序执行过程中，对数组作动态赋值。 这时可用循环语句配合scanf函数逐个对数组元素赋值。

3.字符数组

用来存放字符量的数组称为字符数组。 字符数组类型说明的形式与前面介绍的数值数组相同。例如： char c[10]；由于字符型和整型通用，也可以定义为int c[10]但这时每个数组元素占2个字节的内存单元。字符数组也可以是二维或多维数组，例如： char c[5][10]；即为二维字符数组。字符数组也允许在类型说明时作初始化赋值。例如： static char c[10]={`c`,` `,`p`,`r`,o`,g`,r`,`a`,`m`}；赋值后各元素的值为：数组C c[0]c[1]c[2]c[3]c[4]c [5]c[6]c[7]c[8]c[9]其中c[9]未赋值，由系统自动赋予0值。 当对全体元素赋初值时也可以省去长度说明。例如： static char c[]={`c`,` `,`p`,`r`,`o`,`g`,`r`,`a`,`m`}；这时C数组的长度自动定为9。

  Ｃ语言允许用字符串的方式对数组作初始化赋值。例如：

static char c[]={'c', ' ','p','r','o','g','r','a','m'}； 可写为：

static char c[]={"C program"}； 或去掉{}写为：sratic char c[]="C program"；

用字符串方式赋值比用字符逐个赋值要多占一个字节， 用于存放字符串结束标志'\0'。上面的数组c在内存中的实际存放情况为：C program\0`\0'是由C编译系统自动加上的。由于采用了`\0'标志，所以在用字符串赋初值时一般无须指定数组的长度，而由系统自行处理。在采用字符串方式后，字符数组的输入输出将变得简单方便。除了上述用字符串赋初值的办法外，还可用printf函数和scanf函数一次性输出输入一个字符数组中的字符串，而不必使用循环语句逐个地输入输出每个字符。


SamDraw 离线模拟

在线模拟

在线模拟可以使您在没有SA系列HMI的情况下，通过个人的计算机和plc等相关器件进行通讯。在使用该功能时个人计算机模拟触摸屏的运行状况，可以用来调试您组态软件是否正确，以及在触摸屏发生故障的时候进行相关测试工作。在使用在线模拟的时候，关于组态方面的操作请参照离线模拟。

在线模拟需要连接plc，在运行在线模拟时请确保连接plc与电脑的线缆可以正常通讯。在线模拟功能的使用时间为30分钟，在程序运行30分钟之后将会自动退出模拟。

在线模拟目前支持plc型号：MITSUBISHI(三菱)全系列、EMERSON(艾默生)全系列、OMRON(欧姆龙)全系列、SIEMENS(西门子)S7-200 PPI、MATSUSHITA(松下)系列、LG全系列、Fatek(永宏)系列、Haiwell(海为)全系列、THINGET(信捷)全系列、Techwayson(德维森)系列、Modbus RTU Mater。

要注意的是一般的plc在使用在线模拟时用到的线缆是下载线，即连接plc编程软件的线缆，非plc连接触摸屏的通讯线缆。如遇到不能通讯的时候请尽快联系技术支持。

在线模拟中，功能按钮只可以使用以下功能：“前一个配方”，“后一个配方”，“当前配方保存”，“更改用户等级”，“注销用户等级”和“触摸声音ON/OFF”。 工具栏上的“历史报警对话框”、“历史数据显示器”、“历史趋势图”、“定时器”和“宏指令”不能模拟。


基本运算符和表达式

运算符的种类、优先级和结合性

Ｃ语言中运算符和表达式数量之多， 在高级语言中是少见的。正是丰富的运算符和表达式使Ｃ语言功能十分完善。 这也是Ｃ语言的主要特点之一。

Ｃ语言的运算符不仅具有不同的优先级， 而且还有一个特点，就是它的结合性。在表达式中， 各运算量参与运算的先后顺序不仅要遵守运算符优先级别的规定，还要受运算符结合性的制约，以便确定是自左向右进行运算还是自右向左进行运算。这种结合性是其它高级语言的运算符所没有的，因此也增加了Ｃ语言的复杂性。

运算符的种类Ｃ语言的运算符可分为以下几类：

1.算术运算符

用于各类数值运算。包括加(+)、减(-)、乘(*)、除(/)、求余(或称模运算，%)、自增(++)、自减(--)共七种。

2.关系运算符

用于比较运算。包括大于(>)、小于(<)、等于(==)、大于等于(>=)、小于等于(<=)和不等于(!=)六种。

3.逻辑运算符

用于逻辑运算。包括与(&&)、或(||)、非(!)三种。

4.位操作运算符

参与运算的量，按二进制位进行运算。包括位与(&)、位或(|)、位非(~)、位异或(^)、左移(<<)、右移(>>)六种。

5.赋值运算符

用于赋值运算，分为简单赋值(=)、复合算术赋值(+=,-=,*=,/=,%=)和复合位运算赋值(&=,|=,^=,>>=,<<=)三类共十一种。

6.条件运算符

这是一个三目运算符，用于条件求值(?:)。

7.逗号运算符

用于把若干表达式组合成一个表达式(，)。

8.指针运算符

用于取内容(*)和取地址(&)二种运算。

9.求字节数运算符

用于计算数据类型所占的字节数(sizeof)。

10.特殊运算符

有括号()，下标[],等几种。


PLC参数设置

PLC参数设置主要分为通信参数设置、密码设置、滤波设置、保持区设置、型号修改5个部分，如图1-1所示：

图1-1

1 通信参数设置：包括串口设置，通信协议选择，站号设置和超时时间设置。点击 [image] 会恢复到系统默认值。如图1-2所示：

图1-2

2 密码设置： 包括上载加密，下载加密和监控加密。如图1-3所示：

图1-3

3 滤波设置： 主要包括是否使用滤波和设置滤波时间。如图1-4所示：

图1-4

4 保持区设置： 主要是断电保持区的设置。如图1-5所示：

图1-5

5 型号修改： 包括PLC选择，ＣＰＵ型号选择。如图１-６所示:

图１-６


PLC校验

单击菜单栏的在线->PLC校验命令或者直接单击工具栏上的 [image] PLC校验图标，会打开如图4-1的PLC校验对话框：

图4-1

点击“校验PLC”按钮，若此时上下位的工程不一致的话则会弹出图4-2的对话框：

图4-2

点击“是”按钮，程序将会上载PLC内容与当前工程进行比较，上载成功后会直接切换到指令比较窗口，如图4-3所示：

图4-3


PLC上载

单击菜单栏的在线->PLC读取命令或者直接单击工具栏上的 [image] PLC上载图标，会打开如图4-1的PLC上载对话框：

图4-1PLC上载对话框

1、“连接方式”处 [image] 可以选择使用USB或者COM口进行数据传输

2、“通信参数设置”处 [image] 设置只针对于COM口，可以选中自动检测或者手动配置COM的通信参数

3、“通信测试”按钮 [image] 单击该按钮可以检测是否与PLC连接成功

4、在“选择上载数据” [image] 中可以有选择的上载PLC中的内容，其中：

·选中“程序”，会上载PLC内运行的梯形图数据以及MODBUS指令表格等内容

·选中“注释”，会上载PLC内部的注释，注释不能单独上载，选中注释之后会默认选中程序

·选中“软元件表”,会上载PLC中的软元件初始化信息

·选中“配置信息”，会上载PLC中的配置信息


PLC下载

单击菜单栏的在线->PLC写入命令或者直接单击工具栏上的 [image] PLC下载图标，会打开如图4-1的PLC下载对话框：

图4-1PLC下载对话框

1、“连接方式”处 [image] 可以选择使用USB或者COM口进行数据传输

2、“通信参数设置”处 [image] 设置只针对于COM口，可以选中自动检测或者手动配置COM的通信参数

3、“通信测试”按钮 [image] 单击该按钮可以检测是否与PLC连接成功

4、在“选择下载数据” [image] 中可以将选择的内容下载到PLC中，其中：

·选中“程序”，会下载已经编译好的梯形图数据以及MODBUS指令表格等内容

·选中“注释”，会下载梯形图注释内容，注释不能单独下载，选中注释之后会默认选中下载梯形图程序

·选中“软元件表”,会下载软元件初始化信息

·选中“配置信息”，会下载PLC配置信息，如串口通信波特率等数据以及涉及到的上载下载监控密码、掉电保持区等内容


测试指令运行时间TEST（只供内部测试，不对外公开）


SAMSOAR Developer的运行

SAMSOAR Developer.exe在安装完成后，会在桌面上放置运行快捷方式，如图1-1所示：

图1-1 桌面快捷图标

同时Windows开始菜单中也添加了相应的SAMSOAR Developer程序，双击桌面上的快捷方式或已经保存的工程文件，或者单击开始菜单中SAMSOAR Developer程序组的SAMSOAR Developer.exe运行组态软件，运行界面如下图1-1：

图1-1 软件运行画面


SamkoonSoar对计算机的软件需求

SamkoonSoar组态软件可以在以下操作系统下运行：

1. 中、英文Microsoft Windows NT Server 4.0（需要安装SP3）或更高版本；

2. 中、英文Microsoft Windows NT Workstation 4.0（需要安装SP3）或更高版本；

3. 中、英文Microsoft Windows 98、Me、2000、 XP（Windows 95推荐安装IE5.0）或更高版本；

4. 中、英文Microsoft Windows VISTA系统 ；

5. 中、英文Microsoft Windows 7系统。

不满足以上版本的操作系统，SamkoonSoar将拒绝安装。

推荐系统：

推荐使用Windows XP SP2版本的操作系统。


小结

1.Ｃ的数据类型

基本类型，构造类型，指针类型，空类型

2.基本类型的分类及特点

类型说明符 　　　　　 字节　　 　　　　数值范围

字符型char 　　　　 　 1 　　 　　　　　C字符集

基本整型int 　　　　　 4 　　 　　　　　-214783648～214783647

短整型short 　　　 2 　 　　　　 　-32768～32767

长整型 long 　　 8 -922337203685477808～922337203685477807

无符号型 unsigned 　　 4　　 　　　　　 0～4294967295

无符号长整型 unsigned long 8　　 　　　 0～1844744073709551615

单精度实型 float 　　　 4　　 　　　　　3/4E-38～3/4E+38

双精度实型 double　　　 8　　　 　　　　1/7E-308～1/7E+308

3.常量后缀

L或l 长整型

U或u 无符号数

F或f 浮点数

4.常量类型

整数，长整数，无符号数，浮点数，字符，字符串，符号常数，转义字符。

5.数据类型转换

·自动转换

在不同类型数据的混合运算中，由系统自动实现转换， 由少字节类型向多字节类型转换。 不同类型的量相互赋值时也由系统自动进行转换，把赋值号右边的类型转换为左边的类型。

·强制转换

由强制转换运算符完成转换。

6.运算符优先级和结合性

一般而言，单目运算符优先级较高，赋值运算符优先级低。 算术运算符优先级较高，关系和逻辑运算符优先级较低。 多数运算符具有左结合性，单目运算符、三目运算符、赋值

7.表达式

表达式是由运算符连接常量、变量、函数所组成的式子。 每个表达式都有一个值和类型。 表达式求值按运算符的优先级和结合性所规定的顺序进行。

8.数组

1.数组是程序设计中最常用的数据结构。数组可分为数值数组(整数组，实数组)，字符数组以及后面将要介绍的指针数组，结构数组等。

2.数组可以是一维的，二维的或多维的。

3.数组类型说明由类型说明符、数组名、数组长度 (数组元素个数)三部分组成。数组元素又称为下标变量。 数组的类型是指下标变量取值的类型。

4.对数组的赋值可以用数组初始化赋值，输入函数动态赋值和赋值语句赋值三种方法实现。 对数值数组不能用赋值语句整体赋值、输入或输出，而必须用循环语句逐个对数组元素进行操作。


小结

1.从程序执行的流程来看， 程序可分为三种最基本的结构： 顺序结构，分支结构以及循环结构

2.程序中执行部分最基本的单位是语句。Ｃ语言的语句可分为五类：

(1)表达式语句　　 任何表达式末尾加上分号即可构成表达式语句，常用的表达式语句为赋值语句。

(2)函数调用语句　　由函数调用加上分号即组成函数调用语句。

(3)控制语句　　 用于控制程序流程，由专门的语句定义符及所需的表达式组成。主要有条件判断执行语句，循环执行语句，转向语句等。

(4)复合语句　　 由{}把多个语句括起来组成一个语句。复合语句被认为是单条语句，它可出现在所有允许出现语句的地方，如循环体等。

(5)空语句　　 仅由分号组成，无实际功能。

3.关系表达式和逻辑表达式是两种重要的表达式， 主要用于条件执行的判断和循环执行的判断。

4.Ｃ语言提供了多种形式的条件语句以构成分支结构。

(1)if语句主要用于单向选择。

(2)if-else语句主要用于双向选择。

(3)if-else-if语和switch语句用于多向选择。

这几种形式的条件语句一般来说是可以互相替代的。

5.Ｃ语言提供了三种循环语句。

(1)for语句主要用于给定循环变量初值， 步长增量以及循环次数的循环结构。

(2)循环次数及控制条件要在循环过程中才能确定的循环可用 while或do-while语句。

(3)三种循环语句可以相互嵌套组成多重循环。循环之间可以并列但不能交叉。

(4)可用转移语句把流程转出循环体外，但不能从外面转向循环体内。

(5)在循环程序中应避免出现死循环，即应保证循环变量的值在运行过程中可以得到修改，并使循环条件逐步变为假，从而结束循环。

6.Ｃ语言语句小结

名 称　　　　　　　一 般形 式

简单语句　　　　　表达式语句表达式；

空语句 ；

条件语句　　　　　if(表达式)语句；

                  if(表达式)语句1； else语句2；

                 if(表达式1)语句1； else if(表达式2) 语句2…else语句 n；

开关语句 　　　　 switch(表达式){ case常量表达式: 语句…default: 语句； }

循环语句　　　　 while语句

                 while(表达式)语句；

                  for语句 for(表达式1；表达式2；表达式3)语句；

                  break语句 break；

                  continue语句 continue；

                  return 语句 return(表达式)；


SamkoonSoar 系统构成


System demands of SAMSOAR Developer

1. Minimum hardware requirements of SAMSOAR Developer：

· At least Pentium 3-800MHz for a better performance; Pentium 4-1GHz and above is recommended.

· Minimum memory of 64M is required for Windows 98; Minimum memory of 128M is required for Windows 2000; 128M is required for Windows XP. Memory of 256M and above is recommended.

· It requires at least 50M hard-disk space to install SAMSOAR Developer; 100M of free disk space and above is recommended.

· Video card: Compatible with Windows system; with video memory of 1MB and above; compatible with a resolution of 1024*768 or above, 32-bit true colour

· Equipped with USB interface

· Two-key mouse and keyboard.

AMSOAR Developer may fail to install or run if the computer is equipped with lower configuration than above.

Recommended configuration：

· CPU：Equivalent to Pentium 800 of Intel or above;

· Memory：256M and above;

· Video card：Compatible with Windows system; with video memory of 1MB and above; compatible with a resolution of 1024*768 or above, 32-bit true colour Windows;

Hard disk：40G and above.

2. Operating system of SAMSOAR Developer：

· Microsoft Windows NT Server 4.0 (With SP3) or higher version in Chinese or English;

· Microsoft Windows NT Workstation 4.0 (With SP3) or higher version in Chinese or English;

· Microsoft Windows 98, Me, 2000, XP (IE 5.0 is recommended for Windows 95) or higher version in Chinese or English;

·Microsoft Windows VISTA System in Chinese or English;

·Microsoft Windows 7 System in Chinese or English;

AMSOAR Developer will fail to install if the operating system does not conform to any version above.

Recommended system:

Windows XP SP2

Hardware demands of SAMSOAR Developer

Software demands of SAMSOAR Developer


变量初值和类型转换

1.变量赋初值

在程序中常常需要对变量赋初值，以便使用变量。语言程序中可有多种方法，在定义时赋以初值的方法，这种方法称为初始化。在变量说明中赋初值的一般形式为：

类型说明符 变量1= 值1，变量2= 值2，……； 例如：

int a=b=c=5；

float x=3.2,y=3f,z=0.75；

char ch1='K',ch2='P'；

应注意，在说明中不允许连续赋值，如a=b=c=5是不合法的。

2.变量类型的转换

变量的数据类型是可以转换的。转换的方法有两种， 一种是自动转换，一种是强制转换。

自动转换

自动转换发生在不同数据类型的量混合运算时，由编译系统自动完成。自动转换遵循以下规则：

1.若参与运算量的类型不同，则先转换成同一类型，然后进行运算。

2.转换按数据长度增加的方向进行，以保证精度不降低。如int型和long型运算时，先把int量转成long型后再进行运算。

3.所有的浮点运算都是以双精度进行的，即使仅含float单精度量运算的表达式，也要先转换成double型，再作运算。

4.char型和short型参与运算时，必须先转换成int型。

5.在赋值运算中，赋值号两边量的数据类型不同时，赋值号右边量的类型将转换为左边量的类型。 如果右边量的数据类型长度左边长时，将丢失一部分数据，这样会降低精度，丢失的部分按四舍五入向前舍入。

3.强制类型转换

强制类型转换是通过类型转换运算来实现的。其一般形式为： (类型说明符) (表达式) 其功能是把表达式的运算结果强制转换成类型说明符所表示的类型。例如： (float) a 把a转换为实型(int)(x+y) 把x+y的结果转换为整型在使用强制转换时应注意以下问题：

1.类型说明符和表达式都必须加括号(单个变量可以不加括号)，如把(int)(x+y)写成(int)x+y则成了把x转换成int型之后再与y相加了。

2.无论是强制转换或是自动转换，都只是为了本次运算的需要而对变量的数据长度进行的临时性转换，而不改变数据说明时对该变量定义的类型。


操作案例（补充）

您可以在帮助文档中寻找到绝大部分功能的说明及使用方法，以下是为您补充的部分功能使用案例：

l 历史数据收集器

l 配方案例

l 数位报警案例

l 类比报警案例


SamDraw综述

Menu

SamDraw configuration software’s menu bar provides abundant options of menu. Almost all tool commands and edit commands required by configuration can be found in menu bar. Menu bar contains File menu, Edit menu, Drawing menu, Insert menu, Screen menu, Setup menu, Download menu, Help menu, as well as popup menu, as shown in Figure 2-25:

图2-25 菜单栏

Click the following links to get more detailed information about menu bar:

l File Menu

l Edit Menu

l View Menu

l Draw Menu

l Screen Menu

l Setup Menu

l Download Menu

l Help Menu

l Popup Menu


SA-3

SA-3.5/EA-3.5（经济型）

 | 主要技术参数
型号 | SA-3.5A | EA-3.5A
显示大小 | 3.5"(长:宽 = 4:3)
分辨率（像素） | 320×240
亮度 | 350cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 400 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
通信口 | USB,RS232,RS422, RS485
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 3W
SD卡 | N/A
内存 | 128M FLASH+64M DDR2 | 128M Flash/32M DDR2
CPU | 32-bit 400MHz RISC | ARM9 200MHz
静电等级 | 3级 ±6000V | 2级 +/-4KV
串行接口 | COM:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 96×81×47(mm)
开孔尺寸 | 93×77(mm)
重量 | 约0.2kg
组态软件 | SamDraw5.0


SA-4

SA-4.3/EA-4.3（经济型）

 | 主要技术参数
型号 | SA-4.3A | EA-4.3A
显示大小 | 4.3"(长:宽 = 16:9)
分辨率（像素） | 480×272
亮度 | 400cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 400 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 3W
SD卡 | N/A
内存 | 128M FLASH+64M DDR2 | 128M Flash/32M DDR2
CPU | 32-bit 400MHz RISC | ARM9 200MHz
静电等级 | 3级 ±6000V | 2级 +/-4KV
串行接口 | COM:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 138×86×39(mm)
开孔尺寸 | 132×80(mm)
重量 | 约0.2kg
组态软件 | SamDraw5.0


SK-5

SA-5.0A详细参数

 | 主要技术参数
型号 | SA-5.0A
显示大小 | 5.0"(长:宽 = 16:9)
分辨率 | 480×272
亮度 | 350cd/㎡
颜色 | 262,144色
对比度 | 400 : 1
COM口数目 | 1个
网口 | 1个
USB设备口 | 1个
USB主口 | 1个
SD卡 | 无
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
通信口 | USB,RS232,RS422, RS485
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 3W
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 165×130×39(mm)
开孔尺寸 | 157×95(mm)
重量 | 约0.2kg
组态软件 | SamDraw5.0


SA-4

SA-5.7详细参数

 | 主要技术参数
型号 | SA-5.7A | SA-5.7B | SA-5.7C | SA-5.7D | SA-5.7F
显示大小 | 5.7"(长:宽 = 16:9) |  |  | 5.7"(长:宽 = 4:3)
分辨率（像素） | 640×480 |  | 320×240 | 640×480 | 320×240
亮度 | 400cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 400 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 4W
SD卡 | N/A
内存 | 128M FLASH+128M DDR2
CPU | 32-bit 400MHz RISC
静电等级 | 3级 ±6000V
串行接口 | COM1:RS232/422/485 COM1:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 177×140×40(mm) |  |  | 203×145×42(mm)
开孔尺寸 | 163×133(mm) |  |  | 192×138(mm)
重量 | 约0.8kg
组态软件 | SamDraw5.0


SA-7详细参数

SA-7/EA-7详细参数

 | 主要技术参数
型号 | SA-7A |  | SA-7B | EA-7B
显示大小 | 7"(长:宽 = 16:9)
分辨率（像素） | 800×480
亮度 | 450cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 450 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 6W |  |  | 4.5W
SD卡 | N/A
内存 | 128M FLASH+128M DDR2 |  |  | 128M Flash/64M DDR2
CPU | 32-bit 400MHz RISC |  |  | ARM9 400MHz
静电等级 | 4级 ±8000V |  |  | 2级 +/-4KV
串行接口 | COM1:RS232/422/485 COM2:RS232/422/485 |  |  | COM:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 227×153×40 mm | 203×145×40 mm
开孔尺寸 | 210×144 mm | 192×138 mm
重量 | 约1.5kg
组态软件 | SamDraw5.0


SA-8详细参数

SA-8B详细参数

 | 主要技术参数
型号 | SA-8B
显示大小 | 8"(长:宽 = 4:3)
分辨率（像素） | 800×480
亮度 | 450cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 450 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 3W
SD卡 | N/A
内存 | 128M FLASH+128M DDR2
CPU | 32-bit 400MHz RISC
静电等级 | 4级 ±8000V
串行接口 | COM1:RS232/422/485 COM1:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 246×196×44(mm)
开孔尺寸 | 232×187(mm)
重量 | 约1.8kg
组态软件 | SamDraw5.0


SA-10

SA-10.2详细参数

 | 主要技术参数
型号 | SA-10.2A
显示大小 | 10.2"(长:宽 = 16:9)
分辨率（像素） | 800×480
亮度 | 500cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 450 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 6W
SD卡 | N/A
内存 | 128M FLASH+128M DDR2
CPU | 32-bit 400MHz RISC
静电等级 | 4级 ±8000V
串行接口 | COM1:RS232/422/485 COM2:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 275×210×44(mm)
开孔尺寸 | 259×201(mm)
重量 | 约2kg
组态软件 | SamDraw5.0


SA-12

SA-12.1详细参数

 | 主要技术参数
型号 | SA-12.1A
显示大小 | 12.1"(长:宽 = 4:3)
分辨率（像素） | 800×600
亮度 | 450cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 450 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 6W
SD卡 | N/A
内存 | 128M FLASH+128M DDR2
CPU | 32-bit 400MHz RISC
静电等级 | 4级 ±8000V
串行接口 | COM1:RS232/422/485 COM2:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 340×256×54(mm)
开孔尺寸 | 330×246(mm)
重量 | 约2.26kg
组态软件 | SamDraw5.0


SA-10

SA-10.4详细参数

 | 主要技术参数
型号 | SA-10.4A
显示大小 | 10.4"(长:宽 = 4:3)
分辨率（像素） | 800×600
亮度 | 500cd/㎡
颜色 | 262,144色
背光模块 | LED
对比度 | 450 : 1
背灯光寿命 | 60,000小时
触摸板 | 4线高精度触摸板
用户内存 | 12M
供电电源 | DC24V(±15%)
功耗 | 8W
SD卡 | N/A
内存 | 128M FLASH+128M DDR2
CPU | 32-bit 400MHz RISC
静电等级 | 4级 ±8000V
串行接口 | COM1:RS232/422/485 COM2:RS232/422/485
USB下载 | YES
U盘口 | N/A
以太网口 | N/A
CAN | N/A
防震度 | 10-25Hz(XYZ方向2G/30分钟)
CE认证 | 符合EN50022和EN50024标准
FCC兼容性 | 符合FCC,Class A
耐压测试 | 1000VAC,1分钟
防护等级 | IP65（前面板）
工作环境温度 | -10～65℃
工作环境湿度 | 10～90%RH
外壳塑料 | 工程塑料ABS+PC
外型尺寸 | 312×225×55 mm
开孔尺寸 | 285×212 mm
重量 | 约2.05kg
组态软件 | SamDraw5.0


SamDraw综述

工业环境

Samkoon系列触摸屏符合符合EN50022和EN50024标准，符合FCC,Class A，具有很强的抗干扰能力，符合工业环境的电磁兼容要求。


SamDraw综述

触摸屏原理

Samkoon SA系列触摸屏采用了强大的32位RISC微处理，功率消耗少，温升也少，机器不易发生故障和老化，提高了系统的可靠性。还包括了内存储器，外接系统程序存储器，电源电路模块，通讯模块，显示与触摸单元等。图1-11即为Samkoon SA系列触摸屏的结构原理图：

图1-11 SA系列触摸屏的结构原理图

1. CPU单元

采用32位RISC微处理，运算速度更快,功耗更小,运行更稳定。

2. 触摸板显示单元

SA-4.3A,SA-3.5A,EA-4.3A,EA-3.5A采用四线电阻式触摸板,SA-12.1A，SA-10.4A，SA-10.4B，SA-10.2SA，SA-8A，SA-8B，SA-7A，SA-7B，SA-5.7A，SA-5.7B，SA-5.7C，SA-5.7D，SA-5.7E，SA-5.7F, EA-7.0B采用5线电阻式触摸板,触摸精度准确，经久耐用，触摸寿命长。显示屏为TFT LCD,26万色真彩显示。

3. 通讯模块

采用抗干扰，防高压，雷击的设计，增强了通信的准确性和可靠性，支持RS232，485，422通信。

4. 存储单元

采用断电保持的FLASH作为ROM，存取速度快， 所有型号的容量达到64M；

其中SA-4.3A，SA-3.5A，SA-5.7C，SA-5.7F,EA-4.3A,EA-3.5A的RAM容量为64M；

SA-5.7A，SA-5.7B，SA-5.7D，SA-5.7E，SA-7A，SA-7B，SA-8A，SA-8B，SA-10.2A，SA-10.4A，SA-10.4B，SA-12.1A, EA-7.0B的RAM容量为128M。

5. 电源模块

采取高精度开关稳压电源，功耗小。


SamDraw综述

型号与描述

Samkoon SA系列触摸屏目前有以下型号：

产品型号 | LCD分辨率 | LCD尺寸(英寸)
SA-12.1A | 800*600 | 12.1
SA-10.4A | 800*600 | 10.4
SA-10.2A | 800*480 | 10.2
SA-8A | 640*480 | 8.0
SA-8B | 800*600 | 8.0
SA-7A | 800*480 | 7.0
SA-7B | 800*480 | 7.0
SA-5.7A | 640*480 | 5.7
SA-5.7B | 640*480 | 5.7
SA-5.7C | 320*234 | 5.7
SA-5.7D | 640*480 | 5.7
SA-5.7E | 640*480 | 5.7
SA-5.7F | 320*234 | 5.7
SA-5A | 480*272 | 5.0
SA-4.3A | 280*272 | 4.3
SA-3.5A | 320*240 | 4.3
EA-7B | 800*480 | 7．0
EA-4.3A | 480*272 | 4.3
EA-3.5A | 320*240 | 3.5

详细的参数请参阅技术参数


SamDraw综述

安装尺寸

下面详细的介绍Samkoon SA系列的安装尺寸，请用户按照图像所标注的尺寸开孔安装，避免造成触摸屏损坏。

l SA-12.1A

l SA-10.4A

l SA-10.2A

l SA-8A

l SA-8B

l SA-7A

l SA-7B

l SA-5.7A

l SA-5.7B

l SA-5.7C

l SA-5.7D

l SA-5.7E

l SA-5.7F

l SA-5A

l SA-4.3A

l SA-3.5A

l EA-7.0B

l EA-4.3A

l EA-3.5A


SamDraw综述

SamDraw触摸屏结构

Samkoon触摸屏的整个结构由显示区域，指示灯，电源，通信口组成。所有型号的触摸屏颜色采用工业设计标准，耐脏，适合工厂恶劣的环境使用，前面板配备了指示灯，用于判断设备故障。电源和通信口均放在触摸屏的底部，符合设计标准。


技术参数

SA/EA 产品硬件技术参数

该表列出了SA全系列产品的主要技术参数，请点击您要查询的产品型号：

类型

SA-3.5A/EA-3.5A

SA-4.3A/EA-4.3A

SA-5A

SA-5.7A/SA-5.7B/SA-5.7C/SA-5.7D/SA-5.7E/SA-5.7F

SA-7A/SA-7B/EA-7.0B

SA-8A/SA-8B

SA-10.2A

SA-10.4A/SA-10.4B

SA-12.1A


SamDraw综述

接线

Samkoon SA系列触摸屏在使用的时候，需要DC 24V直流电源供电，与PLC和PC的连接可按图1-12所示来连接：

图1-12 SA系列触摸屏连接图

连接PC使用USB电缆，会随产品一起配送。


SK-5

SA-5A安装尺寸

图1-5是SA-5A型号的产品尺寸(mm)：

外型尺寸：165×103×39

安装开孔尺寸：157×95

图1-5 SA-5A 安装尺寸


SamDraw综述

SA-3.5A/EA-3.5A 安装尺寸

图1-6是SA-3.5A、EA-3.5A型号的产品尺寸(mm)：

外型尺寸：96×81×47

安装开孔尺寸：93×77

图1-6 SA-3.5、EA-3.5A 安装尺寸

* 实际尺寸以实物为准


SamDraw综述

SA-4.3A/EA-4.3A 安装尺寸

图1-5是SA-4.3A、EA-4.3A型号的产品尺寸(mm)：

外型尺寸：138×86×39

安装开孔尺寸：132×80

图1-5 SA-4.3、EA-4.3A 安装尺寸

* 实际尺寸以实物为准


SamDraw综述

SA-5.7安装尺寸

图1-4是SA-5.7A/SA-5.7B/SA-5.7C型号的产品尺寸(mm)：

外型尺寸：176×140×40

安装开孔尺寸：163×133

图1-4 SA-5.7A/SA-5.7B/SA-5.7C 安装尺寸

图1-9是SA-5.7D/SA-5.7E/SA-5.7F型号的产品尺寸(mm)：

外型尺寸：202×144×42

安装开孔尺寸：192×138

图1-9 SA-5.7D/SA-5.7E/SA-5.7F 安装尺寸

* 实际尺寸以实物为准


SamDraw综述

SA-8/EA-8 安装尺寸

图1-3是SA-7A型号的产品尺寸(mm)：

外型尺寸：227×153×40

安装开孔尺寸：210×144

图1-3 SA-7A安装尺寸

图1-8是SA-7B、EA-7.0B型号的产品尺寸(mm)：

外型尺寸：203×145×40

安装开孔尺寸：192×138

图1-8 SA-7B、EA-7.0B 安装尺寸

* 实际尺寸以实物为准


SamDraw综述

SA-8安装尺寸

图1-2是SA-8A/SA-8B型号的产品尺寸(mm)：

外型尺寸：246×196×44

安装开孔尺寸：232×187

图1-2 SA-8A/SA-8B 安装尺寸

* 实际尺寸以实物为准


SA-10

SA-10.2A安装尺寸

图1-10是SA-10.2A型号的产品尺寸(mm)：

外型尺寸：275×210×44

安装开孔尺寸：260×202

图1-10 SA-10.2A 安装尺寸

* 实际尺寸以实物为准


SamDraw综述

SA-10.4安装尺寸

图1-1是SA-10.4A/SA-10.4B型号的产品尺寸(mm)：

外型尺寸：312×225×54

安装开孔尺寸：285×212

图1-1 SA-10.4 安装尺寸

* 实际尺寸以实物为准


SA-12.1

SA-12.1A安装尺寸

图1-7是SA-12.1型号的产品尺寸(mm)：

外型尺寸：340×256×54

安装开孔尺寸：330×246

图1-7 SA-12.1安装尺寸

* 实际尺寸以实物为准


SamDraw综述

触摸屏前面板

图1-8为Samkoon SA系列触摸屏的前面板视图，包括显示屏和运行指示灯两个部分：

图1-8 SA系列前板面


SamDraw综述

通信接口

触摸屏的通讯口位于底面板内。型号SA-12.1A，SA-10.4A，SA-10.4B，SA-8A，SA-8B，SA-7A，SA-5.7A，SA-5.7B，SA-5.7C，EA-7.0B都提供了2个标准串行通讯口，SA-4.3A，SA-3.5A，EA-4.3A, EA-3.5A都提供了1个标准串行通讯口，采用9芯针型D型口，该口用于与PLC或者其他的控制器连接，并进行通讯。当采用屏蔽电缆时，RS232的通讯距离不要超过15米。与计算机连接的通讯提供一个USB通讯口，用于下载组态，速度可达10Mbps（SA-5.7A，SA-5.7B，SA-5.7C提供2个USB通讯口）采用的USB接口是B型母口（SA-5.7A，SA-5.7B，SA-5.7C提供1个B型母口和一个A型母口）。连接不同的PLC时，通讯口的定义不同（需在定货时指定连接的PLC的类型以方便配送通讯电缆）。图1-9中配备了双串口和USB口-B型母口：

图1-9 SA系列侧面板


SamDraw综述

运行状态指示灯

触摸屏的运行状态指示灯包括电源（PWR），运行（RUN），通讯（COM）三个指示灯，如右图1-10所示。触摸屏通电时电源指示灯（PWR）是常亮的绿色，触摸屏CPU工作正常时运行指示灯（RUN）是常亮的黄色，CPU故障时，运行指示灯（RUN）不亮。当已经连接上PLC时，通讯指示灯（COM）是闪烁的黄色。下表1-1各个工作状态时三个LED灯的显示状态：

图1-10 SA系列运行指示灯

设备状态 | 绿灯LED（PWR） | 黄灯LED（RUN） | 黄灯LED（COM）
无电源 | ○ | ○ | ○
电源接通 | ● |  |
CPU工作正常 | ● | ● |
与连接设备发生通讯 | ● | ● | ※
○：LED灭 ●：LED亮 ※：LED闪烁

表1-1


SamDraw综述

电源模块

Samkoon SA系列触摸屏的电源接口位于背面板内，采用DC24V电源(±15%)，采用了隔离电源输入，有效的屏蔽了干扰，增强了整个系统的抗干扰性能。图1-7为电源视图：

图1-7 电源模块


附录一

1. ADDSUM

[Description]

Use addition to calculate checksum.

[Usage]

checksum=ADDSUM(data, sizeof(data));

[Example]

char data[5] = {0x1, 0x2, 0x3, 0x4, 0x20};

int checksum;

checksum=ADDSUM(data, 5);// checksum=0x2a;

2. ASCII2DEC

[Description]

Convert a string to a decimal value.

[Usage]

result=ASCII2DEC(source , sizeof(source))；

[Example]

char source[4] = {'2', '3', '4', '5'}；

short result；

result=ASCII2DEC(source , 4)；// result=2345

3. ASCII2FLOAT

[Description]

Convert a string to a floating value.

[Usage]

result=ASCII2FLOAT(source,sizeof(source))；

[Example]

char source[4] = {'5', '.', '7', '8'}；

float result；

result=ASCII2FLOAT(source,4)；// result = 5.78

4. ASCII2HEX

[Description]

Convert a string to a hexadecimal value.

[Usage]

result=ASCII2HEX(source,sizeof(source))；

[Example]

char source[5] = {'1','6','3','4'}；

short result；

result=ASCII2HEX(source,4)；// result = 0x1634

5. BCD2BIN

[Description]

Convert a BCD value to a BIN value.

[Usage]

result=BCD2BIN(source)；

[Example]

short source = 0x2648；

short result；

result=BCD2BIN(source)；// result = 2468

6. BIN2BCD

[Description]

Convert a binary value to a BCD value.

[Usage]

result=BIN2BCD(source)；

[Example]

short source = 1234；

short result；

result=BIN2BCD(source)；// result = 0x1234

7. CRC

[Description]

Get 16-bit CRC.

[Usage]

bit_CRC=CRC(source,sizeof(source))；

[Example]

char source[5] = {0x1, 0x2, 0x3, 0x4, 0x5}；

short bit_CRC；

bit_CRC=CRC(source,5)；

8. DEC2ASCII

[Description]

Convert a decimal value to a string.

[Usage]

result= DEC2ASCII(source,sizeof(source))；

[Example]

short source = 5678；

char *result；

result= DEC2ASCII(source,4)；

// result[0] == '5', result[1] == '6', result[2] == '7', result[3] == '8

9. FLOAT2ASCII

[Description]

Convert a floating value to a string.

[Usage]

result=FLOAT2ASCII(value,array);

[Example]

float source = 56.8; unsigned char *array;

unsigned char result;

result=FLOAT2ASCII(value,array);

//array[0] = '5',array[1] = '6',array[2] = '.',array[3] = '8';

10. GETBIT

[Description]

Get bit value.

[Usage]

GETBIT(source, result);

[Example]

short source = 0x5, bit_pos = 0 ,result；

result = GETBIT(source,bit_pos)；// result == 1

11. GETCHARS //该函数仅适用于自由口通信

[Description]

Get data from communication port.

PortID--Serial Port ID,COM1=0, COM2=1

Success return 1, fail return 0

[Usage]

GETCHARS(PortID, Data)；

[Example]

char Data[20]；

int checksum,PortID,Result;

PortID=0;

Result=GETCHARS(PortID,Data);

12. HEX2ASCII

[Description]

Convert a hexadecimal value to a string.

[Usage]

HEX2ASCII(source, result[start])；

[Example]

short source = 0x5678；

char *result；

result = HEX2ASCII(source)；

//result[0] = '5', result[1] = '6', result[2] = '7', result[3] = '8'

13. HIBYTE

[Description]

Retrieve the high byte from the low word of a specified value.

[Usage]

result=HIBYTE(source)；

[Example]

short source = 0x1234,result；

result=HIBYTE(source)；// result = 0x12

14. HIWORD

[Description]

Retrieve the high word from the specified value.

[Usage]

result=HIWORD(source)；

[Example]

int source = 0x45232568,result；

result=HIWORD(source)；// result = 0x1234

15. INVBIT

[Description]

Set specific bit to be inversed (ON->OFF, OFF->ON).

[Usage]

INVBIT(source, result);

[Example]

short source = 0x6, bit_pos =1 ,result；

result=INVBIT(source, bit_pos)；// result = 4

16. LOBYTE

[Description]

Retrieve the low byte from the specified value.

[Usage]

result=LOBYTE(source)；

[Example]

short source = 0x1234,result；

result= LOBYTE(source)；// result = 0x34

17. LOWORD

[Description]

Retrieve the low word from the specified value.

[Usage]

result=LOWORD(source)；

[Example]

int source = 0x12345678,result；

result=LOWORD(source)；// result == 0x5678

18. PUTCHARS //该函数仅适用于自由口通信

[Description]

Send data to communication port.

PortID--Serial Port ID,COM1=0, COM2=1

[Usage]

PUTCHARS(PortID, Data, Length)；

[Example]

unsigned char Data[5] = {0x02, 0x30, 0x31, 0x4d, 0x5e}；

int Length,checksum,PortID；

Length=5；

PortID=0；

PUTCHARS(PortID,Data, Length)；

19. SWAPB

[Description]

Swap the low byte and high byte of the specified value.

[Usage]

result=SWAPB(source)；

[Example]

short source = 0x1234,result；

result=SWAPB(source)；// result = 0x3412

20. SWAPW

[Description]

Swap the low word and high word of the specified value.

[Usage]

result=SWAPW(source)；

[Example]

int source = 0x12345678, ；

int result；

result=SWAPW(source)；// result = 0x56781234

21. SETBIT

[Description]

Set specific bit to be ON or OFF.

[Usage]

result = SETBIT(source,bit_pos,1)；

[Example]

short source = 0x4；

short bit_pos = 2, result；

result = SETBIT(source,bit_pos,1)；// result = 1

22. XORSUM

[Description]

Use XOR to calculate checksum.

[Usage]

checksum = XORSUM(source, sizeof(source));

[Example]

char source[5] = {0x1, 0x20, 0x3, 0x48, 0x5};

short checksum;

checksum = XORSUM(source, 5); / ecksum =0x6f;

23. DELAY

[Description]

This command tells the system to sleep the specified amount of time.

[Usage]

DELAY(source);

[Example]

int source;

DELAY(source);

24. GETBUFFERLENGTH
//该函数仅适用于自由口通信
[Description]
Get buffer length from communication port.
PortID--Serial Port ID,COM1=0, COM2=1，
Success return bufferlength, fail return -1.
[Usage]
GETBUFFERLENGTH(PortID);
[Example]
int bufferlen,PortID;
PortID=0;
bufferlen=GETBUFFERLENGTH(PortID).

25. CLEARBUFFER //该函数仅适用于自由口通信
[Description]
 Clear buffer of communication port.
PortID--Serial Port ID,COM1=0, COM2=1
Success return 1, fail return 0
[Usage]
 CLEARBUFFER(PortID);
[Example]
 int Clearresult,PortID;
PortID=0;
Clearresult=GETBUFFERLENGTH(PortID);

注意：宏指令程序在编写的时候请勿陷入死循环，否则会影响触摸屏主程序的运行，并可能造成需要返厂维修。


一维数值组

数组在程序设计中，为了处理方便， 把具有相同类型的若干变量按有序的形式组织起来。这些按序排列的同类数据元素的集合称为数组。在Ｃ语言中， 数组属于构造数据类型。一个数组可以分解为多个数组元素，这些数组元素可以是基本数据类型或是构造类型。因此按数组元素的类型不同，数组又可分为数值数组、字符数组、指针数组、结构数组等各种类别。

    本章介绍数值数组和字符数组，其余的在以后各章陆续介绍。数组类型说明 在Ｃ语言中使用数组必须先进行类型说明。数组说明的一般形

式为： 类型说明符 数组名 [常量表达式]，……； 其中，类型说明符是任一种基本数据类型或构造数据类型。 数组名是用户定义的数组标识符。 方括号中的常量表达式表示数据元素的个数，也称为数组的长度。

例如：

int a[10]； 说明整型数组a，有10个元素。

float b[10],c[20]； 说明实型数组b，有10个元素，实型数组c，有20个元素。

char ch[20]； 说明字符数组ch，有20个元素。

对于数组类型说明应注意以下几点：

1.数组的类型实际上是指数组元素的取值类型。对于同一个数组，其所有元素的数据类型都是相同的。

2.数组名的书写规则应符合标识符的书写规定。

3.数组名不能与其它变量名相同，例如：

void main()

{

int a；

float a[10]；

……

}是错误的。

4.方括号中常量表达式表示数组元素的个数，如a[5]表示数组a有5个元素。但是其下标从0开始计算。因此5个元素分别为a[0],a[1],a[2],a[3],a[4]。

5.不能在方括号中用变量来表示元素的个数， 但是可以是符号常数或常量表达式。例如：

#define FD 5

void main()

{

int a[3+2],b[7+FD]；

……

}

是合法的。但是下述说明方式是错误的。

void main()

{

int n=5；

int a[n]；

……

}

6.允许在同一个类型说明中，说明多个数组和多个变量。

例如： int a,b,c,d,k1[10],k2[20]；

1.数组元素的表示方法

    数组元素是组成数组的基本单元。数组元素也是一种变量， 其标识方法为数组名后跟一个下标。 下标表示了元素在数组中的顺序号。数组元素的一般形式为：数组名[下标] 其中的下标只能为整型常量或整型表达式。如为小数时，C编译将自动取整。例如，a[5],a[i+j],a[i++]都是合法的数组元素。数组元素通常也称为下标变量。必须先定义数组， 才能使用下标变量。在Ｃ语言中只能逐个地使用下标变量， 而不能一次引用整个数组。

    初始化赋值的一般形式为： static 类型说明符数组名[常量表达式]={值，值……值}； 其中static表示是静态存储类型， Ｃ语言规定只有静态存储数组和外部存储数组才可作初始化赋值(有关静态存储，外部存储的概念在第五章中介绍)。在{ }中的各数据值即为各元素的初值， 各值之间用逗号间隔。例如： static int a[10]={ 0,1,2,3,4,5,6,7,8,9 }； 相当于a[0]=0；a[1]=1...a[9]=9；

2.Ｃ语言对数组的初始赋值还有以下几点规定：

1.可以只给部分元素赋初值。当{ }中值的个数少于元素个数时，只给前面部分元素赋值。例如： static int a[10]={0,1,2,3,4}；表示只给a[0]～a[4]5个元素赋值，而后5个元素自动赋0值。

2.只能给元素逐个赋值，不能给数组整体赋值。 例如给十个元素全部赋1值，只能写为：static int a[10]={1,1,1,1,1,1,1,1,1,1}；而不能写为： static int a[10]=1；

3.如不给可初始化的数组赋初值，则全部元素均为0值。

4. 如给全部元素赋值，则在数组说明中， 可以不给出数组元素的个数。例如： static int a[5]={1,2,3,4,5}；可写为： static int a[]={1,2,3,4,5}；动态赋值可以在程序执行过程中，对数组作动态赋值。 这时可用循环语句配合scanf函数逐个对数组元素赋值。

3.字符数组

用来存放字符量的数组称为字符数组。 字符数组类型说明的形式与前面介绍的数值数组相同。例如： char c[10]；由于字符型和整型通用，也可以定义为int c[10]但这时每个数组元素占2个字节的内存单元。字符数组也可以是二维或多维数组，例如： char c[5][10]；即为二维字符数组。 字符数组也允许在类型说明时作初始化赋值。例如： static char c[10]={`c`,` `,`p`,`r`,o`,g`,r`,`a`,`m`}；赋值后各元素的值为：数组C c[0]c[1]c[2]c[3]c[4]c [5]c[6]c[7]c[8]c[9]其中c[9]未赋值，由系统自动赋予0值。 当对全体元素赋初值时也可以省去长度说明。例如： static char c[]={`c`,` `,`p`,`r`,`o`,`g`,`r`,`a`,`m`}；这时C数组的长度自动定为9。

  Ｃ语言允许用字符串的方式对数组作初始化赋值。例如：

static char c[]={'c', ' ','p','r','o','g','r','a','m'}； 可写为：

static char c[]={"C program"}； 或去掉{}写为：sratic char c[]="C program"；

用字符串方式赋值比用字符逐个赋值要多占一个字节， 用于存放字符串结束标志'\0'。上面的数组c在内存中的实际存放情况为：C program\0`\0'是由C编译系统自动加上的。由于采用了`\0'标志，所以在用字符串赋初值时一般无须指定数组的长度，而由系统自行处理。在采用字符串方式后，字符数组的输入输出将变得简单方便。 除了上述用字符串赋初值的办法外，还可用printf函数和scanf函数一次性输出输入一个字符数组中的字符串， 而不必使用循环语句逐个地输入输出每个字符。


基本运算符和表达式

运算符的种类、优先级和结合性

Ｃ语言中运算符和表达式数量之多， 在高级语言中是少见的。正是丰富的运算符和表达式使Ｃ语言功能十分完善。 这也是Ｃ语言的主要特点之一。

Ｃ语言的运算符不仅具有不同的优先级， 而且还有一个特点，就是它的结合性。在表达式中， 各运算量参与运算的先后顺序不仅要遵守运算符优先级别的规定，还要受运算符结合性的制约，以便确定是自左向右进行运算还是自右向左进行运算。 这种结合性是其它高级语言的运算符所没有的，因此也增加了Ｃ语言的复杂性。

运算符的种类Ｃ语言的运算符可分为以下几类：

1.算术运算符

用于各类数值运算。包括加(+)、减(-)、乘(*)、除(/)、求余(或称模运算，%)、自增(++)、自减(--)共七种。

2.关系运算符

用于比较运算。包括大于(>)、小于(<)、等于(==)、 大于等于(>=)、小于等于(<=)和不等于(!=)六种。

3.逻辑运算符

用于逻辑运算。包括与(&&)、或(||)、非(!)三种。

4.位操作运算符

参与运算的量，按二进制位进行运算。包括位与(&)、位或(|)、位非(~)、位异或(^)、左移(<<)、右移(>>)六种。

5.赋值运算符

用于赋值运算，分为简单赋值(=)、复合算术赋值(+=,-=,*=,/=,%=)和复合位运算赋值(&=,|=,^=,>>=,<<=)三类共十一种。

6.条件运算符

这是一个三目运算符，用于条件求值(?:)。

7.逗号运算符

用于把若干表达式组合成一个表达式(，)。

8.指针运算符

用于取内容(*)和取地址(&)二种运算。

9.求字节数运算符

用于计算数据类型所占的字节数(sizeof)。

10.特殊运算符

有括号()，下标[],等几种。


分支结构程序

分支结构的程序

关系运算符和表达式

在程序中经常需要比较两个量的大小关系， 以决定程序下一步的工作。比较两个量的运算符称为关系运算符。 在Ｃ语言中有以下关系运算符：

< 小于

<= 小于或等于

> 大于

>= 大于或等于

== 等于

!= 不等于

关系运算符都是双目运算符，其结合性均为左结合。 关系运算符的优先级低于算术运算符，高于赋值运算符。在六个关系运算符中，<,<=,>,>=的优先级相同，高于==和!=，==和!=的优先级相同。

关系表达式

关系表达式的一般形式为： 表达式 关系运算符 表达式 例如：a+b>c-d,x>3/2,'a'+1<c,-i-5*j==k+1；都是合法的关系表达式。由于表达式也可以又是关系表达式。因此也允许出现嵌套的情况，例如：a>(b>c),a!=(c==d)等。关系表达式的值是“真”和“假”，用“1”和“0”表示。

1.逻辑运算符和表达

逻辑运算符Ｃ语言中提供了三种逻辑运算符 && 与运算　|| 或运算　! 非运算 与运算符&&和或运算符||均为双目运算符。具有左结合性。 非

运算符!为单目运算符，具有右结合性。逻辑运算符和其它运算符优先级的关系可表示如下：

按照运算符的优先顺序可以得出：

a>b && c>d等价于(a>b) && (c>d)

!b==c||d<a等价于((!b)==c)||(d<a)

a+b>c && x+y<b等价于((a+b)>c) && ((x+y)<b)

逻辑运算的值

逻辑运算的值也为“真”和“假”两种，用“1”和“0 ”来表示。其求值规则如下：

1.与运算&&参与运算的两个量都为真时，结果才为真，否则为假。例如，5>0 && 4>2,由于5>0为真，4>2也为真，相与的结果也为真。

2.或运算||参与运算的两个量只要有一个为真，结果就为真。两个量都为假时，结果为假。例如：5>0||5>8,由于5>0为真，相或的结果也就为真

3.非运算!参与运算量为真时，结果为假；参与运算量为假时，结果为真。

例如：!(5>0)的结果为假。

虽然Ｃ编译在给出逻辑运算值时，以“1”代表“真”，“0 ”代表“假”。 但反过来在判断一个量是为“真”还是为“假”时，以“0”代表“假”，以非“0”的数值作为“真”。例如：由于5和3均为非“0”因此5&&3的值为“真”，即为1。

又如：5||0的值为“真”，即为1。

逻辑表达式逻辑表达式的一般形式为： 表达式 逻辑运算符 表达式 其中的表达式可以又是逻辑表达式，从而组成了嵌套的情形。例如：(a&&b)&&c根据逻辑运算符的左结合性，上式也可写为： a&&b&&c 逻辑表达式的值是式中各种逻辑运算的最后值，以“1”和“0”分别代表“真”和“假”。

2.if语句

用if语句可以构成分支结构。它根据给定的条件进行判断， 以决定执行某个分支程序段。Ｃ语言的if语句有三种基本形式。

1.第一种形式为基本形式 if(表达式) 语句； 其语义是：如果表达式的值为真，则执行其后的语句， 否则不执行该语句。

3.第二种形式为if-else形式

if(表达式)

语句1；

else

语句2；

其语义是：如果表达式的值为真，则执行语句1，否则执行语句2 。

输入两个整数，输出其中的大数。改用if-else语句判别a,b的大小，若a大，则输出a，否则输出b。

3.第三种形式为if-else-if形式

前二种形式的if语句一般都用于两个分支的情况。当有多个分支选择时，可采用if-else-if语句，其一般形式为：

if(表达式1)

语句1；

else if(表达式2)

语句2；

else if(表达式3)

语句3；

…

else if(表达式m)

语句m；

else

语句n；

其语义是：依次判断表达式的值，当出现某个值为真时， 则执行其对应的语句。然后跳到整个if语句之外继续执行程序。 如果所有的表达式均为假，则执行语句n 。 然后继续执行后续程序。

在使用if语句中还应注意以下问题

(1) 在三种形式的if语句中，在if关键字之后均为表达式。 该表达式通常是逻辑表达式或关系表达式， 但也可以是其它表达式，如赋值表达式等，甚至也可以是一个变量。例如： if(a=5) 语句；if(b) 语句； 都是允许的。只要表达式的值为非0，即为“真”。如在if(a=5)…；中表达式的值永远为非0，所以其后的语句总是要执行的，当然这种情况在程序中不一定会出现，但在语法上是合法的。

又如，有程序段：

if(a=b)

printf("%d",a)；

else

printf("a=0")； 本语句的语义是，把b值赋予a，如为非0则输出该值，否则输出“a=0”字符串。这种用法在程序中是经常出现的。

(2) 在if语句中，条件判断表达式必须用括号括起来，在语句之后必须加分号。

(3) 在if语句的三种形式中，所有的语句应为单个语句，如果要想在满足条件时执行一组(多个)语句，则必须把这一组语句用{} 括起来组成一个复合语句。但要注意的是在}之后不能再加分号。

例如：

if(a>b){

a++；

b++；

}

else{ a=0；

b=10；

}

4.条件运算符和条件表达式

如果在条件语句中，只执行单个的赋值语句时， 常可使用条件表达式来实现。不但使程序简洁，也提高了运行效率。

条件运算符为?和：，它是一个三目运算符，即有三个参与运算的量。由条件运算符组成条件表达式的一般形式为：

表达式1? 表达式2： 表达式3

其求值规则为：如果表达式1的值为真，则以表达式2 的值作为条件表达式的值，否则以表达式2的值作为整个条件表达式的值。 条件表达式通常用于赋值语句之中。

例如条件语句：

if(a>b) max=a；

else max=b；

可用条件表达式写为 max=(a>b)?a:b；执行该语句的语义是：如a>b为真，则把a赋予max，否则把b 赋予max。

使用条件表达式时，还应注意以下几点：

1. 条件运算符的运算优先级低于关系运算符和算术运算符，但高于赋值符。因此 max=(a>b)?a:b可以去掉括号而写为 max=a>b?a:b

2. 条件运算符?和：是一对运算符，不能分开单独使用。

3. 条件运算符的结合方向是自右至左。


break语句

break语句只能用在switch 语句或循环语句中， 其作用是跳出switch语句或跳出本层循环，转去执行后面的程序。由于break语句的转移方向是明确的，所以不需要语句标号与之配合。break语句的一般形式为： break； 上面例题中分别在switch语句和for语句中使用了break 语句作为跳转。使用break语句可以使循环语句有多个出口，在一些场合下使编程更加灵活、方便。


小结

1.Ｃ的数据类型

基本类型，构造类型，指针类型，空类型

2.基本类型的分类及特点

类型说明符 　　　　　 字节　　 　　　　数值范围

字符型char 　　　　 　 1 　　 　　　　　C字符集

基本整型int 　　　　　 4 　　 　　　　　-214783648～214783647

短整型short int 　　　 4 　 　　　　 　-214783648～214783647

长整型 long int 　　 8 -922337203685477808～922337203685477807

无符号型 unsigned 　　 4　　 　　　　　 0～4294967295

无符号长整型 unsigned long 8　　 　　　 0～1844744073709551615

单精度实型 float 　　　 4　　 　　　　　3/4E-38～3/4E+38

双精度实型 double　　　 8　　　 　　　　1/7E-308～1/7E+308

3.常量后缀

L或l 长整型

U或u 无符号数

F或f 浮点数

4.常量类型

整数，长整数，无符号数，浮点数，字符，字符串，符号常数，转义字符。

5.数据类型转换

·自动转换

在不同类型数据的混合运算中，由系统自动实现转换， 由少字节类型向多字节类型转换。 不同类型的量相互赋值时也由系统自动进行转换，把赋值号右边的类型转换为左边的类型。

·强制转换

由强制转换运算符完成转换。

6.运算符优先级和结合性

一般而言，单目运算符优先级较高，赋值运算符优先级低。 算术运算符优先级较高，关系和逻辑运算符优先级较低。 多数运算符具有左结合性，单目运算符、三目运算符、赋值

7.表达式

表达式是由运算符连接常量、变量、函数所组成的式子。 每个表达式都有一个值和类型。 表达式求值按运算符的优先级和结合性所规定的顺序进行。

8.数组

1.数组是程序设计中最常用的数据结构。数组可分为数值数组(整数组，实数组)，字符数组以及后面将要介绍的指针数组，结构数组等。

2.数组可以是一维的，二维的或多维的。

3.数组类型说明由类型说明符、数组名、数组长度 (数组元素个数)三部分组成。数组元素又称为下标变量。 数组的类型是指下标变量取值的类型。

4.对数组的赋值可以用数组初始化赋值， 输入函数动态赋值和赋值语句赋值三种方法实现。 对数值数组不能用赋值语句整体赋值、输入或输出，而必须用循环语句逐个对数组元素进行操作。


小结

1.从程序执行的流程来看， 程序可分为三种最基本的结构： 顺序结构，分支结构以及循环结构

2.程序中执行部分最基本的单位是语句。Ｃ语言的语句可分为五类：

(1)表达式语句　　 任何表达式末尾加上分号即可构成表达式语句， 常用的表达式语句为赋值语句。

(2)函数调用语句　　由函数调用加上分号即组成函数调用语句。

(3)控制语句　　 用于控制程序流程，由专门的语句定义符及所需的表达式组成。主要有条件判断执行语句，循环执行语句，转向语句等。

(4)复合语句　　 由{}把多个语句括起来组成一个语句。复合语句被认为是单条语句，它可出现在所有允许出现语句的地方，如循环体等。

(5)空语句　　 仅由分号组成，无实际功能。

3.关系表达式和逻辑表达式是两种重要的表达式， 主要用于条件执行的判断和循环执行的判断。

4.Ｃ语言提供了多种形式的条件语句以构成分支结构。

(1)if语句主要用于单向选择。

(2)if-else语句主要用于双向选择。

(3)if-else-if语和switch语句用于多向选择。

这几种形式的条件语句一般来说是可以互相替代的。

5.Ｃ语言提供了三种循环语句。

(1)for语句主要用于给定循环变量初值， 步长增量以及循环次数的循环结构。

(2)循环次数及控制条件要在循环过程中才能确定的循环可用 while或do-while语句。

(3)三种循环语句可以相互嵌套组成多重循环。循环之间可以并列但不能交叉。

(4)可用转移语句把流程转出循环体外，但不能从外面转向循环体内。

(5)在循环程序中应避免出现死循环，即应保证循环变量的值在运行过程中可以得到修改，并使循环条件逐步变为假，从而结束循环。

6.Ｃ语言语句小结

名 称　　　　　　　一 般 形 式

简单语句　　　　　表达式语句表达式；

空语句 ；

条件语句　　　　　if(表达式)语句；

                  if(表达式)语句1； else语句2；

                 if(表达式1)语句1； else if(表达式2) 语句2…else语句 n；

开关语句 　　　　 switch(表达式){ case常量表达式: 语句…default: 语句； }

循环语句　　　　 while语句

                 while(表达式)语句；

                  for语句 for(表达式1； 表达式2；表达式3)语句；

                  break语句 break；

                  continue语句 continue；

                  return 语句 return(表达式)；


continue语句

continue语句只能用在循环体中，其一般格式是：

continue；

其语义是：结束本次循环，即不再执行循环体中continue 语句之后的语句，转入下一次循环条件的判断与执行。应注意的是，本语句只结束本层本次的循环，并不跳出循环。


循环结构程序

循环结构是程序中一种很重要的结构。其特点是， 在给定条件成立时，反复执行某程序段，直到条件不成立为止。 给定的条件称为循环条件，反复执行的程序段称为循环体。Ｃ语言提供了多种循环语句，可以组成各种不同形式的循环结构。

1.while语句

while语句的一般形式为： while(表达式)语句； 其中表达式是循环条件，语句为循环体。

while语句的语义是：计算表达式的值，当值为真(非0)时， 执行循环体语句。

使用while语句应注意以下几点：

1.while语句中的表达式一般是关系表达或逻辑表达式，只要表达式的值为真(非0)即可继续循环。

2.循环体如包括有一个以上的语句，则必须用{}括起来，组成复合语句。

3.应注意循环条件的选择以避免死循环。

2.do-while语句

do-while语句的一般形式为：

do语句；

while(表达式)；

其中语句是循环体，表达式是循环条件。

do-while语句的语义是：

先执行循环体语句一次， 再判别表达式的值，若为真(非0)则继续循环，否则终止循环。

do-while语句和while语句的区别在于do-while是先执行后判断，因此do-while至少要执行一次循环体。而while是先判断后执行，如果条件不满足，则一次循环体语句也不执行。

while语句和do-while语句一般都可以相互改写。

在本例中，循环条件改为--n，否则将多执行一次循环。这是由于先执行后判断而造成的。

对于do-while语句还应注意以下几点：

1.在if语句，while语句中， 表达式后面都不能加分号， 而在 do-while语句的表达式后面则必须加分号。

2.do-while语句也可以组成多重循环，而且也可以和while语句相互嵌套。

3.在do和while之间的循环体由多个语句组成时，也必须用{}括起来组成一个复合语句。

4.do-while和while语句相互替换时，要注意修改循环控制条件。


C语言数据类型

1.整型量

整型量包括整型常量、整型变量。整型常量就是整常数。在Ｃ语言中，使用的整常数有八进制、十六进制和十进制三种。

2.整型常量

1.八进制整常数八进制整常数必须以0开头，即以0作为八进制数的前缀。数码取值为0～7。八进制数通常是无符号数。

以下各数是合法的八进制数：

015(十进制为13)　0101(十进制为65)　0177777(十进制为65535)

以下各数不是合法的八进制数：

256(无前缀0) 03A2(包含了非八进制数码)　-0127(出现了负号)

2.十六进制整常数

十六进制整常数的前缀为0X或0x。其数码取值为0~9，A~F或a~f。

以下各数是合法的十六进制整常数：

0X2A(十进制为42)　　0XA0 (十进制为160)　　0XFFFF (十进制为65535)

以下各数不是合法的十六进制整常数：

5A (无前缀0X)　　0X3H (含有非十六进制数码)

3.十进制整常数

十进制整常数没有前缀。其数码为0～9。

以下各数是合法的十进制整常数：

237 -568 65535 1627

以下各数不是合法的十进制整常数：

023 (不能有前导0)　23D (含有非十进制数码)。

在程序中是根据前缀来区分各种进制数的。因此在书写常数时不要把前缀弄错造成结果不正确。

4.整型常数的后缀在16位字长的机器上，基本整型的长度也为16位，因此表示的数的范围也是有限定的。十进制无符号整常数的范围为0～65535，有符号数为-32768～+32767。八进制无符号数的表示范围为0～0177777。十六进制无符号数的表示范围为0X0～0XFFFF或0x0～0xFFFF。如果使用的数超过了上述范围，就必须用长整型数来表示。长整型数是用后缀“L”或“l”来表示的。例如：

十进制长整常数 158L (十进制为158) 358000L (十进制为-358000)

八进制长整常数 012L (十进制为10) 077L (十进制为63)　0200000L (十进制为65536)。

十六进制长整常数 0X15L (十进制为21) 0XA5L (十进制为165)　0X10000L (十进制为65536)。

    长整数158L和基本整常数158 在数值上并无区别。但对158L，因为是长整型量，Ｃ编译系统将为它分配4个字节存储空间。而对158，因为是基本整型，只分配2 个字节的存储空间。因此在运算和输出格式上要予以注意，避免出错。无符号数也可用后缀表示，整型常数的无符号数的后缀为“U”或“u”。例如： 358u,0x38Au,235Lu 均为无符号数。前缀，后缀可同时使用以表示各种类型的数。如0XA5Lu表示十六进制无符号长整数A5，其十进制为165。

3.整型变量

整型变量可分为以下几类：

1.基本型

类型说明符为int，在内存中占2个字节，其取值为基本整常数。

2.短整量

类型说明符为short int或short'C110F1。所占字节和取值范围均与基本型相同。

3.长整型

类型说明符为long int或long ，在内存中占4个字节，其取值为长整常数。

4.无符号型

类型说明符为unsigned。

无符号型又可与上述三种类型匹配而构成：

(1)无符号基本型 类型说明符为unsigned int或unsigned。

(2)无符号短整型 类型说明符为unsigned short

(3)无符号长整型 类型说明符为unsigned long

各种无符号类型量所占的内存空间字节数与相应的有符号类型量相同。但由于省去了符号位，故不能表示负数。 下表列出了ARM中各类整型量所分配的内存字节数及数的表示范围。

类型说明符　　　 　数的范围 　　　　 分配字节数

int 　　　　　　-2147483648~2147483647　　　　　 ■■■■

short int 　　　-2147483648~2147483647　　　　　 ■■■■

signed int 　　 -2147483648~2147483647　 　　　　 ■■■■

unsigned int 　 0~4294967295 　　　　　　 ■■■■

long int 　-922337203685477808~922337203685477807　 ■■■■■■■■

unsigned long 　0~18446744073709551615 　　　　 ■■■■■■■■

4.整型变量的说明

变量说明的一般形式为： 类型说明符 变量名标识符，变量名标识符，...； 例如：

int a,b,c； (a,b,c为整型变量)

long x,y； (x,y为长整型变量)

unsigned p,q； (p,q为无符号整型变量)

在书写变量说明时，应注意以下几点：

1.允许在一个类型说明符后，说明多个相同类型的变量。各变量名之间用逗号间隔。类型说明符与变量名之间至少用一个空格间隔。

2.最后一个变量名之后必须以“；”号结尾。

3.变量说明必须放在变量使用之前。一般放在函数体的开头部分。

[Practice] //1int a,b；

short int c；

short d=100；

a=d-20；

b=a+d；

c=a+b+d；

d=d-a+c-b；

5.实型常量

实型也称为浮点型。实型常量也称为实数或者浮点数。在Ｃ语言中，实数只采用十进制。它有二种形式： 十进制数形式指数形式

1.十进制数形式

由数码0~ 9和小数点组成。例如：0.0，.25，5.789，0.13，5.0，300.，-267.8230等均为合法的实数。

2.指数形式

由十进制数，加阶码标志“e”或“E”以及阶码(只能为整数，可以带符号)组成。其一般形式为a E n (a为十进制数，n为十进制整数)其值为 a*10,n　如： 2.1E5 (等于2.1*10,5), 3.7E-2 (等于3.7*10,)-2*)　0.5E7 (等于0.5*10,7), -2.8E-2 (等于-2.8*10,)-2*)以下不是合法的实数 345 (无小数点)　E7 (阶码标志E之前无数字)　 -5 (无阶码标志)　53.-E3 (负号位置不对)　2.7E (无阶码)。

标准Ｃ允许浮点数使用后缀。后缀为“f”或“F”即表示该数为浮点数。如356f和356.是等价的。

6.实型变量

实型变量分为两类：单精度型和双精度型，其类型说明符为float 单精度说明符，double 双精度说明符。在Turbo C中单精度型占4个字节(32位)内存空间，其数值范围为3.4E-38～3.4E+38，只能提供七位有效数字。双精度型占8 个字节(64位)内存空间，其数值范围为1.7E-308～1.7E+308，可提供16位有效数字。

实型变量说明的格式和书写规则与整型相同。

例如： float x,y； (x,y为单精度实型量)

       double a,b,c； (a,b,c为双精度实型量)

实型常数不分单、双精度，都按双精度double型处理。

a ■■■■

b ■■■■■■■■

a<---33333.33333

b<---33333.33333333333；；

[Practice] //floatint a=32；

float b；

double d；

b=12345678；

d=b*100；

d=d+a；

d=d+58.123456；

7.字符型量

字符型量包括字符常量和字符变量。

字符常量

字符常量是用单引号括起来的一个字符。例如'a','b','=','+','?'都是合法字符常量。在Ｃ语言中，字符常量有以下特点：

1.字符常量只能用单引号括起来，不能用双引号或其它括号。

2.字符常量只能是单个字符，不能是字符串。

3.字符可以是字符集中任意字符。但数字被定义为字符型之后就

不能参与数值运算。如'5'和5 是不同的。'5'是字符常量，不能参与运算。

8.字符变量

字符变量的取值是字符常量，即单个字符。字符变量的类型说明符是char。字符变量类型说明的格式和书写规则都与整型变量相同。

例如：

char a,b； 每个字符变量被分配一个字节的内存空间，因此只能存放一个字符。字符值是以ASCII码的形式存放在变量的内存单元之中的。如x的

十进制ASCII码是120，y的十进制ASCII码是121。对字符变量a,b赋予'x'和'y'值： a='x'；b='y'；实际上是在a,b两个单元内存放120和121的二进制代码：

a　0 1 1 1 1 0 0 0

b　0 1 1 1 1 0 0 1

所以也可以把它们看成是整型量。 Ｃ语言允许对整型变量赋以字符值，也允许对字符变量赋以整型值。在输出时， 允许把字符变量按整型量输出，也允许把整型量按字符量输出。整型量为二字节量，字符量为单字节量，当整型量按字符型量处理时， 只有低八位字节参与处理。

[Practice] //charint a=49；

char b；

char d；

b=a+10；

d=a+b；

[Practice] //char c1,c2；

c1='a'；c2='b'；

c1=c1-32；c2=c2-32；

9.字符串常量

字符串常量是由一对双引号括起的字符序列。例如： "CHINA" ，"C program:" ， "$12.5" 等都是合法的字符串常量。字符串常量和字符常量是不同的量。它们之间主要有以下区别：

1.字符常量由单引号括起来，字符串常量由双引号括起来。

2.字符常量只能是单个字符，字符串常量则可以含一个或多个字符。

3.可以把一个字符常量赋予一个字符变量，但不能把一个字符串常量赋予一个字符变量。在Ｃ语言中没有相应的字符串变量。

4.字符常量占一个字节的内存空间。字符串常量占的内存字节数等于字符串中字节数加1。增加的一个字节中存放字符"\0"(ASCII码为0)。这是字符串结束的标志。例如，字符串 "C program"在内存中所占的字节为：C program\0。字符常量'a'和字符串常量"a"虽然都只有一个字符，但在内存中的情况是不同的。

'a'在内存中占一个字节，可表示为：a

"a"在内存中占二个字节，可表示为：a\0符号常量

10.符号常量

在Ｃ语言中，可以用一个标识符来表示一个常量，称之为符号常量。符号常量在使用之前必须先定义，其一般形式为：

#define 标识符 常量

其中#define也是一条预处理命令，称为宏定义命令，其功能是把该标识符定义为其后的常量值。一经定义，以后在程序中所有出现该标识符的地方均代之以该常量值。习惯上符号常量的标识符用大写字母，变量标识符用小写字母，以示区别。

#define PI 3.14159

void main(){

float s,r；

r=5；

s=PI*r*r；

printf("s=%f\n",s)；

}

由宏定义命令定义PI 为3.14159 s,r定义为实数　5->r　PI*r*r->s

显示程序结果 float s,r；　r=5；　s=PI*r*r； 本程序在主函数之前由宏定义命令定义PI 为3.14159，在程序中即以该值代替PI 。s=PI*r*r等效于s=3.14159*r*r。应该注意的是，符号常量不是变量，它所代表的值在整个作用域内不能再改变。也就是说，在程序中，不能再用赋值语句对它重新赋值。


一个简单的宏指令实例

一个简单的宏模块

宏指令源代码设计

下面我们就着手编写一个简单的宏模块。新建一工程,选择相应的触摸屏型号。这个宏模块将实现如下简单运算功能：将“值输入显示”控件，通过Init宏指令用数组char source[4] = { 2, 3, 4, 5}元素值对各“值输入显示”控件进行初始化，然后可以通过“数值输入显示”控件读入外部输入数据，然后通过按下“=” 按钮，将触发ADDSUM宏指令的执行，并通过“数值输入显示”控件显示其执行结果。如下是详细的操作步骤：

第一步：<新建一条宏指令>

点击工具栏里的图标中画圈 [image] “宏指令”快捷功能按钮，然后会弹出如图 10-7(宏指令编辑器)的对话框。

第二步：<创建宏指令Init>

在宏指令编辑器界面点击“新增”按钮，将出现如图10-8(宏指令编译器)所示对话框，在“宏指令名称”编辑框输入宏指令名称(Init)，及图10-9 (宏指令编译器代码编辑)所示源程序代码。

图10-7(宏指令编译器)

图10-8 (宏指令编译器)

宏指令名称只能由阿拉伯数字(0-9)，英文字符(a-z，A-Z)，及下画线(_)组合命名。如图10-9(宏指令编译器)所示，输入如下画圈中内容。

图10-9 (宏指令编译器代码编辑)

第三步：<变量设定>

其中如图10-8(变量设定)所示的窗口中记录各变量名，变量类型等属性设置值。在“变量设定”窗口中双击，或点击鼠标右键弹出的快捷菜单，选择“新建变量”项将弹出如图10-10(宏代码变量)对话框。

在图示(图10-10(宏代码变量)可对外部各变量属性值进行设置，完成后点击“确定”按钮保存设定值。

图10-10(宏代码变量)

变量名称: 分别在变量名称输入LW0,LW1,LW2,LW3,SumLW；

数据类别: 设置16位整数；

读/写：选择为可读可写(读写)；

地址设置分别为 ：LW0=0,LW1=1,LW2=2,LW3=3,SumLW=4；

分别设置完成后，结果如下图(图10-11)所示。

图10-11(变量设定)

第四步：<编译源文件>

完成了上述步骤后，接下来便是编译了；点击编译按钮如下图(图10-12)所示，自动完成存盘，编译，连接等错误检查功能。

图10-12(编译输出结果)

当信息输出窗口输出有“0 errors！编译成功!”表示本条宏指令已成功创建，同时会被自动添加到已编译成功列表框中；否则提示错误信息，并自动添加到未成功编译列表框中，用户则根据提示信息对所编写的程序重复进行修改、编辑、直至成功完成编译。

第五步：<创建宏指令ADDSUM>

按照步骤二—步骤四创建宏指令ADDSUM，图10-13(创建宏指令ADDSUM)。

<1>：在宏指令名称中输入“ADDSUM”。

<2>：在代码编辑窗口中输入画圈内容。

<3>：在变量设定窗口中设置相应的变量属性值。

<4>：点击编译按钮。

图10-13(创建宏指令ADDSUM)

第六步：<编辑控件>

<1>. 在工程画面中放置相应的控件并调节到适当尺寸大小，如图(图10-14)所示。

图10-14(控件布局)

<2>. 设置相应控件属性参数

在“数值输入显示”控件上点击右键，分别设置各控件属性写入地址值如图(图10-15)所示。

图10-15(数值输入显示属性设置)

分别将LW0,LW1,LW2,LW3,SumLW变量地址，其与对应控件“写入地址”输入值((图10-15)所示值)保持一致(即分别位LW0,LW1,LW2,LW3,LW4)这点很重要，点击“确定”按钮保存设置。

<3>.设置位按钮控件属性如图

选中“位按钮”控件点击右键弹出如图图10-16(位按钮属性设置)，在出现的属性框中。按画圈提示进行设置，点击“确定”按钮保存设置属性值。

图10-16(位按钮属性设置)

<4>.定时器属性设置

选择定时器，点击右键弹出如图(图10-17)所示定时器属性对话框。

选择宏指令名称为Init,点击“确定”保存设置值。

图10-17(定时器属性设置)

<5>. 选择功能按钮的“标示”页—>“文本”页属性页，在文本编辑框中输入“+”字符，如图(图10-18)所示；

图10-18(功能按钮属性设置)

第七步：<总工程编译并下载到触摸屏>

完成上面的设置并保存工程，现在便可以编译，并通过USB将工程下载到触摸屏中运行了。

<1> ：点击红圈所示图示“√”如(图10-19)所示，执行工程编译；

图10-19(总工程编译)

<2> ：选择菜单“下载(D)->USB下载(D)”在弹出的对话框选择“下载”菜单。完成下载，重启触摸屏。

也可以点击黑色圈所示中“编译下载”快捷方式功能按钮，一步完成。

第八步：<结果测试>

重启触摸屏后会出现如下(图10-20)画面，这是由于在开机时，首先执行宏指令Init，该指令是由定时器触发执行宏指令Init的结果。

图10-20(显示初始数值)

分别在“数值输入显示”控件中输入数据如“31，42，53，64”后，点击“=”按钮后执行ADDSUM会输出执行结果190，最终显示效果如图(图10-21)所示。

图10-21(结果显示)

至此已顺利完成了宏指令的编辑、编译、下载、测试等所需全部功能，一个简单的宏指令模块便正常运行了。


for语句

for语句是Ｃ语言所提供的功能更强，使用更广泛的一种循环语句。其一般形式为：

for(表达式1；表达式2；表达3)

语句；

表达式1　通常用来给循环变量赋初值，一般是赋值表达式。也允许在for语句外给循环变量赋初值，此时可以省略该表达式。

表达式2　通常是循环条件，一般为关系表达式或逻辑表达式。

表达式3　通常可用来修改循环变量的值，一般是赋值语句。

这三个表达式都可以是逗号表达式， 即每个表达式都可由多个表达式组成。三个表达式都是任选项，都可以省略。

一般形式中的“语句”即为循环体语句。for语句的语义是：

1.首先计算表达式1的值。

2.再计算表达式2的值，若值为真(非0)则执行循环体一次，否则跳出循环。

3.然后再计算表达式3的值，转回第2步重复执行。在整个for循环过程中，表达式1只计算一次，表达式2和表达式，3则可能计算多次。循环体可能多次执行，也可能一次都不执行。

在使用for语句中要注意以下几点

1.for语句中的各表达式都可省略，但分号间隔符不能少。如：for(；表达式；表达式)省去了表达式

<1>for(表达式；；表达式)省去了表达式

<2>for(表达式；表达式；)省去了表达式

<3>for(；；)省去了全部表达式。

2.在循环变量已赋初值时，可省去表达式1，如例3.27即属于这种情形。如省去表达式2或表达式3则将造成无限循环， 这时应在循环体内设法结束循环。

3.循环体可以是空语句。

#include"stdio.h"

void main(){

int n=0；

printf("input a string:\n")；

for(；getchar()!='\n'；n++)；

printf("%d",n)；

}

本例中，省去了for语句的表达式1，表达式3也不是用来修改循环变量，而是用作输入字符的计数。这样， 就把本应在循环体中完成的计数放在表达式中完成了。因此循环体是空语句。应注意的是，空语句后的分号不可少，如缺少此分号，则把后面的printf 语句当成循环体来执行。反过来说，如循环体不为空语句时， 决不能在表达式的括号后加分号， 这样又会认为循环体是空语句而不能反复执行。这些都是编程中常见的错误，要十分注意。


如何在程序中插入库函数

点击“函数”按钮弹出如图10-6所示对话框，在函数名称列表框选择相应的库函数，点击“确定”按钮，函数便自动插入到编辑窗口当前光标位置所在处。

其库函数的功能及参数类型等详细使用说明请参考附录一。

图10-6(函数选择)


宏指令编辑器各功能按钮功能介绍

宏指令编辑器窗口，其各功能控件布局如图 10-3(宏指令编辑器)所示。

图 10-3(宏指令编辑器)

<1> 按键功能介绍：

1. 新增：新建一条宏指令。

2. 删除：对当前选中的宏指令进行删除操作。

3. 编辑：对选中的宏指令进行编辑(与双击某宏指令名称效果相同)。

4. 复制：鼠标单击选中某条宏指令，然后点击“复制”，

便对选中的宏指令内容进行复制。

5. 粘贴：将复制的内容粘贴，并且宏指令名称后缀自动加一。

6. 说明：弹出宏指令使用说明书。

7. 关闭：关闭或退出当前对话框。

<2>“已编译成功”窗口：用来记录工程中所有成功编译的宏指令名称

<3>“未完成编译”窗口：用来记录工程中所有未成功编译的宏指令名称


如何 在宏指令中使用内部存储区

在SamDraw组态软件中提供了HMI内部存储区的操作接口，用户可以在宏指令中直接对内部存储区操作，具体方法有2种：

1.通过关键字访问内部存储区

LocalBit:内部存储区LB的引用；

LocalWord：内部存储区LW的引用；

RWIWord：内部存储区RWI的引用。

在宏指令代码中可以直接使用该关键字，如：

if(LocalBit[5])

{

LocalWord[1]=0;

}else

{

LocalWord[1]=1;

}

2.通过变量设定，建立一个变量与内部存储区关联,具体使用方法见宏指令实例。


如何新建宏指令

点击“新增”按钮弹出如下图10-4(宏指令编辑器)宏指令编译器对话框。

图 10-4(宏指令编辑器)

按键功能介绍

编译：对当前宏指令源代码进行编译，进行语法错误检查。

函数：向源代码编辑窗口中光标所在位置插入所选库函数。

关闭：关闭当前对话框。

说明：弹出宏指令使用帮助文档。

使用说明：

说明一：信息输出窗口

此窗口输出程序在编译，连接时状态信息，用户可根据此信息提示对程序进行调试，修改。

说明二：窗口的关闭打开

用户可在变量设定，源代码编辑窗口中点击鼠标右键将出现如图10-5(窗口的关闭打开)快捷菜单。点击“关闭/显示变量设定窗口”， “关闭/显示信息输出窗口”，可将对应窗口关闭/打开，用户可根据需要自行调节代码编辑框尺寸大小。

说明三：变量设定

变量名称：输入程序中需要使用变量名称。

数据类别：选择对应变量名称的数据类别，以便分配相应大小存储空间。

字 长：根据数据类别不同，自动设置对应变量所占存储空间。

读 / 写：设置变量在触摸屏中存储单元的读写属性。

地 址：为变量指定在触摸屏中的物理存储地址。

图10-5快捷菜单

变量设定使用说明：该变量设定功能使用情况，当外部需要与触摸屏进行交互，如数据交换，数据采集等时，提供了动态改变触摸屏的行为特征的接口。

特别提示：要求程序中使用的变量，统一放在变量定义部分(变量定义统一在代码开始处)。


C语言程序设计初步

l Ｃ程序的语句

l 分支结构程序

l switch语句

l 循环结构程序

l for语句

l break语句

l continue语句

l 小结


如何启动宏指令功能进行程序设计

本节主要介绍宏指令基本功能，简要说明相关控件功能及如何使用。

进入宏指令设计的方式有两种：

第一种方式：通过选择菜单“设定(S)->宏指令”，如下图10-1(宏指令菜单)所示，弹出如图10-3(宏指令编辑器)界面。

图10-1(宏指令菜单)

第二种方式：点击快捷功能按钮“宏指令”

。

图10-2(宏指令按钮)


Ｃ程序的语句

C程序的语句

Ｃ程序的执行部分是由语句组成的。 程序的功能也是由执行语句实现的。

C语句可分为以下五类：

1.表达式语句

2.控制语句

3.复合语句

4.空语句

1.表达式语句

表达式语句由表达式加上分号“；”组成。其一般形式为： 表达式； 执行表达式语句就是计算表达式的值。例如： x=y+z；赋值语句y+z； 加法运算语句，但计算结果不能保留，无实际意义i++；自增1语句，i值增1

2.控制语句

控制语句用于控制程序的流程， 以实现程序的各种结构方式。

它们由特定的语句定义符组成。Ｃ语言有九种控制语句。 可分成以下三类：

(1) 条件判断语句

    if语句，switch语句

(2) 循环执行语句

    do while语句，while语句，for语句

(3) 转向语句

    break语句，goto语句，continue语句，return语句

3.空语句

只有分号“；”组成的语句称为空语句。 空语句是什么也不执行的语句。在程序中空语句可用来作空循环体。例如 while(getchar()!='\n')； 本语句的功能是，只要从键盘输入的字符不是回车则重新输入。这里的循环体为空语句。

4.赋值语句

赋值语句是由赋值表达式再加上分号构成的表达式语句。 其一般形式为： 变量=表达式； 赋值语句的功能和特点都与赋值表达式相同。它是程序中使用最多的语句之一。 在赋值语句的使用中需要注意以下几点：

1.由于在赋值符“=”右边的表达式也可以又是一个赋值表达式，因此，下述形式变量=(变量=表达式)；是成立的，从而形成嵌套的情形。其展开之后的一般形式为： 变量=变量=…=表达式；

例如：

a=b=c=d=e=5；按照赋值运算符的右接合性，因此实际上等效于：

e=5；

d=e；

c=d；

b=c；

a=b；

2.注意在变量说明中给变量赋初值和赋值语句的区别。给变量赋初值是变量说明的一部分，赋初值后的变量与其后的其它同类变量之间仍必须用逗号间隔，而赋值语句则必须用分号结尾。

3.在变量说明中，不允许连续给多个变量赋初值。 如下述说明是错误的： int a=b=c=5 必须写为 int a=5,b=5,c=5； 而赋值语句允许连续赋值

4.注意赋值表达式和赋值语句的区别。赋值表达式是一种表达式，它可以出现在任何允许表达式出现的地方，而赋值语句则不能。

下述语句是合法的： if((x=y+5)>0) z=x；语句的功能是，若表达式x=y+5大于0则z=x。下述语句是非法的： if((x=y+5；)>0) z=x； 因为=y+5；是语句，不能出现在表达式中。


宏指令功能简介

l 如何启动宏指令功能进行程序设计

l 宏指令编辑器各功能按钮功能介绍

l 如何新建宏指令

l 如何在程序中插入库函数

l 如何在宏指令中使用内部存储区


switch语句

Ｃ语言还提供了另一种用于多分支选择的switch语句，其一般形式为：

switch(表达式){

case常量表达式1: 语句1；

case常量表达式2: 语句2；

…

case常量表达式n: 语句n；

default : 语句n+1；

}

其语义是：计算表达式的值。 并逐个与其后的常量表达式值相比较，当表达式的值与某个常量表达式的值相等时，即执行其后的语句，然后不再进行判断，继续执行后面所有case后的语句。 如表达式的值与所有case后的常量表达式均不相同时，则执行default后的语句。

在使用switch语句时还应注意以下几点：

1.在case后的各常量表达式的值不能相同，否则会出现错误。

2.在case后，允许有多个语句，可以不用{}括起来。

3.各case和default子句的先后顺序可以变动，而不会影响程序执行结果。

4.default子句可以省略不用。


变量的初值和类型转换

1.变量赋初值

在程序中常常需要对变量赋初值，以便使用变量。语言程序中可有多种方法，在定义时赋以初值的方法，这种方法称为初始化。在变量说明中赋初值的一般形式为：

类型说明符 变量1= 值1，变量2= 值2，……； 例如：

int a=b=c=5；

float x=3.2,y=3f,z=0.75；

char ch1='K',ch2='P'；

应注意，在说明中不允许连续赋值，如a=b=c=5是不合法的。

2.变量类型的转换

变量的数据类型是可以转换的。转换的方法有两种， 一种是自动转换，一种是强制转换。

自动转换

自动转换发生在不同数据类型的量混合运算时，由编译系统自动完成。自动转换遵循以下规则：

1.若参与运算量的类型不同，则先转换成同一类型，然后进行运算。

2.转换按数据长度增加的方向进行，以保证精度不降低。如int型和long型运算时，先把int量转成long型后再进行运算。

3.所有的浮点运算都是以双精度进行的，即使仅含float单精度量运算的表达式，也要先转换成double型，再作运算。

4.char型和short型参与运算时，必须先转换成int型。

5.在赋值运算中，赋值号两边量的数据类型不同时， 赋值号右边量的类型将转换为左边量的类型。 如果右边量的数据类型长度左边长时，将丢失一部分数据，这样会降低精度，丢失的部分按四舍五入向前舍入。

3.强制类型转换

强制类型转换是通过类型转换运算来实现的。其一般形式为： (类型说明符) (表达式) 其功能是把表达式的运算结果强制转换成类型说明符所表示的类型。例如： (float) a 把a转换为实型(int)(x+y) 把x+y的结果转换为整型在使用强制转换时应注意以下问题：

1.类型说明符和表达式都必须加括号(单个变量可以不加括号)，如把(int)(x+y)写成(int)x+y则成了把x转换成int型之后再与y相加了。

2.无论是强制转换或是自动转换，都只是为了本次运算的需要而对变量的数据长度进行的临时性转换，而不改变数据说明时对该变量定义的类型。


Penetration connection

HMI touch screen allows a special connection manner, in which a remote HMI can monitor or control PLC or other devices via the serial port of another HMI connected with the PLC or device. In this case, there are two or more control terminals to operate the device connected. Penetration connection is a very useful function of HMI.

Before use penetration connection, the following terms should be understood:

l Local HMI: The HMI connected with the PLC or other device.

l Remote HMI: The HMI connected with the local machine that controls the devices connected through penetration.

To realize penetration connection, the local HMI must have two serial ports. The sketch map of penetration connection is shown in Figure 8-12:

Penetration connection involving two screens:

Figure 8-12 Sketch map of penetration connection involving two screens

Local HMI: Software setting:

Double click the connection established, and then a communication port attribute-setting box will pop up. Choose COM1 for connection port. Taking Modbus penetration for example, the COM1 of the local HMI is connected with modbus_RTU_Master. The communication parameters set in Communication Parameter should be consistent with the PLC or other devices connected. See Figure 8-14 and Figure 8-15:

Figure 8-14 General page of local HMI communication port attribute setting

Figure 8-15: COM1 setting page of local HMI communication port attribute setting

Create a new connection, choose COM2 for the connection port, add no protocol in Connection, set attributes as follows, and set the same serial port attributes as serial port 1. The recommended parameters are 9600, 8, None, 1. Choose Connect Slave Screen Port for penetration attribute, and set the number of screens according to actual condition. See Figure 8-16 and Figure 8-17.

Figure 8-16 General page of local HMI communication port attribute setting

Figure 8-17 Parameter setting page of local HMI communication port attribute setting

Choose default values for other parameters. At this moment, the parameter setting for local HMI is completed.

Remote HMI: Software setting:

Double click the connection established, and then a communication port attribute-setting box will pop up. Choose COM1 for connection port, choose Remote for HMI Site, and set the same communication parameters as those in the COM2 parameter setting page of local HMI communication port attribute setting (as shown in Figure 6 above), as shown in Figure 8-18 and Figure 8-19.

Figure 8-18 General page of remote HMI communication port attribute setting

Figure 8-19 Parameter setting page of remote HMI communication port attribute setting

Choose default values for other parameters. At this moment, the parameter setting for remote HMI is completed.

ü The above settings are software setting for penetration involving two screens.

ü In penetration connection involving multiple screens, COM setting in remote HMI is the same as COM setting in local HMI.

ü As all communication data are exchanged with PLC through COM1 of local HMI, the communication rate will be low in the case of penetration connection involving multiple screens.


您可以通过以下方式，对文档的特定章节进行打印：

（1）在左侧的【目录】选项卡内，将鼠标移动到您想打印的章节标题处；

（2）在该章节标题处，点击鼠标右键，弹出菜单，选择【打印..】


您可以通过以下方式使用文档【搜索功能】：

（1）鼠标左键点击【搜索】选项卡

（2）在输入框内输入您想搜索的内容（不支持模糊查询），输入完毕后按回车进行搜索

（3）在搜索结果中，鼠标双击搜索结果列表内的某一行，该详细搜索内容将于右侧显示


您可通过以下方式启动并使用【帮助文档】：

方式（1）：

在SamDraw，点击帮助选项卡内的【帮助】选项，或者使用快捷键【F1】启动【帮助】

方式（2）：

部分控件等设置对话框的右下角有【帮助】按钮，点击该按钮将最直接进入此对话框内容相关的帮助页面

方式（3）：

在您的SamDraw安装目录下，双击打开【Software_Help.chm】，进入【帮助】


SamDraw 离线模拟

离线模拟

在传送画面到HMI中，并把HMI和连接设备连接之前，可以利用SamDraw自带的离线模拟功能来校检一下组态画面的正确性。

l 操作过程：

保存当前编辑好的工程，选择下载菜单中的离线模拟命令，即可弹出离线模拟窗口，在这里你可以用鼠标单击代替触碰触摸屏，在弹出的窗口中实现触摸屏的部分功能。如图5-1所示：

图5-1 SA-4.3A离线模拟图

在模拟窗口中，选择右键可弹出如下菜单：

退出：关闭离线模拟窗口；离线模拟为Windows当前窗口时，按键盘的ESC也可以退出离线模拟。

关于：关于对话框。

可以在任务栏“右键”—“关闭”，关闭离线模拟。

l 离线模拟实例

如下图5-2，可以对编辑好的组态进行离线模拟，鼠标单击数值显示与输入，输入70，则在仪表盘上可以看到仪表指针指向70的位置。离线模拟可以很好的帮助工程设计人员检查和发现工程组态画面存在的一些问题，如监视地址是否选择正确，控件间相互关系是否正确等等。做到有备无患。

图5-2 SA-4.3A离线模拟实例图

l 以下是使用离线模拟的操作步骤：

ü 没有安装SamDraw5.0的用户先安装SamDraw5.0软件。

ü 双击桌面上的SamDraw5.0.exe快捷方式。

ü 选择新建图标 新建 ，或者在菜单栏中，选择“文件”---“新建工程”，弹出如图5-3所示对话框：

图5-3 新建工程对话框

ü 在“工程名称”一栏输入工程名称；在“位置”一栏中为该工程选择一个保存位置；在“型号选择”选择“SA-4.3A（480*272 4.3’）”（该实例以4.3寸的HMI为例，用户可根据需要选择其他的HMI型号）；在“显示模式”下选择“水平”（用户可根据需要选择垂直显示）；设置完后，用户刚设置的信息可在下方的“型号参数”模块中显示出来。确定后用户可点击“下一步”按钮，弹出如图5-4所示对话框：

图5-4 新建项目之通信连接设置对话框

该实例以三菱的PLC为设备，用户可根据需要在“设备服务”选项中选择其他型号的PLC，在该项后面选择该PLC的不同型号。设置完毕后点击“下一步”按钮，弹出图5-5所示对话框：

图5-5 新建工程之添加新画面对话框

在该对话框中，用户在“画面名称”一栏可以更改画面名称；在“背景色”一栏可更改画面的背景色；设置完后点击“完成“按钮，则工程创建完毕。

往工程中添加控件：

ü 在工具栏中点击“数值输入显示”图标，在弹出的对话框中设置好该控件的外形、背景色，前景色、样式等属性；“数据类别”和“显示类别”为默认值；“写入地址”为D5，并选择“监视地址与写入地址相同”选项；其他属性值为默认值。点击”确定“按钮，在界面上画出该控件。

ü 单击工具栏中“字按钮”图标，在弹出的对话框中设置好该控件的外形、背景色，前景色、样式等属性；在“功能”模块中选择“加”，“写入地址”为D5，“常数”中输入“5”一般页面其他属性都为默认值；点击“标示”页面标签，在“文本”页面中的“文本”框中输入“D5加5”；点击”确定“按钮，在界面上画出该控件。

ü 单击工具栏中“柱状图”图标，在弹出的对话框中设置背景色、柱图样色和柱图样背景色；在方向模块中选择“向右”，监视地址为D5，最小值和最大值分别为0和200；其他属性值为默认值。点击”确定“按钮，在界面上画出该控件。

ü 单击工具栏中“ASC字输入与显示”按钮图标，在弹出的对话框中设置好该控件的外形、背景色，前景色、样式等属性；写入地址为D2，并选择“监视”和“监视地址与写入地址相同”选项；把总字数调到20，其他属性值为默认值。点击“确定”按钮，在界面上画出该控件。

在离线模拟中，功能按钮只可以使用以下功能：“前一个配方”，“后一个配方”，“当前配方保存”，“更改用户等级”，“注销用户等级”和“触摸声音ON/OFF”。

工具栏上的“趋势图”、“报警显示”、“动态报警条”、“历史报警对话框”、“历史数据显示器”、“历史趋势图”、“定时器”和“宏指令”不能离线模拟。

ü 其他控件的做法和前面刚介绍的一样，在此不再详细描述。设置好各控件的属性后，点击“保存”按钮保存该工程，然后选择菜单栏中的“下载”菜单中“离线模拟”

ü 点击“保存”按钮保存该工程，然后选择菜单栏中的“下载”项中“离线模拟”

离线模拟实例介绍完毕。


初始化宏设定

Set a macro that has been successfully compiled into an Init macro, meaning executing this macro only one time without being limited by screens. A maximum of 64 init macros can be added, and they are executed in the set order.

u Click "Init Macro" on the menu "Setting", as shown in the dialog box:

Click the list item to list all the macro names that have been compiled successfully. The selected macro is executed as an initial macro during configuration run time.


全局宏设定

Global Macro

Set a macro that has been successfully compiled into a global macro, meaning executing this macro when the configuration starts running, and it will be executed during the run time without being limited by screens. A maximum of 64 global macros can be added, and they are executed in the set order.

u Click "Global Macro" on the menu "Settings", as shown in the dialog box:

Click the list item to list all the macro names that have been compiled successfully, and then decide whether the macro is controlled by bit and the execution frequency. The selected macro is executed as a global macro during configuration run time.

Execution time: This parameter means the execution time assigned to a single global macro. It is mainly determined by the communication time of reading and writing variables in the process of reading a global macro. The value of the global macro is left with a margin. Otherwise, the macro may not be executed normally Switch to the next one.

Note: Please refer to the most time-consuming macro of all global macros for setting the execution time whose range is 100-7000 ms.


SamDraw综述

设置参数和添加图形对象

设置参数：

在设定下拉菜单中，可以选择修改参数设定，也可以双击工程管理器中设置选项中的触摸屏参数设置来修改参数。弹出如下图3-5所示的对话框：

图3-5 触摸屏一般设置对话框

触摸屏型号和显示模式的选择请参考新建工程对话框。

在触摸屏一般设置对话框中还可以更改触摸屏启动时的画面，即下载到触摸屏后启动的第一画面，下拉菜单为画面名称，单击即可设定启动画面。如下图3-6所示：

图3-6 设定启动画面

设定屏幕保护的时间，即进入屏保画面的等待时间，默认为1分钟，可以通过直接输入和点击微调按钮来改变等待时间的长短。

：更改屏幕保护时间只对在选择了是否屏保画面的情况下才有效果，进入屏幕保护画面以后只需触碰触摸屏即可退回进入屏保时画面。

闪烁频率，即对带有标示类中有闪烁选项的对象或控件进行闪烁频率的设定，可以通过直接输入和点击微调按钮来改变闪烁频率的快慢。

报警声音，当设定有报警产生时，触摸屏可以发出声音提示使用者。右边下拉菜单中分为有无声音提示两种情况。

触摸声音，右边的下拉菜单中可以控制触碰触摸屏进行控制时是否发除声音。

是否屏保画面，即可以从画面当中选出一画面来充当屏保画面，进入屏幕保护画面以后只需触碰触摸屏即可退回进入屏保时画面。

是否载入画面，当选有此项时，触摸屏上电后会显示所选的载入画面，并停留所设定的时间，然后转入启动画面，这样可以在画面上给使用者一些提示或注意事项。

除此之外，触摸屏一般设置对话框中还可以设定用户等级密码。SamDraw组态画面编辑软件一共可以设置8个等级的密码，每个密码最多可以设8位，用户可以根据需要来设定属于自己的密码。1-8等级的默认初始密码为1111-8888，默认的初始等级为1。

添加图形对象：

在完成了新建画面任务后，用户就可以在画面编辑窗口上添加自己需要的对象了或控件，SamDraw组态画面编辑软件为用户提供了矩形（圆角矩形）、直线、椭圆、扇形（圆弧）、点位图、多边形（多边线）、文本等基本图形对象，及位按钮、字按钮、数值输入显示按钮、柱状图、趋势曲线控件、报警控件、历史数据收集等复杂的图形对象。提供了对图形对象在窗口内任意移动、缩放、改变形状、复制、粘贴、删除、对齐等编辑操作，全面支持键盘、鼠标绘图，并可提供对图形对象的颜色、线型、填充属性进行改变的操作工具。SamDraw采用面向对象的编程技术，使用户可以方便地建立画面的图形接口。用户构图时可以像搭积木那样利用系统提供的图形对象完成画面的生成。同时支持画面之间的图形对象拷贝生成，可重复使用以前的开发结果。SamDraw组态画面编辑软件还提供了大量的位图，用户可以在系统图库中选择符合工程的位图，省去用户开发组态画面的大量时间。

添加图形对象后的画面，实例工程组态如图3-7所示：

图3-7 实例工程组态


Standard Toolbar

New Project: shortcut key Ctrl + N; to create a blank project.

Open Project: shortcut key Ctrl + O; execute this command to open a project file created, saved before and suffixed by .drw.

Open Project: shortcut key Ctrl + O; execute this command to open a project file created, saved before and suffixed by .drw.

Save: hot key Ctrl+S; to save the current modified screen configuration. The default file name and save path are the original file name and save path.

Undo: shortcut key Ctrl + Z; to cancel the last operation command and your recent action.

Restore: shortcut key Ctrl + Y, to restore the last operation command and your recent action.

Cut: shortcut key Ctrl + X, to delete your selected graphical objects and copy them into the clipboard buffer.

Copy: shortcut key Ctrl + C; to copy the selected graphic object into the paste buffer.

Paste: shortcut key Ctrl + V, to copy and paste buffer graphics objects into the current screen.

Delete: hot key Ctrl+Del, to remove selected graphical object from the screen.

Rotary: Execute this command to rotate selected object freely, horizontally or vertically.

Bring To Top: Execute this command to shift the graphic object you selected to the top of the screen.

Send To Bottom: Execute this command to shift the graphic object you selected to the bottom of the screen.

Bring Forward: Execute this command to shift the graphic object you selected forward one layer.

Send Backward: Execute this command to shift the graphic object you selected backward one layer.

Group: Execute this command to combine several graphic objects you select into one object.

Ungroup: This command can decompose a combination of graphic objects you have selected into the original graphic objects; it’s the inverse operation of Group.

Left: Shortcut key Ctrl + Left, execute this command to left justify the left edges of selected graphic objects.

Right: Shortcut key Ctrl + Right, execute this command to right justify the right edges of selected graphic objects.

Top: Shortcut key Ctrl + Up, execute this command to align upper boundaries of selected multiple graphic objects top.

Bottom: Shortcut key Ctrl + Down, execute this command to align lower boundaries of selected graphic objects bottom.

Horizontal Center: Execute this command to align selected graphics horizontal center.

Vertical Center: Execute this command to align selected graphics vertical center.

Make same width: Use this command to make a group of selected patterning the same width as that marked by a black point.

Make same height: Use this command to make a group of selected patterning the same height as that marked by a black point.

Make same width and height: Use this command to make a group of selected patterning the same width and height as that marked by a black point.

Horizontal Equal Interval: Execute this command to make two or more controls align horizontally equal interval.

Vertical equal interval: Execute this command to make two or more controls align vertically equal interval.

Flip Horizontal: Execute this command to make a single graphic or multiple graphics pivot horizontally.

Flip Vertical: Execute this command to make a single graphic or multiple graphics pivot vertically.

Grid: Execute this command to create or cancel a grid with certain width on the current screen.

Border Scale: Execute this command to add to cancel the scale mark in the left upper corner of screen edit area.

Zoom in: Execute this command to magnify the current screen two times; to continue to enlarge, please continue to execute the command.

Zoom fit: Execute this command to restore the current screen to the standard size.

Zoom out: Execute this command to shrink the current screen half the size; to continue zooming out, proceed to execute the command.

Pan View: Execute this command to move screens within the configuration window; select this command, hold down the left key of mouse in the screen and then end the move to the proper place.


Debug Toolbar

Compile: Execute this command to check user’s own configuration engineering and get ready to download.

Off-line simulation: Execute this command to run directly off-line simulation command.

Online simulation: Execute this command to run directly online simulation command.

USB Download: Execute this command to pop up the download dialog; after connecting the SA HMI to PC, you can download the configuration project to the touch screen.

Compile Download： Execute this command to compile project first and then download it to HMI if nothing goes wrong during the compilation.

Upload: Execute this command to upload historical data, configuration, recipes and alarm history from a running HMI to a PC via the equipped USB cable.

Macro: Execute this command to program configuration screens with C language.

Global Macro: Execute this command to set up global macro.

Init Macro: Execute this command to set up initialization macro.

Converter: Execute this command to convert project file of SamDraw3.2 to that of SamDraw3.3 or upload historical data.

Open Gallery: Execute this command to open the built-in SamDraw gallery for designers.

Save Gallery: Execute this command to save the current screen, the selected control or a picture imported from a file into a control or graph.

OFF Status (1): Execute this command to set up OFF display properties of all graphic objects with function of ON/OFF display.

ON Status (0): Execute this command to set up ON display properties of all graphic objects with function of ON/OFF display.

Status drop-down box: If select a control with status, the drop-down box will show the number of control status; if the number in the box changes, the status of the selected control will switch into corresponding status.

Previous Screen: Execute this command to switch to the previous screen.

Next Screen: Execute this command to switch to the next screen.

Property Setting: Execute this command to open the property of the selected key.

Lock: Execute the command to lock the key selected on the screen and it cannot be moved after locking.

Unlock: Execute this command to remove the locking of screen buttons.

Address Find: Execute this command to find out whether an address is occupied and the search results are displayed in the "information output window".

Address Display: Execute this command to browse the used address of all controls in certain screens or all the screens.

Find Macro: Execute this command to find whether a macro is used; the search result is displayed in the "information output window".

Macro Manager: Execute this command to see the macro condition of all controls in certain screens or all the screens.

Project Manager: Execute this command to open or close the Project manager.

Information Output Window: Execute this command to open or close the information output window.