KR100812705B1 - Method for Linking Host Data in Programmable Logic ControllerPLC - Google Patents

Method for Linking Host Data in Programmable Logic ControllerPLC Download PDF

Info

Publication number
KR100812705B1
KR100812705B1 KR1020030097041A KR20030097041A KR100812705B1 KR 100812705 B1 KR100812705 B1 KR 100812705B1 KR 1020030097041 A KR1020030097041 A KR 1020030097041A KR 20030097041 A KR20030097041 A KR 20030097041A KR 100812705 B1 KR100812705 B1 KR 100812705B1
Authority
KR
South Korea
Prior art keywords
data
plc
host
data link
command
Prior art date
Application number
KR1020030097041A
Other languages
Korean (ko)
Other versions
KR20050065882A (en
Inventor
목임수
김중구
황용구
Original Assignee
주식회사 포스콘
재단법인 포항산업과학연구원
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 주식회사 포스콘, 재단법인 포항산업과학연구원 filed Critical 주식회사 포스콘
Priority to KR1020030097041A priority Critical patent/KR100812705B1/en
Publication of KR20050065882A publication Critical patent/KR20050065882A/en
Application granted granted Critical
Publication of KR100812705B1 publication Critical patent/KR100812705B1/en

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • G05B19/052Linking several PLC's
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/27Evaluation or update of window size, e.g. using information derived from acknowledged [ACK] packets

Abstract

본 발명은 논리 연산 장치에서 호스트 데이터 링크 방법에 관한 것이다. 본 발명의 논리 연산 장치(PLC)에서 호스트 데이터 링크 방법은, 호스트 명령을 체크하여, 최소 크기 이상의 호스트 명령을 받았을 경우, 유효한 명령인지 판단하는 제 1단계; 예상치의 데이터를 모두 수신한 경우에는, PLC 중앙 처리 장치(CPU)(PCPU)에 서비스를 요청하는 제 2단계; 및 PCPU로부터 받은 응답을 근거로 호스트 컴퓨터에 응답을 전송하는 제 3단계를 포함한다. 본 발명에 따르면, 마스터(MASTER) 기능을 수행하는 PLC와 슬레이브(SLAVE) 기능을 수행하는 PLC 상호간에 데이터 링크가 효율적으로 이루어지도록 함으로써, PLC간의 데이터 링크를 효율적으로 수행하고, 다채널 요구도 만족할 수 있도록 하는 효과가 있다.
The present invention relates to a host data link method in a logical computing device. The host data link method in the logical operation device (PLC) of the present invention includes: a first step of checking a host command and determining whether the command is valid when a host command of a minimum size or more is received; A second step of requesting a service from a PLC central processing unit (CPU) when all data of an expected value are received; And a third step of sending a response to the host computer based on the response received from the PCPU. According to the present invention, the data link between the PLC performing the master (MASTER) function and the PLC performing the slave (SLAVE) function can be efficiently performed, thereby efficiently performing the data link between the PLC and satisfy the multi-channel requirements. It has the effect of making it possible.

PLC, 데이터 링크, CPU, PCPU, 호스트 명령PLC, data link, CPU, PCPU, host instruction

Description

논리 연산 장치에서 호스트 데이터 링크 방법{Method for Linking Host Data in Programmable Logic Controller(PLC)} Method for Linking Host Data in Programmable Logic Controller (PLC)}             

도 1은 본 발명이 적용되는 통신 시스템의 개략도,1 is a schematic diagram of a communication system to which the present invention is applied;

도 2는 본 발명이 적용되는 PLC에서 호스트 데이터 링크 장치의 일실시예 구조도,2 is a structural diagram of an embodiment of a host data link device in a PLC to which the present invention is applied;

도 3은 본 발명에 따른 PLC에서 호스트 데이터 링크 방법을 설명하기 위한 일실시예 흐름도,3 is a flowchart illustrating a method of linking a host data in a PLC according to the present invention;

도 4a는 호스트 컴퓨터가 데이터 링크 장치에서 데이터를 읽는(Read) 경우의 데이터 구조도, 4A is a data structure diagram when a host computer reads data from a data link device;

도 4b는 호스트 컴퓨터로부터 데이터 링크 장치로 데이터를 쓰는(Write) 경우의 데이터 구조도,4B is a data structure diagram when writing data from a host computer to a data link device;

도 5a는 호스트 컴퓨터가 PCPU로부터 데이터를 읽을 때의 데이터 프로토콜의 제 1실시예 구조도, 5A is a structural diagram of a first embodiment of a data protocol when a host computer reads data from a PCPU;

도 5b는 호스트 컴퓨터가 PCPU로 데이터를 써넣을 때의 데이터 프로토콜의 제 1실시예 구조도,5B is a structural diagram of a first embodiment of a data protocol when a host computer writes data into a PCPU;

도 6a는 호스트 컴퓨터가 PCPU로부터 데이터를 읽을 때의 데이터 프로토콜의 제 2실시예 구조도,6A is a structural diagram of a second embodiment of a data protocol when a host computer reads data from a PCPU;

도 6b는 호스트 컴퓨터가 PCPU로 데이터를 써넣을 때의 데이터 프로토콜의 제 2실시예 구조도,6B is a structural diagram of a second embodiment of a data protocol when a host computer writes data into a PCPU;

도 7a는 호스트 컴퓨터가 PCPU로부터 데이터를 읽을 때의 데이터 프로토콜의 제 3실시예 구조도,7A is a structural diagram of a third embodiment of a data protocol when a host computer reads data from a PCPU;

도 7b는 호스트 컴퓨터가 PCPU로 데이터를 써넣을 때의 데이터 프로토콜의 제 3실시예 구조도,7B is a structural diagram of a third embodiment of a data protocol when a host computer writes data into a PCPU;

도 8a는 호스트 컴퓨터가 PCPU로부터 데이터를 읽을 때의 데이터 프로토콜의 제 4실시예 구조도,8A is a structural diagram of a fourth embodiment of a data protocol when a host computer reads data from a PCPU;

도 8b는 호스트 컴퓨터가 PCPU로 데이터를 써넣을 때의 데이터 프로토콜의 제 4실시예 구조도.
8B is a structural diagram of a fourth embodiment of a data protocol when a host computer writes data into a PCPU.

*도면의 주요 부분에 대한 부호의 설명* Explanation of symbols for the main parts of the drawings

210 : 주제어부 220 : 2포트 저장부210: main controller 220: 2-port storage unit

230 : 주저장부 240 : 버스 인터페이스부230: main storage unit 240: bus interface unit

250 : 부제어부 260 : UART250: sub-control unit 260: UART

270 : 인터페이스부
270 interface

본 발명은 논리 연산 장치에서 호스트 데이터 링크 방법에 관한 것으로, 특히 대규모 플랜트에서 제어기기와 구동기 및 각종 센서간 거리에 따른 입출력 데이터 링크에 있어 신뢰성을 극복하기 위해 사용되는 논리 연산 장치에서 호스트 데이터 링크 방법에 관한 것이다.BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a host data link method in a logic computing device, and more particularly to a host data link method in a logic computing device used to overcome reliability in input / output data link according to the distance between a controller, a driver and various sensors in a large-scale plant. It is about.

일반적으로 논리 연산 장치(Programmable Logic Controller; 이하, 간단히 'PLC'라 함)의 경우, 중앙 처리 장치(Central Processing Unit; 이하, 간단히 'CPU'라 함) 모듈 자체 내장된 시리얼 포트(Serial Port)를 통하여 통신 시스템을 구축할 수 다.Generally, in the case of a programmable logic controller (hereinafter, simply referred to as a 'PLC'), a central processing unit (hereinafter, simply referred to as a 'CPU') may use a serial port built in the module itself. Communication system can be established through

그러나, 동시에 여러 채널로 많은 양의 데이터를 통신하려면 별도의 여러 통신 포트를 내장하고 있는 유니트가 필요로 하게 되는데, 상기와 같은 종래의 PLC는, CPU 모듈 자체 내장된 시리얼 포트를 통하여 통신 시스템을 구축하고 있으므로, 원거리에 존재하는 구동기 및 다수의 센서간 데이터의 입출력 전송이 어려워지는 문제점이 있다.
However, in order to communicate a large amount of data through several channels at the same time, a unit having several separate communication ports is required. The conventional PLC, as described above, establishes a communication system through a serial port built in the CPU module itself. Therefore, there is a problem in that input / output transmission of data between a driver and a plurality of sensors that exist at a long distance becomes difficult.

본 발명은, 상기한 바와 같은 문제점을 해결하기 위하여 제안된 것으로, 여러 채널로 많은 양의 데이터를 통신하기 위하여, 별도의 여러 통신 포트를 내장함으로써, 원거리에 존재하는 구동기 및 다수의 센서간 데이터의 입출력을 용이하게 하기 위한, PLC에서 호스트 데이터 링크 방법을 제공하는데 그 목적이 있다.
The present invention has been proposed in order to solve the above problems, and in order to communicate a large amount of data through several channels, by embedding several separate communication ports, the data between the driver and a plurality of sensors that exist at a long distance The purpose is to provide a host data link method in a PLC for facilitating input and output.

상기 목적을 달성하기 위한 본 발명은, 논리 연산 장치(PLC)에서 호스트 데이터 링크 방법에 있어서, 호스트 명령을 체크하여, 최소 크기 이상의 호스트 명령을 받았을 경우, 유효한 명령인지 판단하는 제 1단계; 예상치의 데이터를 모두 수신한 경우에는, PLC 중앙 처리 장치(CPU)(PCPU)에 서비스를 요청하는 제 2단계; 및 PCPU로부터 받은 응답을 근거로 호스트 컴퓨터에 응답을 전송하는 제 3단계를 포함하는 PLC에서 호스트 데이터 링크 방법을 제공한다.According to an aspect of the present invention, there is provided a host data link method in a logical operation device (PLC), comprising: a first step of checking a host command and determining whether the command is valid when a host command of a minimum size or more is received; A second step of requesting a service from a PLC central processing unit (CPU) when all data of an expected value are received; And a third step of transmitting a response to the host computer based on the response received from the PCPU.

상술한 목적, 특징들 및 장점은 첨부된 도면과 관련한 다음의 상세한 설명을 통하여 보다 분명해 질 것이다. 우선 각 도면의 구성요소들에 참조 번호를 부가함에 있어서, 동일한 구성요소들에 한해서는 비록 다른 도면상에 표시되더라도 가능한 한 동일한 번호를 가지도록 하고 있음에 유의하여야 한다. 이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 일실시예를 상세히 설명한다.The above objects, features and advantages will become more apparent from the following detailed description taken in conjunction with the accompanying drawings. First of all, in adding reference numerals to the components of each drawing, it should be noted that the same components have the same number as much as possible even if displayed on different drawings. Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

도 1은 본 발명이 적용되는 통신 시스템의 개략도이다.1 is a schematic diagram of a communication system to which the present invention is applied.

도면에 도시된 바와 같이, 본 발명이 적용되는 통신 시스템은, 본 발명이 적용되는 시스템은, 본 발명의 데이터 링크 장치(110)와 로더(120)를 포함하여 구성되며, 다수의 호스트 컴퓨터 및 모뎀과 연동될 수 있다. 각 구성요소간의 통신은 유/무선 네트워크를 통하여 수행될 수 있다. As shown in the figure, the communication system to which the present invention is applied, the system to which the present invention is applied, comprises a data link device 110 and a loader 120 of the present invention, and a plurality of host computers and modems. It can be linked with. Communication between each component may be performed through a wired / wireless network.

도 2는 본 발명이 적용되는 PLC에서 호스트 데이터 링크 장치의 일실시예 구조도이다. 2 is a structural diagram of an embodiment of a host data link device in a PLC to which the present invention is applied.                     

도면에 도시된 바와 같이, 본 발명이 적용되는 링크 장치는, 주제어부(210), 2포트(port) 저장부(220), 주저장부(Main Memory)(230), 버스 인터페이스부(Bus Interface)(240), 부제어부(Control Logic)(250), 범용 비동기화 송수신기(Universal Asynchronous Receiver/Transmitter; 이하, 간단히 'UART'라 함)(260) 및 인터페이스부(270)를 포함하고 있다.As shown in the figure, the link device to which the present invention is applied includes a main controller 210, a two-port storage unit 220, a main memory unit 230, and a bus interface unit. 240, a control logic 250, a universal asynchronous receiver / transmitter (hereinafter, simply referred to as a 'UART') 260, and an interface 270.

상기 주저장부(230)는 프로그램 코드 및 데이터를 저장하는 기능을 담당하며, 상기 2포트 저장부(220)는 데이터 처리를 수행하는 기능을 담당한다.The main storage unit 230 is responsible for storing program codes and data, and the two-port storage unit 220 is responsible for performing data processing.

본 발명의 데이터 링크 장치는, 공유 메모리 접근(Dual Port Memory Access) 방식을 채용하고 있으므로, PLC 버스(BUS)에 직접 접근(Access)할 수 없으므로, 상기 버스 인터페이스(240)는 PLC 버스와 연동하도록 하는 기능을 담당한다.Since the data link device of the present invention adopts a dual port memory access method, it is not possible to directly access the PLC bus, so that the bus interface 240 interworks with the PLC bus. In charge of the function.

또한, 상기 인터페이스부(270)는 호스트 컴퓨터(130)와 통신을 수행하는 기능을 담당하며, 상기 UART(260)는 상기 주제어부(210)로부터 수신한 데이터를 비트 통신망에 접속시키는 기능을 담당한다.In addition, the interface unit 270 is responsible for communicating with the host computer 130, and the UART 260 is responsible for connecting the data received from the main control unit 210 to the bit communication network. .

상기 주제어부(210)는 PCPU(PLC CPU)의 제어를 수신하여, 데이터의 입출력을 제어하고 상기 주저장부(230)가 데이터를 저장하도록 맵(Map)을 할당하는 기능을 담당한다. 또한, 상기 2포트 저장부(220), 상기 UART(260)를 제어하는 기능을 담당한다.The main controller 210 receives a control of a PCPU (PLC CPU) to control input / output of data and allocates a map so that the main storage unit 230 stores the data. In addition, the two-port storage unit 220, responsible for the function to control the UART (260).

상기 부제어부(250)는 제어 데이터를 생성하고 해석하며 사용하는 기능을 담당한다.The sub-control unit 250 is responsible for generating, interpreting and using the control data.

상기와 같은 본 발명이 적용되는 호스트 데이터 링크 장치를 이용한 PLC에서 호스트 데이터 링크 방법을 설명하면 다음과 같다.Referring to the host data link method in the PLC using the host data link device to which the present invention as described above is as follows.

도 3은 본 발명에 따른 PLC에서 호스트 데이터 링크 방법을 설명하기 위한 일실시예 흐름도이다.3 is a flowchart illustrating a host data link method in a PLC according to the present invention.

본 발명의 데이터 링크 방법의 기동 명령에는 4개의 모드(긍정 응답(ACK), 부정 응답(NAK), 문의(ENQ), 텍스트 시작(STX))가 있으며, 본 발명의 데이터 링크 장치는, 하드웨어(hardware)를 초기화(S301)시킨 후 계속하여 호스트 명령(Host Command)을 체크한다(S302). The start command of the data link method of the present invention has four modes (acknowledgment (ACK), negative response (NAK), inquiry (ENQ), and text start (STX)). After initializing the hardware (S301), the host command is continuously checked (S302).

이 때, 최소 크기 이상의 호스트 명령을 받았을 경우, ACK, NAK, ENQ, STX를 구분하고 ACK, NAK인 경우는 곧바로 응답을 하고, ENQ, STX인 경우에는 예상되는 데이터의 크기를 계산하여 그 이상의 캐릭터(character)가 들어올 때까지 계속하여 기다린다(S304). At this time, if a host command of more than the minimum size is received, it distinguishes ACK, NAK, ENQ, and STX, and responds immediately in case of ACK and NAK. Wait until (character) comes in (S304).

예상치의 데이터를 모두 수신한 경우에는, 상기 PCPU에 서비스를 요청(S305)하게 되고, PCPU로부터 받은 응답(S306~S309)을 근거로 호스트 컴퓨터에 응답을 전송하게 된다(S310). When all data of the expected value is received, the service is requested to the PCPU (S305), and the response is transmitted to the host computer based on the response (S306 to S309) received from the PCPU (S310).

이 일련의 과정 중에 발생하는 에러는, 적절한 에러 코드로 처리하여 NAK로 보낸다(S304, S307). Errors occurring during this series of processes are processed by appropriate error codes and sent to the NAK (S304, S307).

한편, 본 발명의 데이터 링크 장치는, 상기 PCPU의 명령에 대하여 데이터 전송 및 수신이 가능하다.On the other hand, the data link device of the present invention can transmit and receive data with respect to the command of the PCPU.

PCPU는 어떤 포트를 사용할 것인가 하는 내용과 보낼 데이터 개수를 표시하여 명령을 보낸다. 이 경우 데이터 링크 장치는 해당 명령을 해당 포트로 보낼 수 있다.The PCPU sends a command indicating which port to use and how many data to send. In this case, the data link device can send the command to the corresponding port.

이 경우 먼저 상기 PLC 데이터 링크 장치를 'OPEN'해야 하는데 이 OPEN 명령을 통해서 PLC 데이터 링크 장치는 PCPU간 통신 포트로 정의하고 일반 호스트 명령 서비스는 중단하게 된다. In this case, the PLC data link device must first be 'OPEN'. Through this OPEN command, the PLC data link device is defined as a communication port between PCPUs, and the general host command service is stopped.

그리고, 데이터를 보낸 후 응답을 기다리는데 이 응답을 기다리는 시간을 'CONNECT' 명령을 통해 10msec 단위로 지정할 수 있다. 예를 들어 CONNECT 20을 하면 해당 포트로 데이터를 전송한 후, 200msec 단위로 응답을 기다리며, 200 msec마다 쌓인 데이터를 PCPU로 전달할 수 있다.After sending the data, the user waits for a response. The waiting time for this response can be specified in 10msec units through the 'CONNECT' command. For example, if CONNECT 20 is transmitted to the corresponding port, it waits for response in 200msec unit and can transfer the accumulated data to PCPU every 200msec.

본 발명의 PLC에서 호스트 데이터 링크 방법은, 4종류의 프로토콜(Protocol)과 다양한 명령(Command)을 사용하여, 호스트 컴퓨터를 포함하는 외부장치와 상기 PCPU간 데이터를 링크할 수 있다.The host data link method in the PLC of the present invention can link data between the PCPU and an external device including a host computer using four types of protocols and various commands.

이하, 본 발명에서 사용되는 4종류의 프로토콜에 대해서 설명하기로 하고, 우선 프로토콜의 일반적인 구조에 대하여 설명하기로 한다.Hereinafter, four types of protocols used in the present invention will be described, and first, a general structure of the protocols will be described.

도 4a는 호스트 컴퓨터가 데이터 링크 장치에서 데이터를 읽는(Read) 경우의 데이터 구조도이며, 도 4b는 호스트 컴퓨터로부터 데이터 링크 장치로 데이터를 쓰는(Write) 경우의 데이터 구조도이다.4A is a data structure diagram when the host computer reads data from the data link device, and FIG. 4B is a data structure diagram when data is written from the host computer to the data link device.

도 4a에서, A와 C 영역은 호스트 컴퓨터에서 PLC 데이터 링크 장치(Host Data Link; 이하, 간단히 'HDT'라 함)로 전송되는 데이터를 의미하며, B 영역은 PLC HDL에서 호스트 컴퓨터로 전송되는 데이터를 의미한다. 이때, 데이터의 전송은 왼쪽에서 오른쪽 순서로 진행되며, C 영역의 프로그램은 통신을 하지 않아도 통신 을 종료해서 다음 통신으로 들어갈 수 있도록 한다.In FIG. 4A, areas A and C mean data transmitted from a host computer to a PLC data link device (hereinafter, simply referred to as 'HDT'), and area B means data transmitted from a PLC HDL to a host computer. Means. At this time, data transmission proceeds in the order of left to right, and the program in the C area allows the communication to end and enter the next communication without communication.

도 4b에서, A 영역은 호스트 컴퓨터에서 PLC HDL로 전송되는 데이터를 의미하며, B 영역은 PLC HDL에서 호스트 컴퓨터로 전송되는 데이터를 의미한다. 이때, 데이터의 전송은 왼쪽에서 오른쪽 순서로 진행된다.In FIG. 4B, area A means data transmitted from the host computer to the PLC HDL, and area B means data transmitted from the PLC HDL to the host computer. At this time, the data is transferred in order from left to right.

상기와 같은 경우 PLC HDL은, 호스트 컴퓨터에서 아스키 코드(ASCII code)를 수신하여 빈 코드(BIN code)로 바꾼 후에 상기 PCPU에 데이터를 전송하며, 상기 PCPU에서 받은 빈 코드를 아스키 코드로 변환하여 호스트 컴퓨터로 전송할 수 있다. 즉, 모든 호스트 컴퓨터와 본 발명이 적용되는 PLC HDL과의 통신은 아스키 코드로 이루어진다.In this case, the PLC HDL receives the ASCII code from the host computer, converts it into a BIN code, and then transmits the data to the PCPU, converts the empty code received from the PCPU into an ASCII code to host. Can be transferred to a computer That is, communication between all host computers and PLC HDL to which the present invention is applied is made up of ASCII codes.

도 5a는 호스트 컴퓨터가 PCPU로부터 데이터를 읽을 때의 데이터 프로토콜의 제 1실시예 구조도이며, 도 5b는 호스트 컴퓨터가 PCPU로 데이터를 써넣을 때의 데이터 프로토콜의 제 1실시예 구조도이다.FIG. 5A is a structural diagram of a first protocol of a data protocol when a host computer reads data from a PCPU, and FIG. 5B is a structural diagram of a first protocol of a data protocol when a host computer writes data to a PCPU.

또한, 도 6a, 도 7a 및 도 8a는 호스트 컴퓨터가 PCPU로부터 데이터를 읽을 때의 데이터 프로토콜의 제 2 내지 제 4실시예 구조도이며, 도 6b, 도 7b 및 도 8b는 호스트 컴퓨터가 PCPU로 데이터를 써넣을 때의 데이터 프로토콜의 제 2 내지 제 4실시예 구조도이다.6A, 7A, and 8A are structural diagrams of the second to fourth embodiments of the data protocol when the host computer reads data from the PCPU, and FIGS. 6B, 7B, and 8B are diagrams illustrating how the host computer sends data to the PCPU. Structure diagrams of the second to fourth embodiments of the data protocol at the time of writing.

편의를 위하여, 상기 제 1 내지 제 4실시예에 대하여 포맷Ⅰ, 포맷Ⅱ, 포맷Ⅲ 및 포맷Ⅳ로 지칭하는 것으로 한다.For convenience, the first to fourth embodiments will be referred to as format I, format II, format III and format IV.

도면에 도시된 바와 같이, 포맷Ⅲ은 다른 포맷과 달라서 ENQ를 사용하지 않고, STX를 사용하므로 이를 이용해서 쉽게 구분할 수 있다. As shown in the figure, format III, unlike other formats, does not use ENQ and uses STX, so it can be easily distinguished using this.                     

포맷Ⅱ의 구분을 위해서는, 명령어의 위치를 파악하는 것이 필요하다. 다른 포맷은 모두 "ENQ(STX) + 국번호 + PC번호 + 명령어 + WAIT + …"의 형태를 가지지만, 포맷Ⅱ는 "ENQ + BL번호 + 국번호 + PC번호 + 명령어 + WAIT + …"와 같이 중간에 BL번호가 2바이트(byte) 더 들어가는 형태이다. To distinguish between format II, it is necessary to know the position of the instruction. All other formats have the form "ENQ (STX) + station number + PC number + command + WAIT +…", but format II is intermediate like "ENQ + BL number + station number + PC number + command + WAIT +…" BL number is 2 bytes more.

따라서, 다른 포맷과 같이 사용하면 6, 7번째 바이트를 명령으로 인식하므로, 포맷Ⅱ의 PC번호를 명령으로 인식하게 된다. 여기서 PC번호는 "FF"보다 큰 수일 수 없으므로, 호스트 컴퓨터에 대한 명령으로 인식할 가능성이 없다. 그러므로 포맷Ⅰ, 포맷Ⅲ 및 포맷Ⅳ의 형태로 명령을 분석하여 정의되지 않으면(undefined), 포맷Ⅱ로서의 명령을 분석해 볼 수 있다. 이와 같이, 포맷Ⅱ를 구분할 수 있다.Therefore, when used together with other formats, the 6th and 7th bytes are recognized as commands, so the PC number of format II is recognized as a command. Since the PC number cannot be greater than "FF", there is no possibility of recognizing it as a command to the host computer. Therefore, if the command is not defined by analyzing the commands in the format I, the format III, and the format IV, the command as the format II can be analyzed. In this way, format II can be distinguished.

포맷Ⅳ는 포맷Ⅰ과 여하한의 차이가 없으며, 마지막에 CR, LF가 더 붙는 것이다. 이 CR, LF는 체크섬(checksum) 계산에도 들어가지 않으므로, 체크섬(checksum) 이후에 이 문자(character)가 존재하는지에 대한 확인을 하면 구분할 수 있다. Format IV has no difference between Format I and CR, LF at the end. Since the CR and LF are not included in the checksum calculation, it can be distinguished by checking whether the character exists after the checksum.

상기와 같이, 포맷Ⅰ, 포맷Ⅱ, 포맷Ⅲ 및 포맷Ⅳ를 비교하면, 다음의 수학식과 같다.As described above, format I, format II, format III and format IV are compared with the following equation.

포맷ⅠFormat I

포맷Ⅱ = 포맷Ⅰ + 블럭(BL) 번호Format II = Format I + Block (BL) Number

포맷Ⅲ = 포맷Ⅰ + STX, ETXFormat III = Format I + STX, ETX

포맷Ⅳ = 포맷Ⅰ + CR, LF Format IV = Format I + CR, LF                     

이하, 각 데이터 포맷의 코드에 설명하기로 한다.The code of each data format will be described below.

모든 제어 코드는 16진법(Hexadecimal)으로 송/수신되며 다음의 표 1과 같다.All control codes are transmitted / received in hexadecimal and are shown in Table 1 below.

Figure 112003049605922-pat00001
Figure 112003049605922-pat00001

이때, 널코드(Null code)(00H)는 모든 메시지에서 무시하며, 포맷Ⅲ에서 "GG"와 "NN"는 타 포맷에서 "ACK" 및 "NAK"와 동일한 의미를 갖는다. At this time, the null code (00H) is ignored in all messages, and "GG" and "NN" in format III have the same meaning as "ACK" and "NAK" in other formats.

"BL 번호(Block Number)"는 많은 양의 데이터를 동시에 송수신하기 어려운 경우에 적절히 데이터를 참조하기 위한 임의의 번호이며, BL 번호는 00H-FFH까지 사용할 수 있다."BL Number" is an arbitrary number for appropriately referencing data when it is difficult to simultaneously transmit and receive a large amount of data, and the BL number can be used up to 00H-FFH.

"국번호(Station Number)"는 CPU 전면에 있는 2개의 국번호 설정 스위치에 의해서 결정되며, 해당국의 고유 번호를 나타낸다. 국번호는 00-99 까지 2 자리의 아스키 코드로 주어진다."Station Number" is determined by two station number setting switches on the front of the CPU, and indicates the unique number of the corresponding station. The station number is given as a two-digit ASCII code from 00 to 99.

"PC 번호(PC Number)"는 해당하는 호스트 컴퓨터의 번호이고 "FF"만 유용하며, "명령어"는 원하는 동작을 명령할 때 사용하며 호스트 컴퓨터에서 PLC HDL로의 명령을 의미한다. 상기 명령어는 2자리의 아스키 코드로 구성된다. "PC Number" is the number of the corresponding host computer and only "FF" is useful. "Command" is used to command the desired operation and refers to the command from the host computer to the PLC HDL. The command consists of two ASCII code.                     

한편, 어떤 종류의 컴퓨터는 데이터를 송신한 뒤 수신상태로 전환하기 위해서 지연시간이 필요한 경우가 있는데, 이때 "WAIT(Wait For Message)"는 적당한 지연시간을 컴퓨터의 사양에 맞게 지정할 수 있다.On the other hand, some types of computers may require a delay time in order to switch to a reception state after transmitting data. In this case, "WAIT (Wait For Message)" may specify an appropriate delay time according to the specifications of the computer.

"Sum Check Code"는 "*" 표시 부분에 대해서만 계산하고, 각 부분의 이진(Binary)값을 더하여 하위 1 바이트(8 비트)만을 2 자리의 아스키 코드로 전송한다.The "Sum Check Code" is calculated only for the "*" display part, and the binary value of each part is added, and only the lower 1 byte (8 bits) is transmitted as the 2-digit ASCII code.

"에러 코드(Error Code)"는 NAK 뒤에 전송되며 00H-FFH범위내의 2자리 숫자의 아스키 코드로 이루어진다. 만일 둘 이상의 에러가 동시에 발생되면 가장 낮은 번호의 코드만 전송된다.The "Error Code" is transmitted after the NAK and consists of a two-digit ASCII code in the 00H-FFH range. If more than one error occurs at the same time, only the lowest numbered code is sent.

상기 명령어의 종류를 다음의 표 2 및 표 3에 나타냈다. The types of commands are shown in Tables 2 and 3 below.                     

Figure 112003049605922-pat00002
Figure 112003049605922-pat00002

Figure 112003049605922-pat00003
Figure 112003049605922-pat00003

한편, 본 발명의 데이터 링크 방법은, CPU의 원격구동/제어(Remote RUN/STOP)와 CPU 형태(Type)를 읽을 때 사용될 수 있다. CPU 명령어는 다음 표 4와 같다. On the other hand, the data link method of the present invention can be used when reading the remote RUN / STOP and CPU type (Type) of the CPU. The CPU instructions are shown in Table 4 below.                     

Figure 112003049605922-pat00004
Figure 112003049605922-pat00004

또한, PLC HDL이 NAK 뒤에 제공하는 에러 코드는 다음의 표 5와 같으며, 여러 종류의 에러가 발생했다면 가장 낮은 번호의 코드만을 전송한다.In addition, the error codes that PLC HDL provides after the NAK are shown in Table 5 below. If several types of errors occur, only the lowest number code is transmitted.

Figure 112003049605922-pat00005
Figure 112003049605922-pat00005

마지막으로, 본 발명의 PLC HDL는 PCPU 간 시퀀스 프로그램(Sequence Program)을 통해 서로 데이터를 주고받을 뿐만 아니라, 일반 범용 시리얼 포트(Serial Port)와 데이터 송수신이 가능하다. 시퀀스 프로그램은 OPEN, CONNECT, ASEND, ARECV, CLOSE 5개의 명령을 사용하여 작성되며, 이 명령들을 사용하여 어떠한 구조의 데이터 프레임도 송수신 가능하다. Lastly, the PLC HDL of the present invention not only exchanges data with each other through a sequence program between PCPUs, but also transmits and receives data with a general serial port. The sequence program is written using five commands: OPEN, CONNECT, ASEND, ARECV, and CLOSE. Using these commands, data frames of any structure can be transmitted and received.

이에 사용되는 명령어를 상세히 설명하면 다음과 같다.The command used for this is described in detail as follows.

"OPEN node port STATUS(WR)"에서, "node"는 송수신 노드의 번호(node number)를 의미하며, "port"는 송수신 포트에서 상위 8 비트 슬롯 번호와, 하위 8 비트 슬롯 번호를 의미한다. 또한, "STATUS(WR)"는 STATUS 레지스터로 할당할 워드 레지스터(word register)를 의미한다.In "OPEN node port STATUS (WR)", "node" means a node number of a transmission and reception node, and "port" means an upper 8 bit slot number and a lower 8 bit slot number in the transmission and reception port. In addition, "STATUS (WR)" means a word register to be allocated to the STATUS register.

PLC HDL는 0 ~ 7번까지의 노드 번호를 사용할 수 있으며, 이 노드에 연결에 관한 모든 정보를 저장한다. 포트는 송수신할 모듈의 슬롯 번호와 포트 번호를 지정하며, STATUS에는 상태 레지스터로 사용할 레지스터를 지정한다.The PLC HDL can use node numbers from 0 to 7. It stores all the information about the connection to this node. The port designates the slot number and port number of the module to send and receive, and the register to use as the status register in STATUS.

또한, "CLOSE node"는 통신에 사용한 노드 정보를 초기화하며 연결된 통신모듈의 정보도 초기화한다. In addition, "CLOSE node" initializes the node information used for communication and also initializes the information of the connected communication module.

"ASEND node REG1 REG2"에서 REG1은 전송될 레지스터를 의미하며 REG2는 전송될 데이터 카운터를 의미한다.In "ASEND node REG1 REG2", REG1 means a register to be transmitted and REG2 means a data counter to be transmitted.

"ARECV node REG1 REG2"에서 REG1은 수신될 데이터를 저장할 레지스터를 의미하며, REG2는 수신될 최대 카운터를 의미한다. REG2에 지정된 값보다 많은 데이터가 수신된 경우에는 REG2에 지정된 수만큼의 데이터만 읽어 들인다. 만약 사용 가능한 레지스터가 50개뿐인데 수신 카운터가 50이 넘을 수도 있으므로, 이 값에 대한 최대값 정의는 필요하다. 50개 이하의 값을 받은 경우에는 수신한 카운터를 REG2에 저장한다.In "ARECV node REG1 REG2", REG1 means a register to store data to be received, and REG2 means a maximum counter to be received. If more data is received than the value specified in REG2, only the number of data specified in REG2 is read. If there are only 50 registers available and the Receive Counter may exceed 50, you need to define the maximum value for this value. When 50 or less values are received, the received counter is stored in REG2.

마지막으로 "CONNECT node DREG1 DREG2"는 PLC HDL의 수신 데이터를 받는 시간을 지정하는 명령이다. DREG1에 10msec 단위로 대기 시간(waiting time)을 지정한다. 이 명령을 실행하지 않으면 기본적으로 20의 값으로 지정되어 최초 수신 데이터를 받은 순간부터 200msec동안 데이터를 받아서 PCPU로 넘겨준다. DREG1에 200을 설정하면 2000msec 즉 2초 동안 기다리게 된다.Finally, "CONNECT node DREG1 DREG2" is a command to specify the time to receive the received data of the PLC HDL. Waiting time is specified in DREG1 in 10msec units. If this command is not executed, it is basically set to 20 and receives data for 200msec from the first received data and passes it to PCPU. If you set 200 in DREG1, it will wait 2000msec, or 2 seconds.

상술한 바와 같은 본 발명의 방법은 프로그램으로 구현되어 컴퓨터로 읽을 수 있는 기록매체(씨디롬, 램, 롬, 플로피 디스크, 하드 디스크, 광자기 디스크 등)에 저장될 수 있다.The method of the present invention as described above may be implemented as a program and stored in a computer-readable recording medium (CD-ROM, RAM, ROM, floppy disk, hard disk, magneto-optical disk, etc.).

이상에서 설명한 본 발명은 전술한 실시예 및 첨부된 도면에 의해 한정되는 것이 아니고, 본 발명의 기술적 사상을 벗어나지 않는 범위 내에서 여러 가지 치환, 변형 및 변경이 가능하다는 것이 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 있어 명백할 것이다.
The present invention described above is not limited to the above-described embodiments and the accompanying drawings, and various substitutions, modifications, and changes are possible in the art without departing from the technical spirit of the present invention. It will be clear to those of ordinary knowledge.

상기한 바와 같은 본 발명은, 마스터(MASTER) 기능을 수행하는 PLC와 슬레이브(SLAVE) 기능을 수행하는 PLC 상호간에 데이터 링크가 효율적으로 이루어지도록 함으로써, PLC간의 데이터 링크를 효율적으로 수행하고, 다채널 요구도 만족할 수 있도록 하는 효과가 있다.According to the present invention as described above, the data link between the PLC performing the master (MASTER) function and the PLC performing the slave (SLAVE) function is efficiently performed, thereby efficiently performing the data link between the PLC, and multi-channel This has the effect of satisfying the demand.

Claims (3)

논리 연산 장치(PLC)에서 호스트 데이터 링크 방법에 있어서,In the host data link method in a logical operation unit (PLC), 호스트 명령을 체크하여, 16진(Hecadecimal) 숫자가 최소 02H 이상의 호스트 명령을 받았을 경우, 유효한 명령인지 판단하는 제 1단계;Checking a host command and determining whether the command is valid when a Hexadecimal number is received at least 02H; 예상치의 데이터를 모두 수신한 경우에는, PLC 중앙 처리 장치(CPU)(PCPU)에 서비스를 요청하는 제 2단계; 및A second step of requesting a service from a PLC central processing unit (CPU) when all data of an expected value are received; And PCPU로부터 받은 응답을 근거로 호스트 컴퓨터에 응답을 전송하는 제 3단계The third step of sending a response to the host computer based on the response received from the PCPU 를 포함하는 PLC에서 호스트 데이터 링크 방법.Host data link method in the PLC including a. 제 1항에 있어서,The method of claim 1, 에러가 발생할 경우, 적절한 에러 코드로 처리하여 NAK를 전송하는 제 4단계If an error occurs, the fourth step of transmitting the NAK by treating it with an appropriate error code 를 더 포함하는 PLC에서 호스트 데이터 링크 방법.Host data link method in the PLC further comprising. 제 1항에 있어서,The method of claim 1, 상기 제 1단계의 유효한 명령인지의 판단은,The determination of the valid command of the first step, ACK, NAK, ENQ, STX를 구분하여, ACK/NAK인 경우는 곧바로 응답을 하고, ENQ/STX인 경우에는 예상되는 데이터의 크기를 계산하여 그 이상의 데이터가 수신 될 때까지 기다리는 것ACK, NAK, ENQ, STX is classified and responds immediately in case of ACK / NAK, and in case of ENQ / STX, calculates the expected data size and waits for receiving more data. 임을 특징으로 하는 PLC에서 호스트 데이터 링크 방법.Host data link method in the PLC, characterized in that.
KR1020030097041A 2003-12-26 2003-12-26 Method for Linking Host Data in Programmable Logic ControllerPLC KR100812705B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020030097041A KR100812705B1 (en) 2003-12-26 2003-12-26 Method for Linking Host Data in Programmable Logic ControllerPLC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020030097041A KR100812705B1 (en) 2003-12-26 2003-12-26 Method for Linking Host Data in Programmable Logic ControllerPLC

Publications (2)

Publication Number Publication Date
KR20050065882A KR20050065882A (en) 2005-06-30
KR100812705B1 true KR100812705B1 (en) 2008-03-26

Family

ID=37257032

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020030097041A KR100812705B1 (en) 2003-12-26 2003-12-26 Method for Linking Host Data in Programmable Logic ControllerPLC

Country Status (1)

Country Link
KR (1) KR100812705B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100824792B1 (en) * 2006-07-11 2008-04-24 삼성전자주식회사 Command processing devices and method thereof, and systems having the same

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR0179882B1 (en) * 1996-06-11 1999-05-15 이종수 Communication parameter setting method of plc
KR20060117031A (en) * 2005-05-12 2006-11-16 문형식 Mmi for programable logic controller and communication data processing method excuted by it

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR0179882B1 (en) * 1996-06-11 1999-05-15 이종수 Communication parameter setting method of plc
KR20060117031A (en) * 2005-05-12 2006-11-16 문형식 Mmi for programable logic controller and communication data processing method excuted by it

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
1000914040000
1001798820000
1020060117031

Also Published As

Publication number Publication date
KR20050065882A (en) 2005-06-30

Similar Documents

Publication Publication Date Title
CN101799795B (en) 1553B bus monitor and bus system with same
US7725630B2 (en) Protocol adapter for passing diagnostic messages between a host computer and vehicle networks operating in a J1989 or J1708 protocol
CN1595381B (en) Bridge controllers, bridge and method for operating the bridge
CN101681325B (en) The amendment equipment of PCI Express packet digest, system and method
US5875313A (en) PCI bus to IEEE 1394 bus translator employing write pipe-lining and sequential write combining
CN103714029B (en) Novel two-line synchronous communication protocol and application
CN1573723B (en) Method and apparatus for communication via serial multi-port
US6412032B1 (en) Interface for industrial controller network card
TW200405172A (en) Bus connection system
CN101529405A (en) A multi-function peripheral device, corresponding method and electronic system having a peripheral and a host communicating via a single interface
CN110334046A (en) A kind of communication means, the apparatus and system of SPI full duplex
CN101394349B (en) Data transmission method and system in communication of different interface devices
US7698493B2 (en) Methods and apparatus for translating write request messages in a computing system
CN102073611A (en) I2C bus control system and method
EP1998265A1 (en) Method for designing LSI (Large Scale Integration) system and design support device for LSI system
US5937175A (en) PCI bus to IEEE 1394 bus translator employing pipe-lined read prefetching
KR100812705B1 (en) Method for Linking Host Data in Programmable Logic ControllerPLC
CN101477501A (en) Data transmission system and method
CN100462952C (en) Interface configurable universal series bus controller
US7185119B2 (en) Method and apparatus for checking and analyzing the state of peripherals wherein state information is converted into a pattern of identification information
CN109753461B (en) DMA device and data transmission method
CN112732511A (en) High-performance high-speed synchronous 422 simulator board card based on HDLC protocol
CN1321382C (en) Serial/parallel data converting module and relative computer system
Depari et al. IEEE1451 smart sensors supporting USB connectivity
CN110247750B (en) Network transmission device and state synchronization method thereof

Legal Events

Date Code Title Description
N231 Notification of change of applicant
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20130304

Year of fee payment: 6

FPAY Annual fee payment

Payment date: 20140305

Year of fee payment: 7

LAPS Lapse due to unpaid annual fee