CAN communication device supporting MODBUS protocol and method for operating same
The CAN communication device supports MODBUS protocol by converting data frames, addressing complexity and extensibility issues, enabling efficient data transmission with MODBUS's advantages.
Patent Information
- Application Number
- JP2024534379
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-12-23
- Filing Date
- 2022-11-23
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2042-11-23
Smart Images

Figure 2024542849000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention claims the benefit of priority based on Korean Patent Application No. 10-2021-0186534, filed December 23, 2021, and all contents disclosed in the documents of the Korean patent application are incorporated as part of this specification.
[0002] The embodiments disclosed herein relate to a CAN communication device supporting the MODBUS protocol and a method of operation thereof. [Background technology]
[0003] In recent years, the electronics industry related to automobiles has grown rapidly as a result of the development of autonomous driving technology and electronic control systems. As electronic devices are used in various areas of automobiles, such as engine and drive control, multimedia playback, information processing for autonomous driving, and safety device control, communication technology for connecting electronic devices in vehicles has also become important. In the past, all electronic devices were connected with dedicated wiring, but as the number of electronic devices in vehicles increases and their functions become more complex, communication technologies and protocols that can provide high bandwidth while reducing the complexity of wiring are required.
[0004] CAN (Controller Area Network) communication is a typical protocol for sending and receiving data between electronic devices in a vehicle. CAN communication is designed so that controllers and devices within the system can communicate with each other without a host computer, and has the advantages of being resistant to electrical noise and being able to configure a communication system at low cost. In most cases, CAN communication devices use standard protocols or users define their own communication protocols. Standard protocols are advantageous in terms of expandability but have the disadvantage of being complex, while user-defined protocols are simple but have the disadvantage of being poor in expandability. In particular, many industrial devices use the MODBUS protocol, which has the advantages of being lightweight and highly expandable. Although there are standards for serial and TCP / IP communication, there are no standards for CAN communication, making it difficult to directly use it. Summary of the Invention [Problem to be solved by the invention]
[0005] It is an object of the embodiments disclosed herein to provide a CAN communication device that supports the MODBUS protocol and a method of operating the same.
[0006] The technical problems of the embodiments disclosed in this specification are not limited to the technical problems mentioned above, and other technical problems not mentioned will be clearly understood by those skilled in the art from the following description. [Means for solving the problem]
[0007] According to one embodiment, a CAN (Controller Area Network) communication device supporting the MODBUS protocol includes a communication unit that receives a MODBUS data frame from a device, and a controller that converts the MODBUS data frame into at least one CAN data frame, each of which includes identification information corresponding to a transmission / reception type of the data frame and an order in which the data is composed.
[0008] In one embodiment of a CAN communication device, the MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, and the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
[0009] In one embodiment of a CAN communication device, the controller may be configured to map the first data portion of the MODBUS data frame to a portion of the fifth data portion of the CAN data frame, map the second data portion of the MODBUS data frame to the sixth data portion of the CAN data frame, map the third data portion of the MODBUS data frame to the seventh data portion of the CAN data frame, and map the fourth data portion of the MODBUS data frame to the eighth data portion of the CAN data frame.
[0010] In one embodiment of a CAN communication device, the controller may be configured to, when mapping the third data section to the seventh data section, if the size of the third data section exceeds a set value, map the excess portion of the third data section to the seventh data section of a new CAN data frame.
[0011] In one embodiment of a CAN communication device, the identification information of the CAN data frame may include at least one of address information mapped in the first data portion of the MODBUS data frame, total frame number information of the at least one CAN data frame, sequence information of a frame currently being transmitted among the at least one CAN data frame, requester identification information for identifying a device that has requested the CAN data frame among one or more receiving devices, transmission / reception identification information for identifying whether the CAN data frame corresponds to a requested data frame, and transmission / reception type information of the CAN data frame.
[0012] According to one embodiment, a CAN communication device supporting the MODBUS protocol includes a controller that checks sequence information of a CAN data frame transmitted via a CAN communication bus, and if the sequence of the CAN data frame is first, initializes a receive buffer and sets a receive flag based on the total frame number information, and if the sequence of the CAN data frame is not first, stores CAN message data of the CAN data frame while removing a receive flag corresponding to the sequence of the CAN data frame, and if all the receive flags have been removed, sequentially maps the stored CAN message data according to the sequence information to convert it into a MODBUS data frame, and a communication unit that transmits the MODBUS data frame to a device. In one embodiment of the CAN communication apparatus, the devices may include multiple master devices or multiple slave devices.
[0013] According to one embodiment, a method for operating a CAN (Controller Area Network) communication device supporting a MODBUS protocol may include a step of receiving a MODBUS data frame from a first device, and a step of converting the MODBUS data frame into at least one CAN data frame each including identification information corresponding to a transmission / reception type of the data frame and an order in which the data is composed.
[0014] In one embodiment of an operating method of a CAN communication device, the MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, and the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
[0015] In one embodiment of an operating method of a CAN communication device, the MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, and the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
[0016] In one embodiment, in a method for operating a CAN communication device, the step of converting the MODBUS data frame into at least one CAN data frame includes the steps of mapping the first data portion of the MODBUS data frame to a portion of the fifth data portion of the CAN data frame, mapping the second data portion of the MODBUS data frame to the sixth data portion of the CAN data frame, mapping the third data portion of the MODBUS data frame to the seventh data portion of the CAN data frame, and mapping the fourth data portion of the MODBUS data frame to the eighth data portion of the CAN data frame.
[0017] In one embodiment of a method for operating a CAN communication device, the step of mapping the third data section to the seventh data section may include a step of mapping an excess portion of the third data section to the seventh data section of a new CAN data frame if the size of the third data section exceeds a set value.
[0018] In one embodiment of a method for operating a CAN communication device, the identification information of the CAN data frame may include at least one of address information mapped in the first data portion of the MODBUS data frame, total frame number information of the at least one CAN data frame, sequence information of a frame currently being transmitted among the at least one CAN data frame, requester identification information for identifying a device that has requested the CAN data frame among one or more receiving devices, transmission / reception identification information for identifying whether the CAN data frame corresponds to a requested data frame, and transmission / reception type information of the CAN data frame.
[0019] In one embodiment, a method of operating a CAN communication device may further include converting at least one CAN data frame transmitted via the CAN communication bus into a MODBUS data frame, and transmitting the MODBUS data frame to a second device.
[0020] In one embodiment of a method for operating a CAN communication device, the step of converting the at least one CAN data frame into a MODBUS data frame may include the steps of: checking sequence information of the CAN data frame; if the sequence of the CAN data frame is first, initializing a receive buffer and setting a receive flag based on the total frame number information; if the sequence of the CAN data frame is not first, storing CAN message data of the CAN data frame while removing a receive flag corresponding to the sequence of the CAN data frame; and if all the receive flags have been removed, sequentially mapping the stored CAN message data according to the sequence information to convert it into a MODBUS data frame.
[0021] In one embodiment, in a method of operating a CAN communication device, the step of sequentially mapping the stored CAN message data according to the order information to convert it into a MODBUS data frame may include the steps of mapping a portion of the fifth data section of the CAN data frame onto a portion of the first data section of the MODBUS data frame, mapping the sixth data section of the CAN data frame onto the second data section of the MODBUS data frame, mapping the seventh data section of the CAN data frame onto the third data section of the MODBUS data frame, and mapping the eighth data section of the CAN data frame onto the fourth data section of the MODBUS data frame.
[0022] In one embodiment of the method for operating a CAN communication device, the first device or the second device may include a plurality of master devices or a plurality of slave devices. Effect of the Invention
[0023] According to the above embodiment, communication can be performed using the MODBUS protocol when transmitting and receiving data between devices using CAN communication. In the existing CAN communication method, when a standard protocol is used, it is advantageous in terms of scalability but has the disadvantage of being complicated, and a user-defined protocol is relatively simple but has the disadvantage of being disadvantageous in terms of scalability. The CAN communication device proposed in the embodiment supports the MODBUS communication protocol, and can utilize the advantages of the MODBUS protocol, such as lighter processes, increased data scalability, and free provision of standard documents. In addition, various other effects can be obtained directly or indirectly from this specification. [Brief description of the drawings]
[0024] In order to more clearly describe the embodiments disclosed in this specification or the technical solutions of the prior art, drawings necessary for the description of the embodiments are briefly introduced below. It should be understood that the following drawings are only for describing the embodiments of this specification and are not intended to be limiting. In addition, for the sake of clarity, the expressions of some components in the drawings may be exaggerated or omitted.
[0025] [Figure 1a] 1 is a block diagram showing a configuration of a CAN communication device that supports the MODBUS protocol according to an embodiment. [Figure 1b] 1 is a block diagram showing a configuration of a CAN communication device that supports the MODBUS protocol according to an embodiment. [Figure 2a] 1 illustrates communication between multiple devices using a CAN communication device that supports the MODBUS protocol according to one embodiment. [Figure 2b] 1 illustrates communication between multiple devices using a CAN communication device that supports the MODBUS protocol according to one embodiment. [Diagram 3] 4 is a flowchart illustrating an operation method of a CAN communication device supporting a MODBUS protocol according to an embodiment. [Figure 4] 1 illustrates mapping of a MODBUS data frame to a CAN data frame at the transmitting end of a CAN communication device according to an embodiment. [Diagram 5] 1 illustrates a structure of identifier (ID) data of a CAN data frame according to one embodiment. [Figure 6] 1 illustrates mapping a MODBUS data frame into two or more CAN data frames at the transmitting end of a CAN communication device according to an embodiment. [Figure 7] 4 is a flowchart illustrating a process of converting a CAN data frame into a MODBUS data frame at a receiving end of a CAN communication device according to an embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0026] Hereinafter, the embodiments disclosed in this specification will be described in detail with reference to the exemplary drawings. When referring to components in each drawing, it should be noted that the same components are referred to by the same reference numerals as much as possible when they are displayed in other drawings. In addition, when describing the embodiments disclosed in this specification, if a detailed description of related known configurations or functions is determined to hinder understanding of the embodiments disclosed in this specification, the detailed description will be omitted.
[0027] The terms used in this specification are currently selected as widely used and common terms as possible while taking into consideration the functions, but these may vary depending on the intention or practice of the technical personnel in the field, or the emergence of new technologies. In addition, in certain cases, the applicant may arbitrarily select terms, and in such cases, the meanings of the terms are described in the description of the specification. Therefore, it is clear that the terms used in this specification must be interpreted based on the substantial meanings of the terms and the overall content of this specification, rather than simply the names of the terms.
[0028] The terms used in this specification are merely used to describe a particular embodiment and are not intended to limit the scope of other embodiments. A singular expression may include a plural expression unless otherwise clearly indicated in the context.
[0029] <Configuration of CAN communication device that supports MODBUS protocol> FIG. 1a is a block diagram showing the configuration of a CAN communication device supporting the MODBUS protocol according to an embodiment.
[0030] 1a, a CAN communication device 10 according to an embodiment includes a communication unit 110 that receives a MODBUS data frame from a first device 20 or transmits a MODBUS data frame to a second device 30, and a controller 120 that converts a MODBUS data frame into a CAN data frame or converts a CAN data frame into a MODBUS data frame. In this specification, expressions such as "first" and "second" are used to distinguish components from each other and do not indicate a rank or hierarchy between the components.
[0031] The first device 20 and the second device 30 are devices designed to exchange data via CAN communication, and may be, for example, but not limited to, electronic devices in a vehicle, general or industrial PCs, embedded devices, etc. Although not shown, each of the devices 20, 30 may include a processor for processing data and a communication unit for communicating with other devices. The devices 20, 30 may output or receive input of request / response message data as MODBUS data.
[0032] In one embodiment, the first device 20 may be a master device that requests responses from other devices, and the second device 30 may be a slave device that receives requests from other devices and responds to them, or vice versa, the first device 20 may be a slave device and the second device 30 may be a master device.
[0033] At the transmitting end of the apparatus 10, the controller 120 converts the MODBUS data frame input from the first device 20 into at least one CAN data frame. The process in which the controller 120 converts the MODBUS data frame into the CAN data frame will be described later with reference to FIGS. 3 to 6.
[0034] At the receiving end of the device 10, the controller 120 converts the at least one CAN data frame transmitted over the CAN communication bus into a MODBUS data frame, as will be described below with reference to FIG.
[0035] In the structure shown in Fig. 1a, the first device 20 operates as a transmitting device that transmits MODBUS data frames, and the second device 30 operates as a receiving device, but the reverse is also possible. For example, in the structure shown in Fig. 1b, the first device 20 can operate as a receiving device that receives MODBUS data frames, and the second device 30 can operate as a transmitting device. In this way, each device 20, 30 can transmit and receive data in both directions, and the communication device 10 can convert between MODBUS data frames and CAN data frames.
[0036] In one embodiment, the first device 20 may be a plurality of master devices, and the second device 30 may be a plurality of slave devices. In this case, when one of the plurality of master devices requests one of the slave devices for a response, the communication unit 110 transmits a data frame to the slave device corresponding to the request via the CAN communication bus.
[0037] 2a shows communication between multiple devices using a CAN communication device 10 supporting the MODBUS protocol according to one embodiment. Referring to FIG. 2a, there are multiple master devices 21, 22, 23, etc. and multiple slave devices 31, 32, 33, 34, etc., and the CAN communication device 10 relays communication between the devices by mutual conversion of data frames.
[0038] For example, when the master device 21 requests a response from the slave device 32, the apparatus 10 receives a MODBUS data frame from the master device 21 and converts it into a CAN data frame. The apparatus 10 also converts the CAN data frame transmitted via the CAN communication bus back into a MODBUS data frame and transmits it to the slave device 32.
[0039] 2b shows an operation in which the slave device 32 responds to a request from the master device 21, which is the opposite of that in FIG. 2a. In this case, the apparatus 10 receives an input of a MODBUS data frame from the slave device 32 and converts it into a CAN data frame. The apparatus 10 also converts the CAN data frame transmitted via the CAN communication bus back into a MODBUS data frame and transmits it to the master device 21. In this way, the apparatus can operate as either a transmitting end or a receiving end according to the device's request and response.
[0040] <Operation method of CAN communication device supporting MODBUS protocol> The operation method of the CAN communication device supporting the MODBUS protocol will be described below. The configuration of the CAN communication device supporting the MODBUS protocol is as described with reference to Figures 1a-1b and 2a-2b.
[0041] FIG. 3 is a flow chart illustrating a method of operating a CAN communication device supporting the MODBUS protocol according to an embodiment. 3, first, a step (S310) of receiving a MODBUS data frame from a first device is performed. The step (S310) may be performed by the communication unit 110 of the apparatus 10, and the first device 20 may be a master device that requests a response from other devices, or a slave device that receives a request from other devices and responds thereto.
[0042] The MODBUS data frame has a structure according to the MODBUS communication protocol standard. FIG. 4 illustrates the structure of the MODBUS data frame according to an embodiment. Referring to FIG. 4, the MODBUS data frame may be composed of a first data section D1 including address information, a second data section D2 including a function code, a third data section D3 including MODBUS message data, and a fourth data section D4 including a CRC value. The function of each data section will be described. The address information includes the IP addresses of a sending device (e.g., a first device) and a receiving device (e.g., a second device), and the function code is a command set code provided by the MODBUS protocol, which allows a value to be read or written in the memory of the device. The MODBUS message data includes the contents of the message to be read or written. The CRC value is a check value for checking whether or not there is an error in the transmitted data when transmitting the data over a network using a cyclic redundancy check method. Before transmitting data, a CRC value is calculated based on the value of the given data and attached to the data before transmission. After data transmission is complete, the CRC value is calculated again based on the value of the received data, and the two values are compared to detect errors.
[0043] 3, next, a step (S320) of converting the MODBUS data frame into at least one CAN data frame is performed. Step (S320) may be performed by the controller 120 of the device 10, and the controller 120 can appropriately convert the data frame so that data conforming to the MODBUS protocol standard can be exchanged using the CAN communication bus.
[0044] 4 illustrates mapping of a MODBUS data frame to a CAN data frame according to one embodiment. In an embodiment, the MODBUS message data (Message Data 1-5) of the third data portion D3 occupies 5 bytes.
[0045] 4, the CAN data frame includes a fifth data section D5 including identification information of the CAN data frame, a sixth data section D6 including a function code, a seventh data section D7 including CAN message data, and an eighth data section D8 including a CRC value. The functions of the data areas (D5 to D8) are the same as those of the data areas (D1 to D4) of the MODBUS data frame described above, and therefore will not be repeated here.
[0046] According to a specific embodiment, the first data part D1 of the MODBUS data frame is mapped to a part of the fifth data part D5 of the CAN data frame, the second data part D2 is mapped to the sixth data part D5, the third data part D3 is mapped to the seventh data part D7, and the fourth data part D4 is mapped to the eighth data part D8. In addition to the address information (Slave Address) mapped in the first data part D1, the fifth data part D5 of the CAN data frame may further include identifier (ID) data for correctly identifying or receiving the data frame at the receiving end.
[0047] 5 shows the structure of identifier data (fifth data section D5) of a CAN data frame according to one embodiment. In the embodiment, the fifth data section D5 is composed of 29 bits (0 to 28 bits), and the table shows the abbreviation of the field corresponding to each bit.
[0048] SA, which corresponds to bits 0 to 7, contains address information of the requesting and responding devices as a slave address. FC, which corresponds to bits 8 to 12, indicates the order of the currently transmitted frame as a frame count when there are two or more CAN data frames, and can have a value between 0 and 31. For example, FC=0 indicates that it is the first frame of two or more CAN data frames.
[0049] The RID corresponding to bits 13 to 15 indicates a requester identifier for identifying the device that requested the CAN data frame, and can have a value between 0 and 7. The RID is used, for example, as an identifier for a request in communication between multiple devices or in multi-processing within a single device. Using the RID identification information, communication between multiple MODBUS master devices and slave devices is possible.
[0050] FN, which corresponds to bits 16 to 21, is a Frame Number that indicates the total number of CAN data frames corresponding to MODBUS requests and responses, and can have a value between 1 and 32. For example, when the number of MODBUS message data exceeds a set value and is converted into two or more CAN data frames, FN=2 means that the number of converted CAN data frames is two.
[0051] The TID corresponding to bits 24 to 25 is a transaction identifier, which indicates transmission / reception identification information for identifying whether the CAN data frame corresponds to a requested data frame. For example, the slave device stores the TID included in the transmission data of the master device and returns it when responding, and the master device can check whether the currently received response frame corresponds to the requested TID through the returned TID.
[0052] TT, which corresponds to 28 bits, indicates the transmission / reception type information of the CAN data frame as a transaction type. For example, if the type of the CAN data frame corresponds to a request from the master device, it may be 0, and if it corresponds to a response from the slave device, it may be 1. By using it, the type of the CAN data frame currently being transmitted and received can be easily understood.
[0053] In the above embodiment, an example was given in which the MODBUS message data (Message Data 1 to 5) in the MODBUS data frame is 5 bytes, but if the message data exceeds a set value, it may be converted into two or more CAN data frames.
[0054] FIG. 6 illustrates that the controller 120 of the CAN communication device 10 according to an embodiment maps a MODBUS data frame to two or more CAN data frames. In the embodiment, the MODBUS message data (Message Data 1-10) of the third data section D3 occupies 10 bytes. According to the embodiment, the CAN data frame can be mapped with up to 10 bytes of data, and can include 7 bytes of data excluding the fifth data section D5 including identification information and address information and the sixth data section D6 including a function code. Therefore, only a part of the 10 bytes of message data (Message Data 1-7) is mapped to the seventh data section D7 of the first CAN data frame, and the excess message data (Message Data 8-10) and CRC value are mapped to the seventh data section D7' and the eighth data section D8' of the new second CAN data frame, respectively.
[0055] In this case, the first and second CAN data frames each include identification information in the fifth data section D5, D5', where FN=2, FC=0 (the first frame of the two total frames) of the first CAN data frame and FN=2, FC=1 (the second frame of the two total frames) of the second CAN data frame. By using the frame count (FC) identification information, multiple CAN data frames transmitted non-sequentially can be reconstructed in sequence and converted into a MODBUS data frame.
[0056] According to another example, if the message data exceeds 14, the excess data can be mapped to a new third CAN data frame, in which the first CAN data frame has identification information of FN=3, FC=0, the second CAN data frame has identification information of FN=3, FC=1, and the third CAN data frame has identification information of FN=3, FC=2.
[0057] 3, step (S320) is followed by a step (S330) of converting at least one CAN data frame transmitted over the CAN communication bus into a MODBUS data frame, which may be performed by controller 120 of device 10.
[0058] According to one embodiment, the step of converting the at least one CAN data frame into a MODBUS data frame (S330) may include the steps of checking sequence information of the CAN data frame; if the sequence of the CAN data frame is first, initializing a receive buffer and setting a receive flag based on the total frame number information; if the sequence of the CAN data frame is not first, removing the receive flag corresponding to the sequence of the CAN data frame and storing the CAN message data of the CAN data frame; and if all the receive flags have been removed, sequentially mapping the stored CAN message data according to the sequence information to convert it into a MODBUS data frame.
[0059] FIG. 7 is a flow diagram illustrating a process for converting a CAN data frame to a MODBUS data frame, according to one embodiment. 7, first, it is determined whether a new CAN data frame has been received (S710). If a new CAN data frame has been received (S710→YES), the process proceeds to the next step (S720). If a new CAN data frame has not been received (S710→NO), the CAN message data already stored in the receive buffer is converted to MODBUS data (S760), and the process ends.
[0060] Next, it is determined whether the CAN data frame is the first in sequence (S720). When there are two or more CAN data frames, the sequence of the received frame can be determined from the Frame Count (FC) value included in the identification information (see FIG. 5). If the FC of the received CAN data frame is 0, it is determined that the data frame is the first in sequence (S720→Yes), and the process proceeds to the next step (S730) to initialize the receive buffer and set a receive flag based on the total frame number information. If the FC of the received CAN data frame is not 0, it is determined that the data frame is not the first in sequence (S720→No), and the process proceeds to step (S740) without going through step (S730) (i.e., without initializing the receive buffer and setting the flag).
[0061] Next, the CAN data frame is stored while removing the reception flag corresponding to the order of the received CAN data frame (ie, corresponding to the FC value) (S740).
[0062] Next, it is confirmed whether all the reception flags have been removed (S750). If all the reception flags have been removed (S750→Yes), one or more CAN data frames have been completely received, and the process proceeds to the next step (S760). If reception flags remain (S750→No), there are still CAN data frames to be received, and the process returns to step (S710) to wait for the reception of a new CAN data frame.
[0063] If all CAN data frames have been received, the CAN message data stored in the receive buffer is converted into a MODBUS data frame by sequentially mapping according to the order information (FC value) (S760). The conversion process is in the reverse order of the conversion of the MODBUS data frame into the CAN data frame, and may include, for example, a step of mapping a part of the fifth data section of the CAN data frame into a part of the first data section of the MODBUS data frame, a step of mapping a sixth data section of the CAN data frame into a second data section of the MODBUS data frame, a step of mapping a seventh data section of the CAN data frame into a third data section of the MODBUS data frame, and a step of mapping an eighth data section of the CAN data frame into a fourth data section of the MODBUS data frame.
[0064] Through the above steps (S710 to S760), one or more CAN data frames can be reconstructed in sequence and converted into a MODBUS data frame. In this way, the FC values of the CAN data frames can be used to reconstruct the CAN data frames that are transmitted out of sequence into the correct sequence.
[0065] 3, the step (S340) of outputting the MODBUS data frame to the second device is performed by the communication unit 110 of the apparatus 10, and the second device 30 may be a receiving device, a slave device that receives a response request from the master device, or a master device that receives a response in response to a request from the slave device.
[0066] The method of operating the CAN communication device supporting the MODBUS protocol according to the above-mentioned embodiment may be implemented as an application or in the form of program instructions executable by various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program instructions, data files, data structures, and the like, alone or in combination.
[0067] According to the embodiment described above, communication can be performed using the MODBUS protocol when transmitting and receiving data between devices using CAN communication. In the existing CAN communication method, when a standard protocol is used, it is advantageous in terms of scalability but has the disadvantage of being complicated, and a user-defined protocol is relatively simple but has the disadvantage of being disadvantageous in terms of scalability. The CAN communication device proposed in the embodiment and the communication system using the same support the MODBUS communication protocol, and can utilize the advantages of the MODBUS protocol, such as lighter processes, increased data scalability, and free provision of standard documents.
[0068] Although it has been described above that all components constituting the embodiments are combined or operate in combination, the present invention is not necessarily limited to such an embodiment, and all components may be selectively combined and operate in one or more combinations within the scope of the purpose. Furthermore, the terms "include," "constitute," "have," and the like described above mean that the relevant component can be contained within the description, unless otherwise specified, and therefore should not be interpreted as excluding other components, but as including other components.
[0069] The above description is merely an illustrative example of the technical ideas disclosed in this specification, and a person having ordinary knowledge in the technical field to which the embodiments disclosed in this specification belong can make various modifications and variations within the scope of the essential characteristics of the embodiments disclosed in this specification. Therefore, the embodiments disclosed in this specification are intended to explain, not to limit, the technical ideas disclosed in this specification, and the scope of the technical ideas disclosed in this specification is not limited by such embodiments. The scope of protection of the technical ideas disclosed in this specification must be interpreted according to the claims below, and all technical ideas within the equivalent scope should be interpreted as being included in the scope of the present specification. [Explanation of symbols]
[0070] 10 CAN communication device 20 First Device 21-23 Master Device 30 Second Device 31-34 Slave Devices 110 Communications Department 120 Controller
Claims
1. A communication unit that receives a MODBUS data frame from the device; a controller for converting the MODBUS data frame into at least one CAN data frame, each of which includes identification information corresponding to a transmission / reception type of the data frame and an order of data configuration; 1. A CAN communication device supporting a MODBUS protocol, comprising:
2. The MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, 2. The CAN communication device supporting the MODBUS protocol of claim 1, wherein the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
3. The controller: Mapping the first data portion of the MODBUS data frame to a portion of the fifth data portion of the CAN data frame; Mapping the second data portion of the MODBUS data frame into the sixth data portion of the CAN data frame; Mapping the third data portion of the MODBUS data frame into the seventh data portion of the CAN data frame; 3. The CAN communication device supporting the MODBUS protocol according to claim 2, wherein the fourth data portion of the MODBUS data frame is mapped to the eighth data portion of the CAN data frame.
4. 4. The CAN communication device supporting the MODBUS protocol of claim 3, wherein when mapping the third data portion to the seventh data portion, if a size of the third data portion exceeds a set value, the controller maps the excess portion of the third data portion to the seventh data portion of a new CAN data frame.
5. The identification information of the CAN data frame is Address information mapped in the first data portion of the MODBUS data frame; Total frame number information of the at least one CAN data frame; sequence information of a currently transmitted one of the at least one CAN data frame; requester identification information for identifying a device that has requested the CAN data frame among one or more receiving devices; Transmit / receive identification information for identifying whether the CAN data frame corresponds to a requested data frame; and The CAN communication device supporting the MODBUS protocol of claim 2 , further comprising at least one of the transmission and reception type information of the CAN data frame.
6. a controller for checking sequence information of a CAN data frame transmitted through a CAN communication bus, initializing a receive buffer and setting a receive flag based on total frame number information if the sequence of the CAN data frame is first, storing CAN message data of the CAN data frame while removing a receive flag corresponding to the sequence of the CAN data frame if the sequence of the CAN data frame is not first, and converting the stored CAN message data into a MODBUS data frame by sequentially mapping the stored CAN message data according to the sequence information if all the receive flags have been removed; A communication unit that transmits the MODBUS data frame to a device; 1. A CAN communication device supporting a MODBUS protocol, comprising:
7. The MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, The CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value, The controller: Mapping a portion of the fifth data section of the CAN data frame onto a portion of the first data section of the MODBUS data frame; Mapping the sixth data portion of the CAN data frame into the second data portion of the MODBUS data frame; Mapping the seventh data portion of the CAN data frame into the third data portion of the MODBUS data frame; 7. The CAN communication device supporting the MODBUS protocol of claim 6, wherein the eighth data portion of the CAN data frame is mapped to the fourth data portion of the MODBUS data frame.
8. The CAN communication apparatus supporting the MODBUS protocol according to claim 1 or 6, wherein the devices include a plurality of master devices or a plurality of slave devices.
9. A method for operating a CAN (Controller Area Network) communication device supporting a MODBUS protocol, comprising: receiving a MODBUS data frame from a first device; converting the MODBUS data frame into at least one CAN data frame, each of which includes identification information corresponding to a transmission / reception type of the data frame and a data configuration sequence; A method of operating a CAN communication device supporting a MODBUS protocol, comprising:
10. The MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, 10. The method of claim 9, wherein the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
11. The step of converting the MODBUS data frame into the at least one CAN data frame comprises: mapping the first data portion of the MODBUS data frame onto a portion of the fifth data portion of the CAN data frame; mapping the second data portion of the MODBUS data frame to the sixth data portion of the CAN data frame; mapping the third data portion of the MODBUS data frame to the seventh data portion of the CAN data frame; and mapping the fourth data portion of the MODBUS data frame to the eighth data portion of the CAN data frame.
12. The step of mapping the third data portion to the seventh data portion comprises:
12. The method of claim 11, further comprising the step of: mapping an excess of the third data portion to a seventh data portion of a new CAN data frame if the size of the third data portion exceeds a set value.
13. The identification information of the CAN data frame is Address information mapped in the first data portion of the MODBUS data frame; Total frame number information of the at least one CAN data frame; sequence information of a currently transmitted one of the at least one CAN data frame; requester identification information for identifying a device that has requested the CAN data frame among one or more receiving devices; Transmit / receive identification information for identifying whether the CAN data frame corresponds to a requested data frame; and The method of claim 10, further comprising at least one of transmission and reception type information of the CAN data frame.
14. converting at least one CAN data frame transmitted over the CAN communication bus into a MODBUS data frame; 14. The method of claim 13, further comprising the step of: transmitting the MODBUS data frame to a second device.
15. The step of converting at least one CAN data frame into a MODBUS data frame comprises: checking sequence information of the CAN data frame; If the CAN data frame is the first, initializing a receive buffer and setting a receive flag based on the total frame number information; if the sequence of the CAN data frame is not first, storing CAN message data of the CAN data frame while removing a reception flag corresponding to the sequence of the CAN data frame; and if all of the reception flags are removed, converting the stored CAN message data into a MODBUS data frame by sequentially mapping the stored CAN message data according to the order information.
16. converting the stored CAN message data into a MODBUS data frame by sequentially mapping the stored CAN message data according to the order information, mapping a portion of the fifth data portion of the CAN data frame onto a portion of the first data portion of the MODBUS data frame; mapping the sixth data portion of the CAN data frame to the second data portion of the MODBUS data frame; mapping the seventh data portion of the CAN data frame to the third data portion of the MODBUS data frame; and mapping the eighth data portion of the CAN data frame to the fourth data portion of the MODBUS data frame.
17. The method of claim 14, wherein the first device or the second device includes multiple master devices or multiple slave devices.
Citation Information
Patent Citations
Monitor logging device
JP2000216798A
Method of communication of gateway device supporting intercommunication between can and modbus, and gateway device using the same
JP2013013083A
Cogeneration device and cogeneration method
JP2017533404A
Abnormality detector and abnormality detection method
JP2019029993A
Energy integration and supply device and method
JP2020518213A
