A module address allocation method and device, and data interaction system
By reading the signal status and address allocation of the expansion bus interface through the main module, the problem of PLC's inability to automatically identify expansion modules is solved, and intelligent module identification and address allocation of PLC system is realized.
Patent Information
- Application Number
- CN202110277752.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-15
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-03-15
AI Technical Summary
The existing PLC cannot automatically identify the types of modules connected to the expansion bus. The identification and configuration of expansion modules depend on the host configuration software and cannot be identified and loaded independently.
The main module reads the extended bus interface address to identify the signal status, obtains the number of extended modules, sends addressing instructions to allocate bus addresses, and obtains the ID information of the extended modules to determine their types. Finally, it allocates access addresses based on the bus address and type.
It enables the main module to automatically identify and allocate addresses to extension modules, achieving intelligent configuration without the need for upper-level software configuration, making it convenient for customers to use.
Smart Images

Figure CN112988639B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data interaction, and in particular to a module address allocation method and device, and a data interaction system. Background Art
[0002] PLC is a very common controller product in the field of automation. It is popular among customers for its convenient configuration and flexible configuration, thanks to its convenient scalability and rich expansion module types. With the widespread application of PLC products and the development of PLC technology, customers have higher and higher requirements for the intelligent configuration and configuration of PLC products, which puts higher requirements on the PLC expansion bus.
[0003] However, under existing technical conditions, most PLCs cannot automatically identify the type of modules mounted on the expansion bus. The identification and configuration of expansion modules depend on the upper-level configuration software. Without the upper-level configuration software, the PLC system cannot identify and load them autonomously. Summary of the invention
[0004] The embodiments of the present invention aim to provide a module address allocation method and device, and a data interaction system, which can enable a main module to automatically identify an extension module and allocate addresses to the extension module.
[0005] To achieve the above object, in a first aspect, the present invention provides a module address allocation method, which is applied to a main module, wherein the main module is sequentially connected to at least one expansion module via an expansion bus, and the method comprises:
[0006] Reading the state of the expansion bus interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus;
[0007] Sending an expansion module addressing instruction to allocate a bus address to each of the expansion modules;
[0008] Acquire the ID information of each of the extension modules to determine the type of each of the extension modules;
[0009] Based on the bus address and the type of each expansion module, an access address is allocated to each expansion module.
[0010] In an optional manner, the reading of the expansion bus interface status on the main module to obtain the number of expansion modules mounted on the expansion bus includes:
[0011] Calculating a first difference between a maximum value of a state of an expansion bus interface address identification signal on the master module and a state of the expansion bus interface address identification signal;
[0012] The number of expansion modules mounted on the expansion bus is obtained based on the first difference.
[0013] In an optional manner, allocating an access address to each of the expansion modules based on the bus address and the type of each of the expansion modules includes:
[0014] Determining the number of input and output channels of each expansion module based on the type of each expansion module;
[0015] Based on the bus address and the number of channels, an access address is allocated to each expansion module.
[0016] In an optional manner, allocating an access address to each of the expansion modules based on the bus address and the number of channels includes:
[0017] Based on the bus address and the number of channels, the input and output channels of each of the expansion modules are mapped to the input and output register area of the system according to a preset mapping rule to obtain a corresponding register address;
[0018] The register address is the access address.
[0019] In a second aspect, the present invention provides a module address allocation method, which is applied to an expansion module, at least one of the expansion modules is sequentially connected to a main module via an expansion bus, and the method comprises:
[0020] Acquire the status of the subsequent expansion interface of the expansion module;
[0021] a second difference between the state of the rear-stage expansion interface of the expansion module and the first preset difference;
[0022] The second difference is output through the front-stage expansion interface of the expansion module, wherein the second difference is used to enable the main module to obtain the state of the expansion bus interface address identification signal on the main module, so that the main module can obtain the number of expansion modules mounted on the expansion bus.
[0023] In a third aspect, the present invention provides a module address allocation device, applied to a main module, wherein the main module is sequentially connected to at least one expansion module via an expansion bus, and the device comprises:
[0024] A quantity acquisition module, used for reading the state of the expansion bus interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus;
[0025] A bus address allocation module, used for sending an expansion module addressing instruction to allocate a bus address to each of the expansion modules;
[0026] A type determination module, used to obtain the ID information of each of the extension modules to determine the type of each of the extension modules;
[0027] The access address allocation module is used to allocate an access address to each of the expansion modules based on the bus address and the type of each of the expansion modules.
[0028] In a fourth aspect, the present invention provides a module address allocation device, which is applied to an expansion module, at least one of the expansion modules is sequentially connected to a main module via an expansion bus, and the device comprises:
[0029] An address acquisition module, used to acquire the status of the subsequent expansion interface of the expansion module;
[0030] A calculation module, used for calculating a second difference between the state of the rear-stage expansion interface of the expansion module and the first preset difference;
[0031] The output module outputs the second difference through the front-stage expansion interface of the expansion module, wherein the second difference is used to enable the main module to obtain the state of the expansion bus interface address identification signal on the main module, so that the main module obtains the number of expansion modules mounted on the expansion bus.
[0032] In a fifth aspect, the present invention provides a main module, the main module comprising:
[0033] At least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the method as described in the first aspect.
[0034] In a sixth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method described in the first aspect above.
[0035] In a seventh aspect, the present invention provides a computer program product, comprising a computer program stored on a computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer executes the method described in the first aspect above.
[0036] In an eighth aspect, the present invention provides an expansion module, the expansion module comprising:
[0037] At least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the method as described in the second aspect.
[0038] In a ninth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the method described in the second aspect above.
[0039] In a tenth aspect, the present invention provides a computer program product, comprising a computer program stored on a computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer executes the method described in the second aspect above.
[0040] In an eleventh aspect, the present invention provides a data interaction system, comprising:
[0041] A main module as described above, and an extension module as described above;
[0042] The expansion bus interface of the main module is connected to the front-stage expansion interface of the first expansion module;
[0043] The rear-stage expansion interface of the Nth expansion module is connected to the front-stage expansion interface of the N+1th expansion module, where N is a positive integer greater than 0.
[0044] The beneficial effects of the embodiments of the present invention are as follows: the module address allocation method provided by the present invention is applied to a main module, and the main module and at least one expansion module are connected in sequence through an expansion bus. The method includes reading the state of the expansion interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus, and sending an expansion module addressing instruction according to the number of expansion modules to allocate a bus address to each expansion module, and then obtaining the ID information of each expansion module to determine the type of each expansion module, and finally, based on the bus address and the type of each expansion module, allocating an access address to each expansion module, so that the corresponding module can be found according to the bus address, that is, the main module automatically identifies the expansion module, and after finding the corresponding module, the expansion module can be assigned an address according to the type of each expansion module, thereby completing the process of enabling the main module to automatically identify the expansion module and allocating an address to the expansion module. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0046] Figure 1 A schematic diagram of the structure of a data interaction system provided by an embodiment of the present invention;
[0047] Figure 2 A flowchart of a module address allocation method provided by an embodiment of the present invention;
[0048] Figure 3 A flowchart of a module address allocation method provided by another embodiment of the present invention;
[0049] Figure 4 A schematic diagram of the structure of a data interaction system provided by another embodiment of the present invention;
[0050] Figure 5 A schematic diagram of the structure of a module address allocation device provided in an embodiment of the present invention;
[0051] Figure 6 A schematic diagram of the structure of a module address allocation device provided by another embodiment of the present invention;
[0052] Figure 7 A schematic diagram of the structure of a main module provided in an embodiment of the present invention;
[0053] Figure 8 A schematic diagram of the structure of an extension module provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] See also Figure 1 , Figure 1 This is a schematic diagram of the structure of the data interaction system provided in the embodiment of the present application. Figure 1 As shown, the data interaction system includes a main module M0, and extension modules M1, M2, ..., MN, wherein N is a positive integer greater than 0.
[0056] The main module M0 includes an expansion bus interface 101 , and the expansion module MN includes a front-stage expansion interface 102 and a rear-stage expansion interface 103 .
[0057] Specifically, the expansion bus interface 101 of the main module M0 is connected to the front-stage expansion interface of the first expansion module M1, and the rear-stage expansion interface of the Nth expansion module MN is connected to the front-stage expansion interface of the N+1th expansion module MN+1, where N is a positive integer greater than 0. That is, the rear-stage expansion interface of the second expansion module M2 is connected to the front-stage expansion interface of the third expansion module M3, and the rear-stage expansion interface of the third expansion module M3 is connected to the front-stage expansion interface of the fourth expansion module M4... and so on.
[0058] Thus, the N+1th expansion module MN+1 can transmit information to the rear expansion interface of the Nth expansion module MN through its front expansion interface, and the first expansion module M1 can transmit information to the expansion bus interface of the main module M0 through its front expansion interface.
[0059] It should be understood that the first expansion module M1 can be any one of all the expansion modules connected to the expansion bus.
[0060] See also Figure 2 , Figure 2 A flowchart of a module address allocation method provided in an embodiment of the present application, the method comprises: Figure 1 The method is performed by the main module shown, that is, the method is applied to the main module, and the main module is connected to at least one expansion module in sequence through an expansion bus. It should be noted that if there is substantially the same result, the method of the present application is not limited to Figure 1 The process sequence shown is limited. Figure 1 As shown, the method comprises the following steps:
[0061] 201: Read the status of the expansion bus interface address recognition signal on the main module to obtain the number of expansion modules mounted on the expansion bus. Figure 1 , take the example that the expansion bus interface on the main module includes four bits, and the initial state of the address recognition signal of each bit is fixed to high level input. When the subsequent module is mounted, the input level of the address recognition signal will change. After the main module is powered on, if the level of the state of the address recognition signal of the expansion bus interface on the main module is not all high, it is judged that the expansion bus has an expansion module mounted. Therefore, by reading the state of the address recognition signal of the expansion bus interface on the main module, the number of expansion modules mounted on the expansion bus can be obtained.
[0062] In one embodiment, the number of expansion modules is obtained by calculating the difference between the maximum value of the state of the expansion bus interface address identification signal on the main module and the state of the expansion bus interface address identification signal read on the main module. For example, assuming that the state of the expansion bus interface address identification signal read on the main module is 1001 (i.e., 9), and the maximum value of the state of the expansion bus interface address identification signal on the main module is 1111 (i.e., 15), then 15-9=6 is used to obtain the number of expansion modules as 6.
[0063] In order to obtain the number of expansion modules by the above method, the expansion modules also need to execute the corresponding method steps. Therefore, the present application also provides a module address allocation method, which is as follows: Figure 1 The method is applied to the extension module, and at least one extension module is sequentially connected to the main module via an extension bus. Figure 3 As shown, the steps of the method include:
[0064] 301: Obtain the address of the subsequent expansion interface of the expansion module.
[0065] 302: Calculate a second difference between the state of the rear-stage expansion interface of the expansion module and the first preset difference.
[0066] 303: Output the second difference through the front-end expansion interface of the expansion module.
[0067] That is, each expansion module needs to obtain the state of its own rear-stage expansion interface, and then subtract the first preset difference from the state to obtain the second difference, and finally output the second difference through its own front-stage expansion interface. That is, the Nth expansion module first obtains the state of its rear-stage expansion interface, then subtracts the first preset difference from the address, and transmits the subtracted difference to the subsequent expansion interface of the N-1th expansion module through its front-stage expansion interface. Then, the N-1th expansion module subtracts the first preset difference from the state of its rear-stage expansion interface to obtain its own output value, and transmits it to the rear-stage expansion interface of the N-2th expansion module through its front-stage expansion interface. And so on, finally, the first expansion module subtracts the first preset difference from the state of its rear-stage expansion interface, and transmits the obtained difference to the main module through its front-stage expansion interface. Among them, the first preset difference can be a positive integer such as 1, 2...
[0068] It can be seen that after the above process, each time an expansion module is mounted on the expansion bus, the state value read by the main module from its subsequent expansion interface is reduced by the first preset difference. In other words, the second difference is ultimately used to enable the main module to obtain the state of the expansion bus interface address identification signal on the main module, so that the main module can obtain the number of expansion modules mounted on the expansion bus.
[0069] Take the example of 6 expansion modules. Figure 4 As shown, assuming that the first preset difference is 1, assuming that the address read by the expansion module M6 from its rear-stage expansion interface is 1111, then 1111 minus 1 can get 1110, and 1110 is transmitted to the rear-stage expansion interface of the expansion module M5 through its front-stage expansion interface. The expansion module M5 subtracts 1110 received by its rear-stage expansion interface from 1100 to get 1101, and transmits 1101 to the rear-stage expansion interface of the expansion module M4 through its front-stage expansion interface. And so on, finally, the expansion module M1 subtracts 1010 received by its rear-stage expansion interface from 1001 to get 1001, and transmits 1001 to the expansion bus interface of the main module M0 through its front-stage expansion interface, so that the state of the address identification signal of the expansion bus interface of the main module M0 is 1001.
[0070] At this time, when the state of the expansion bus interface address identification signal on the main module is 1001 (i.e. 9), and the maximum value of the state of the expansion bus interface address identification signal on the main module is 1111 (i.e. 15), then through the above embodiment, it can be seen that using 15-9=6, the number of expansion modules is 6.
[0071] 202: Send an expansion module addressing instruction to allocate a bus address to each expansion module.
[0072] After the main module obtains the number of the extension modules, the main module sends an address configuration instruction to the extension modules to configure the bus address of each extension module.
[0073] In one embodiment, when the main module sends a configuration address instruction, all expansion modules add 1 to the state of the address identification signal of their own subsequent expansion interfaces read from the main module and use the result as their own module address.
[0074] by Figure 4 Taking the connection between the main module shown and 6 expansion modules as an example, it can be seen from the above content that the state of the post-stage expansion interface address recognition signal of the expansion module M1 is 1010 (i.e. 10), then the bus address of the expansion module M1 is 10+1=11; the state of the post-stage expansion interface address recognition signal of the expansion module M2 is 1011 (i.e. 11), then the bus address of the expansion module M2 is 11+1=12..., and so on, the bus address of the expansion module M1 is 11, the bus address of the expansion module M2 is 12, the bus address of the expansion module M3 is 13, the bus address of the expansion module M4 is 14, the bus address of the expansion module M5 is 15, and the bus address of the expansion module M6 is 16.
[0075] 203: Obtain ID information of each extension module to determine the type of each extension module.
[0076] After the bus address of each expansion module is configured, the main module will cyclically access each expansion module in turn to obtain the ID information of each expansion module to determine the IO type of each expansion module, that is, to determine whether each expansion module is digital or analog, and whether it is an output type or an input type. In other words, the expansion modules include the following types: digital output module, digital input module, analog output module, and analog input module.
[0077] 204: Based on the bus address and the type of each expansion module, an access address is allocated to each expansion module.
[0078] In one embodiment, the number of channels occupied by the input and output channels of each expansion module can be determined by the type of each expansion module. For example, when the first expansion module is determined to be a 16-point digital output module, the number of output channels occupied is 16. Then, according to the bus address and the number of channels, an access address can be allocated to each expansion module.
[0079] Furthermore, according to the bus address and the number of channels, the input and output channels of each expansion module can be mapped to the input and output register area of the system according to the preset mapping rules to obtain the corresponding register address. The register address is the access address in the above embodiment, and the user can directly operate the access address to realize the control of the IO points on each expansion module.
[0080] Specifically, in one embodiment, the main module divides the register area of the system into an input register area (I area) and an output register area (Q area), wherein the input register area is read-only, the output register area is write-only, and the input and output registers are aligned with a width of 16 bits. After the main module determines the type and quantity of the mounted expansion modules, it maps the input and output channels of all expansion modules to the system input and output register area, and the mapping address is represented by IWxx and QXxx, wherein xx represents the specific register address for user access convenience.
[0081] Still Figure 4 Take the connection between the main module and 6 expansion modules as an example, assuming that the main module M0 is a 16-point digital input and 16-point digital output module; the expansion module M1 is an 8-point digital input module; the expansion module M2 is an 8-point digital output module; the expansion module M3 is a 16-point digital input module; the expansion module M4 is a 16-point digital output module; the expansion module M5 is an 8-point analog input module; and the expansion module M6 is an 8-point analog output module. Then according to the preset mapping rules, the register addresses after mapping the input and output areas of each expansion module can be shown in Table 1.
[0082] Table 1
[0083]
[0084] As shown in Table 1, the number of input channels and output channels of the main module M0 are both 16, and the register addresses are IW0 and QW0 respectively; the number of input channels of the expansion module M1 is 8, and the register address is IW2; the number of output channels of the expansion module M2 is 8, and the register address is QW2; the number of input channels of the expansion module M3 is 16, and the register address is IW4; the number of output channels of the expansion module M4 is 16, and the register address is QW4; the number of input channels of the expansion module M5 is 8, and the register addresses are IW6-IW20; the number of output channels of the expansion module M6 is 8, and the register addresses are QW6-QW20. Therefore, the user only needs to access and set the corresponding register address to complete the setting of each IO point of the expansion module.
[0085] Through the above method, the main module can automatically identify the expansion module and assign addresses to the expansion module. That is, the number and type of modules mounted on the expansion bus can be identified without the configuration of the upper software. Therefore, after the main module is started, it can independently form a system and provide access channels for users, realizing intelligent configuration and facilitating customer use.
[0086] The present application embodiment provides a module address allocation device, which is applied to a main module, and the main module and at least one expansion module are sequentially connected through an expansion bus. Figure 5 , which shows a schematic diagram of the structure of a module address allocation device provided in an embodiment of the present invention. The module address allocation device 500 includes: a quantity acquisition module 501, a bus address allocation module 502, a type determination module 503 and an access address allocation module 504.
[0087] The quantity acquisition module 501 is used to read the state of the expansion bus interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus.
[0088] The bus address allocation module 502 is used to send an expansion module addressing instruction to allocate a bus address to each expansion module.
[0089] The type determination module 503 is used to obtain the ID information of each extension module to determine the type of each extension module.
[0090] The access address allocation module 504 is used to allocate an access address to each expansion module based on the bus address and the type of each expansion module.
[0091] The above products can be executed Figure 2The method provided in the embodiment of the present application shown has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided in the embodiment of the present application.
[0092] Another embodiment of the present application provides a module address allocation device, which is applied to an expansion module, wherein at least one expansion module is sequentially connected to a main module via an expansion bus. Figure 6 , which shows a schematic structural diagram of a module address allocation device provided by another embodiment of the present invention. The module address allocation device 600 includes: an address acquisition module 601, a calculation module 602 and an output module 603.
[0093] The address acquisition module 601 is used to acquire the status of the subsequent expansion interface of the expansion module.
[0094] The calculation module 602 is used to calculate a second difference between the state of the rear-stage expansion interface of the expansion module and the first preset difference.
[0095] The output module 603 is used to output the second difference through the front-end expansion interface of the expansion module, wherein the second difference is used to enable the main module to obtain the state of the expansion bus interface address identification signal on the main module, so that the main module can obtain the number of expansion modules mounted on the expansion bus.
[0096] The above products can be executed Figure 3 The method provided in the embodiment of the present application shown has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided in the embodiment of the present application.
[0097] The present invention also provides a main module, see Figure 7 , which shows that it is possible to execute Figure 2 The hardware structure of the main module of the module address allocation method shown in FIG. The main module 700 may be Figure 1 or Figure 4 Any of the main modules M0 shown.
[0098] The main module 700 includes: at least one processor 701; and a memory 702 that is communicatively connected to the at least one processor 701. Figure 7 The memory 702 stores instructions that can be executed by the at least one processor 701, and the instructions are executed by the at least one processor 701 so that the at least one processor 701 can perform the above Figure 2 The processor 701 and the memory 702 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0099] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the module address allocation method in the embodiment of the present application, for example, Figure 5 The processor 701 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 702, that is, the module address allocation method of the above method embodiment is implemented.
[0100] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the data transmission device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 702 may optionally include a memory remotely arranged relative to the processor 701, and these remote memories may be connected to the data transmission device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0101] The one or more modules are stored in the memory 702, and when executed by the one or more processors 701, the module address allocation method in any of the above method embodiments is executed, for example, the module address allocation method described above is executed. Figure 2 Steps to achieve Figure 5 The functions of each module and unit in it.
[0102] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.
[0103] The present application also provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 2 Steps to achieve Figure 5 The functions of each module in.
[0104] The present application also provides a computer program product, including a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the module address allocation method in any of the above method embodiments, for example, executing the above described Figure 2 Steps to achieve Figure 5 The functions of each module in.
[0105] The present invention also provides an expansion module. Figure 8 , which shows that it is possible to execute Figure 3 The hardware structure of the expansion module of the module address allocation method shown in FIG. Figure 1 or Figure 4 Any of the extension modules MN shown.
[0106] The expansion module 800 includes: at least one processor 801; and a memory 802 that is communicatively connected to the at least one processor 801. Figure 8 The memory 802 stores instructions that can be executed by the at least one processor 801, and the instructions are executed by the at least one processor 801 so that the at least one processor 801 can perform the above Figure 3 The processor 801 and the memory 802 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0107] The memory 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the module address allocation method in the embodiment of the present application, for example, Figure 8 The processor 801 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 802, that is, implements the module address allocation method of the above method embodiment.
[0108] The memory 802 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the data transmission device, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0109] The one or more modules are stored in the memory 802, and when executed by the one or more processors 801, the module address allocation method in any of the above method embodiments is executed, for example, the module address allocation method described above is executed. Figure 3 Steps to achieve Figure 6 The functions of each module and unit in it.
[0110] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.
[0111] The present application also provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 3 Steps to achieve Figure 6 The functions of each module in.
[0112] The present application also provides a computer program product, including a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the module address allocation method in any of the above method embodiments, for example, executing the above described Figure 3 Steps to achieve Figure 6 The functions of each module in.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A module address allocation method, It is characterized in that Applied to a main module, the main module is sequentially connected to at least one expansion module via an expansion bus, the method comprising: Reading the state of the expansion bus interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus; After obtaining the number of expansion modules mounted on the expansion bus, sending an expansion module addressing instruction to allocate a bus address to each expansion module; Acquire the ID information of each of the extension modules to determine the type of each of the extension modules; Allocating an access address to each of the expansion modules based on the bus address and the type of each of the expansion modules; The step of reading the state of the expansion bus interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus includes: Reading the state of the expansion bus interface address identification signal on the main module based on a second difference value output by a front-stage expansion interface of a first expansion module connected to the expansion bus interface of the main module, wherein the second difference value output by the front-stage expansion interface of the first expansion module is a difference between the state of the rear-stage expansion interface of the first expansion module and a first preset difference value; Calculating a first difference between a maximum value of a state of an expansion bus interface address identification signal on the master module and a state of the expansion bus interface address identification signal; The number of expansion modules mounted on the expansion bus is obtained based on the first difference.
2. The module address allocation method according to claim 1, It is characterized in that The allocating an access address to each of the expansion modules based on the bus address and the type of each of the expansion modules comprises: Determining the number of input and output channels of each expansion module based on the type of each expansion module; Based on the bus address and the number of channels, an access address is allocated to each expansion module.
3. The module address allocation method according to claim 2, It is characterized in that The allocating an access address to each of the expansion modules based on the bus address and the number of channels includes: Based on the bus address and the number of channels, the input and output channels of each of the expansion modules are mapped to the input and output register area of the system according to a preset mapping rule to obtain a corresponding register address; The register address is the access address.
4. A module address allocation method, It is characterized in that Applied to the expansion module, at least one of the expansion modules is sequentially connected to the main module via an expansion bus, the method comprising: Acquire the status of the subsequent expansion interface of the expansion module; Calculating a second difference between the state of the rear-stage expansion interface of the expansion module and the first preset difference; The second difference is output through the front-stage expansion interface of the expansion module, wherein the second difference is used to enable the main module to obtain the state of the expansion bus interface address identification signal on the main module, so that the main module can obtain the number of expansion modules mounted on the expansion bus.
5. A module address allocation device, It is characterized in that Applied to a main module, the main module is sequentially connected to at least one expansion module via an expansion bus, and the device comprises: A quantity acquisition module, used for reading the state of the expansion bus interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus; A bus address allocation module, configured to send an expansion module addressing instruction after obtaining the number of expansion modules mounted on the expansion bus, so as to allocate a bus address to each expansion module; A type determination module, used to obtain the ID information of each of the extension modules to determine the type of each of the extension modules; An access address allocation module, used for allocating an access address to each of the expansion modules based on the bus address and the type of each of the expansion modules; The step of reading the state of the expansion bus interface address identification signal on the main module to obtain the number of expansion modules mounted on the expansion bus includes: Reading the state of the expansion bus interface address identification signal on the main module based on a second difference value output by a front-stage expansion interface of a first expansion module connected to the expansion bus interface of the main module, wherein the second difference value output by the front-stage expansion interface of the first expansion module is a difference between the state of the rear-stage expansion interface of the first expansion module and a first preset difference value; Calculating a first difference between a maximum value of a state of an expansion bus interface address identification signal on the master module and a state of the expansion bus interface address identification signal; The number of expansion modules mounted on the expansion bus is obtained based on the first difference.
6. A module address allocation device, It is characterized in that Applied to an expansion module, at least one of the expansion modules is sequentially connected to a main module via an expansion bus, and the device comprises: An address acquisition module, used to acquire the status of the subsequent expansion interface of the expansion module; A calculation module, used for calculating a second difference between the state of the rear-stage expansion interface of the expansion module and the first preset difference; The output module outputs the second difference through the front-stage expansion interface of the expansion module, wherein the second difference is used to enable the main module to obtain the state of the expansion bus interface address identification signal on the main module, so that the main module obtains the number of expansion modules mounted on the expansion bus.
7. A main module, It is characterized in that The main module comprises: At least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 3.
8. An extension module, It is characterized in that The expansion module comprises: At least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can perform the method according to claim 4.
9. A data interaction system, It is characterized in that include: The main module as claimed in claim 7, and the expansion module as claimed in claim 8; The expansion bus interface of the main module is connected to the front-stage expansion interface of the first expansion module; The rear-stage expansion interface of the Nth expansion module is connected to the front-stage expansion interface of the N+1th expansion module, where N is a positive integer greater than 0.
Citation Information
Patent Citations
Programmable logic controller and expansion module interface
CN101145046A
Communication method for programmable logic controller and extension module
CN101592934A
Integrated small PLC and automatic identification method of extended IO modules thereof
CN105955179A
Bus addressing method and apparatus, and information prompting method and apparatus
CN107211050A
Automatic addressing system for extending modules
CN107577630A
