200825911 九、發明說明: 【發明所屬之技術領域】 < 本發明係關於可程式控制器(以下稱爲PLC),其作 成不使用工具,就可進行單元之線上拆裝。 【先前技術】 自以往已知一種可程式控制器,其作成C P U單元和複 數個功能單元係經由I/O匯流排而相互連接,而且各功能 單元之每一個,可經由連接器對I/O匯流排安裝或拆卸。 在此,作爲功能單元,例如可列舉I/O單元(IN單元、 OUT單元、以及IN、OUT混合單元之總稱)、通信單元(PLC 間通信單元、主、從間通信單元、以及上階裝置間通信單 元之總稱)、特殊功能單元(溫度調整單元、PID控制單元、 運動控制單元、位置控制單元等)等。 在這種PLC,藉由CPU單元因應於需要而經由I/O匯 流排向各功能單元存取,而實現與其功能單元有關之功 能。即,若功能單元係I/O單元,藉由CPU單元存取該I/O 單元,而實現來自外部之輸入信號的取入功能或對外部之 輸出信號的送出功能。又,若功能單元係通信單元,藉由 CPU單元存取該通信單元,而實現PLC間通信功能、遙控 子局間通信功能等之功能。此外,若功能單元係特殊功能 單元·,藉由CPU單元存取該特殊功能單元,而實現各個其 特殊功能單元所固有之功能(溫度調整功能、PID控制功 能、運動控制功能、位置控制功能等)。 在CPU單元裝入微處理器和記憶體。微處理器藉由根 200825911 據從記憶體之系統程式區域所讀出的系統程式進行動作, 而重複地執行共同處理、使用者程式執行處理、I/O重清處 理、以及周邊服務處理。 在共同處理,係進行電池異常檢查、I/O匯流排之檢 查、記憶體之使用者程式記憶區域的檢查等之各種硬體檢 查。在使用者程式執行處理,係從記憶體的使用者程式記 憶體區域依序讀出構成使用者程式之各指令字,而且參照 記憶體之I/O資料區域的I/O資料執行處理,再根據其執 行結果,進行改寫記憶體之I/O資料區域(尤其是out資料 區域)的內容之處理。在I/O重清處理,係進行將經由I/O 單元所取入的IN資料寫入記憶體之I/O資料區域(尤其是 IN資料區域)的處理(IN重清處理)、及向I/O單元送出從記 憶體之I/O資料區域(尤其是OUT資料區域)所讀出的OUT 資料之處理(OUT重清處理)。 又,爲了將新製作或編輯之使用者程式向CPU單元內 的記憶體上傳、或從該記憶體下載使用者程式、以及將用 以進行PLC之各種的功能設定之設定資料寫入記憶體的設 定資料區域或修改,而使用既定之工具。此工具一般藉由 將用以實現作爲工具之功能的應用程式安裝於個人電腦而 實現,再經由電纜以連接器和PLC連接。 可是,在這種包含有複數個功能單元而構成的PLC, 爲了更換故障的功能單元,或者爲了功能單元之維修等, 而有想在P L C依然繼續運轉下拆卸或安裝輸出入單元或通 信單元或特殊功能單元等之功能單元(以下稱爲「單元之線 200825911 上拆裝」)的要求。 在CPU單元內之記憶體所儲存的系統程式,裝入 之通信異常時處理。此通信異常時處理之構造係若在 一個單元存取時檢測到異常響應,就強迫地停止PLC 轉(以下稱爲「系統當機」)。 以往,採用一種方法,其係爲了在P L c依然繼續 下’對於所指定之連接器,可拆卸功能單元,利用經 纜和PLC連接的工具,藉由變更CPU單元之記憶體內 定資料’而執行在單元拆卸時所需之處理,另一方面 了在PLC依然繼續運轉下,對於所指定之連接器,可 功能單元’利用經由電纜和PLC連接的工具,藉由變更 單元之記憶體內的設定資料,而執行在單元安裝時所 處理。 在此,作爲「在單元拆卸時所需之處理」,例如可 作成在向該單元存取時即使發生異常響應系統當機功 不會動作、而且以後對於已拆卸該單元的連接器完全 理來自外部之信號、以及對於該連接器以後CPU單元 行存取等之處理。另一方面,作爲「在單元安裝時所 處理」,例如可列舉以工具操作變更設定資料,以恢復 之狀態,藉此能受理來自該連接器的信號,而且使對 元之存取再開始等的處理。 可是,在藉由使用這種工具而可進行單元之線上 的習知方法,每當單元之線上拆裝,在已安裝PLc的 現場等’因爲每次都必須帶入作爲工具發揮功能的個 既定 向任 的運 運轉 由電 的設 ,爲 安裝 CPU 需之 列舉 能亦 不受 不進 需之 原來 該單 拆裝 生產 人電 200825911 腦,所以在操作性以至於機動性差,又因爲應進行單元之 拆裝的連接器之指定係委由使用者之工具操作,所以具有 右使用者之連接益指疋係錯誤,可能引起系統當機的問題 點。 因此,爲了解決這種問題,自以往亦已知一種p L C, 其作成不使用工具(無工具),就可進行單元之線上拆裝(參 照專利文獻1 )。 在這種可實現單元之無工具的線上拆裝之PLC,在成 爲拆裝對象之功能單元的各個側,設置在單元之安裝、拆 卸時動作的開關,而在CPU單元之側,以專用的信號線和 該各開關的各個連接,而且設置狀態記憶體,其具有用以 記憶各開關之動作所產生的開閉信號之按照連接器的記憶 區域。 作爲其他的例子,根據該開閉信號對微處理器產生中 斷信號,並經由中斷處理向狀態記憶體寫入開閉信號。 即,此狀態記憶體具有按照連接器的記憶區域,而且 和對於任一個連接器所進行之功能單元的拆卸操作連動, 將第1狀態(已拆卸單元之狀態)記憶於關於該連接器的記 1思區域,而且和對於任一個連接器所進行之功能單兀的安 裝操作連動,將第2狀態(已安裝單元之狀態)記憶於關於 該連接器之記憶區域。 另一方面,在CPU單元內之記憶體所儲存的系統程式 側裝入一種功能,其在存取成爲拆裝對象之單元的各個之 前’參照該狀態記憶體的內容’而且作爲其參照結果,判 200825911 疋爲從已安裝之狀態變成已拆卸的狀態時(單元拆卸),或 判定爲從已拆卸之狀態變成已安裝的狀態時(單元安裝), 各自執行單元之線上拆裝所需的「單元拆卸時所需之處理」 或「安裝單元時所需之處理」。 若依據這種構造,在進行單元之拆卸操作或安裝操作 時,因爲根據狀態記憶體之記憶內容的變化,自動地執行 單元之線上拆裝所需的處理,所以不使用工具來操作設定 資料,亦可進行單元之線上拆裝。 [專利文獻1]特開平5— 241622號公報 【發明內容】 〔發明要解決之課題〕 可是’在這種可實現單元之無工具線上拆裝的P L C, 因爲作成僅依賴狀態記憶體之記憶內容的變化,判定單元 之從已安裝的狀態變成已拆卸之狀態(單元拆卸),所以爲 不遺漏而確實地判定成爲拆裝對象之各單元的單元拆卸, 每當想經由連接器向各單元存取時,在存取之前,每次必 須參照和該連接器對應之狀態記憶體的內容,具有系統程 式側之處理負擔極大的問題點。即,因爲即使有1個週期 疏忽狀態記憶體的參照,在看漏單元拆卸下,單元向已拆 卸單元的連接器存取時,響應異常響應之發生,而起動系 統當機處理。 本發明係著眼於這種以往之問題點,其目的在於提供 一種可程式控制器,其可實現單元之無工具的線上拆裝, 而且在單元拆卸之判定時可減輕系統程式側的處理負擔。 200825911 關於本發明之另外的目的及作用效果,藉由參照說明 書之以下的記述,只要係本業者’將易於理解。 〔解決課題之方式〕 上述的課題,可利用具有如下之構造的PLC實現。即, 此PLC以如下之方式構成,CPU單元和複數個功能單元係 經由I/O匯流排相連接,而且各功能單元之每一個,可經 由連接器對I/O匯流排安裝或拆卸,又CPU單元因應於需 要經由I/O匯流排向各功能單元存取,藉此實現與其功能 單元有關之功能。 該PLC又具備有狀態記憶體、第1控制手段、以及第 2控制手段。 狀態記憶體以如下之方式構成,具有按照連接器的記 憶區域,而且和對於任一個連接器所進行之功能單元的拆 卸操作連動,將第1狀態記憶於關於該連接器之記憶區 域,而且和對於任一個連接器所進行之功能單元的安裝操 作連動,將第2狀態記憶於關於該連接器之記憶區域。 第1控制手段,係在CPU單元經由任一個連接器向功 能單元存取時,若檢測到異常響應,就參照關於該連接器 之狀態記憶體的記憶內容,而且在判定該記憶內容係第1 狀態時’在可程式控制器依然繼續運轉下,關於所指定之 連接器’爲了能拆卸功能單元,而執行在單元拆卸時所需 的處理’另一方面,在判定該記憶內容係第2狀態時,執 行既定之通信異常時處理。 第2控制手段,係在對於任一個連接器判定狀態記憶 -10- 200825911 體之§5憶內容從第1狀態變爲第2狀態時,在PLC依然繼 續運轉下,關於所指定之連接器,爲了能安裝功能單元, 而執行在單元安裝時所需的處理。 若依據這種構造,在P L C依然繼續運轉下,對於所指 疋之連接器’關於能拆卸功能單元(單元之線上拆卸)所需 的處理,因爲僅當CPU單元經由任一個連接器向功能單元 存取時檢測到異常響應,而且判定關於該連接器之狀態記 憶體的記憶內容係第1狀態時才執行,所以發生僅當在向 f 單兀存取的結果檢測到異常響應時才必要參照狀態記憶 體’和習知例每當CPU單元向各功能單元存取,需要在存 取之前參照狀態記憶體相比,大幅度減輕系統程式側之處 理負擔。另一方面,在向任一個功能單元存取時,若發生 以I/O匯流排之異常等真正的通信異常爲原因之異常響 應,因爲狀態記憶體的記憶內容表示第2狀態,所以正常 地執行通信異常時處理,並進'行系統當·機等之必要處理。 此外’在PLC依然繼續運轉下,對於所指定之連接器,200825911 IX. Description of the Invention: [Technical Field to Be Invented by the Invention] The present invention relates to a programmable controller (hereinafter referred to as PLC) which can be used for disassembly and assembly of a unit without using a tool. [Prior Art] A programmable controller has been known in the past, in which a CPU unit and a plurality of functional units are connected to each other via an I/O bus, and each of the functional units can be I/O via a connector. The busbar is installed or removed. Here, as the functional unit, for example, an I/O unit (IN unit, OUT unit, and a general term for IN and OUT mixing units), a communication unit (inter-PLC communication unit, a master/slave communication unit, and an upper device) can be cited. A general term for a communication unit, a special function unit (temperature adjustment unit, PID control unit, motion control unit, position control unit, etc.). In such a PLC, the function of the functional unit is realized by the CPU unit accessing the functional units via the I/O bus as needed. That is, if the functional unit is an I/O unit, the CPU unit accesses the I/O unit, thereby realizing an input function of an input signal from the outside or a function of transmitting an external output signal. Further, if the functional unit is a communication unit, the CPU unit accesses the communication unit, thereby realizing functions such as an inter-PLC communication function and a remote inter-office communication function. In addition, if the functional unit is a special function unit, the CPU unit accesses the special function unit to realize the functions inherent to each of the special function units (temperature adjustment function, PID control function, motion control function, position control function, etc.) ). The microprocessor and memory are loaded in the CPU unit. The microprocessor operates the system program read from the system program area of the memory by the root 200825911, and repeatedly performs the common processing, the user program execution processing, the I/O reprocessing, and the peripheral service processing. In the joint processing, various hardware inspections such as battery abnormality inspection, I/O bus bar inspection, and memory of the user program memory area are performed. When the user program executes the processing, the instruction words constituting the user program are sequentially read from the user program memory area of the memory, and the I/O data of the I/O data area of the memory is executed, and then the processing is performed. According to the execution result, the processing of rewriting the contents of the I/O data area of the memory (especially the out data area) is performed. In the I/O re-clearing process, the IN data that is taken in via the I/O unit is written into the I/O data area of the memory (especially the IN data area) (IN re-clearing process), and The I/O unit sends out the processing of the OUT data read from the I/O data area of the memory (especially the OUT data area) (OUT reprocessing). In addition, in order to upload a newly created or edited user program to a memory in the CPU unit, or download a user program from the memory, and write setting data for performing various function settings of the PLC into the memory. Set the data area or modify and use the established tools. This tool is generally implemented by installing an application for realizing the function as a tool on a personal computer, and then connecting the connector to the PLC via a cable. However, in such a PLC including a plurality of functional units, in order to replace a malfunctioning functional unit, or for maintenance of a functional unit, there is a desire to disassemble or install an input/output unit or a communication unit while the PLC continues to operate. The functional unit of a special function unit (hereinafter referred to as "unit line 200825911 on the disassembly"). The system program stored in the memory in the CPU unit is processed when the loaded communication is abnormal. When the communication is abnormal, the structure is processed to forcibly stop the PLC transfer (hereinafter referred to as "system down") if an abnormal response is detected during one unit access. In the past, a method was adopted in which the PL c was continued to perform for the specified connector, the detachable functional unit, and the tool connected by the cable and the PLC, by changing the memory of the CPU unit. On the other hand, when the PLC is still running, for the specified connector, the functional unit can use the tool connected via cable and PLC to change the setting data in the memory of the unit. And the execution is handled when the unit is installed. Here, as "the processing required at the time of unit removal", for example, even if an abnormal response system occurs when accessing the unit, the machine does not operate, and the connector for the unit has been removed from the future. External signal, and processing of the CPU unit row access after the connector. On the other hand, as the "processing at the time of unit mounting", for example, the setting data can be changed by the tool operation to restore the state, whereby the signal from the connector can be accepted, and the access to the element can be resumed. Processing. However, by using such a tool, it is possible to carry out the conventional method on the line of the unit, and to disassemble the unit line, at the site where the PLc has been installed, etc. 'Because each time it is necessary to bring in a function as a tool. For the operation of the operation, the installation of the CPU is not necessary for the installation of the CPU. It is not necessary to replace the original production of the human body 200825911 brain, so the operability is so poorly maneuverable, and because the unit should be The designated system of the disassembled connector is operated by the user's tool, so there is a problem that the right user's connection is wrong, which may cause the system to crash. Therefore, in order to solve such a problem, a p L C has been known in the past, and it is possible to perform assembly and disassembly of a unit without using a tool (without tools) (refer to Patent Document 1). The PLC that is detachable from the tool-free line of the achievable unit is provided with a switch that operates when the unit is attached or detached on each side of the functional unit that is to be attached and detached, and is dedicated to the side of the CPU unit. The signal line and each of the switches are connected, and a state memory is provided, which has a memory area according to the connector for memorizing the opening and closing signals generated by the operations of the switches. As another example, an interrupt signal is generated to the microprocessor based on the open/close signal, and an open/close signal is written to the state memory via the interrupt processing. That is, the state memory has a memory state in accordance with the connector, and in conjunction with the disassembly operation of the functional unit performed on any of the connectors, the first state (the state of the disassembled unit) is memorized in the memory of the connector. The area is considered, and in conjunction with the mounting operation of the function unit for any of the connectors, the second state (the state of the mounted unit) is memorized in the memory area of the connector. On the other hand, a function is stored in the system program side stored in the memory in the CPU unit, and the contents of the state memory are referred to before the access to the unit to be attached and disassembled, and as a result of the reference, When 200825911 is changed from the installed state to the disassembled state (unit disassembly), or when it is determined that the state has been changed from the disassembled state to the installed state (unit installation), it is required for the disassembly and assembly of the respective units. "Required for unit removal" or "Required for unit installation". According to this configuration, when performing the disassembly operation or the mounting operation of the unit, since the processing required for the disassembly and assembly of the unit is automatically performed according to the change of the memory content of the state memory, the tool is not used to operate the setting data. It is also possible to disassemble the unit on the line. [Patent Document 1] Japanese Laid-Open Patent Publication No. Hei No. Hei-5-241622 [Draft of the Invention] [The problem to be solved by the invention] However, the PLC that is detached from the toolless line of such an achievable unit is made to rely on the memory contents of the state memory only. The change of the determination unit is changed from the mounted state to the disassembled state (unit disassembly). Therefore, it is determined that the unit that is the object to be attached and detached is removed without any omission, and whenever it is desired to store the unit to each unit via the connector. At the time of access, it is necessary to refer to the content of the state memory corresponding to the connector before accessing, which has a problem that the processing load on the system program side is extremely large. That is, even if there is a one-cycle inadvertent reference to the state memory, when the cell is accessed by the connector of the detachable unit when the leaking unit is detached, the activation system responds to the abnormal response and the starting system is down. SUMMARY OF THE INVENTION The present invention has been made in view of such conventional problems, and an object thereof is to provide a programmable controller which can realize a toolless online assembly and disassembly of a unit, and can reduce the processing load on the system program side when determining the unit disassembly. 200825911 Other objects and effects of the present invention will be readily understood by reference to the following description of the specification. [Means for Solving the Problem] The above problems can be realized by a PLC having the following structure. That is, the PLC is configured in such a manner that the CPU unit and the plurality of functional units are connected via the I/O bus, and each of the functional units can be mounted or detached to the I/O bus via the connector, The CPU unit realizes functions related to its functional unit in response to the need to access the functional units via the I/O bus. The PLC further includes a state memory, a first control means, and a second control means. The state memory is constructed in such a manner that, in accordance with the memory area of the connector, and in conjunction with the disassembly operation of the functional unit performed on any of the connectors, the first state is memorized in the memory area of the connector, and For the mounting operation of the functional unit performed by any of the connectors, the second state is memorized in the memory area of the connector. When the CPU unit accesses the function unit via any of the connectors, the first control means refers to the memory content of the state memory of the connector, and determines that the memory content is the first. In the state, when the programmable controller continues to operate, the specified connector is configured to perform the processing required for the unit removal in order to be able to disassemble the functional unit. On the other hand, it is determined that the memory content is the second state. When a predetermined communication exception is executed, it is processed. The second control means determines whether the content of the memory is changed from the first state to the second state when the §5 memory of the connector is judged for any of the connectors. When the PLC continues to operate, the connector is specified. In order to be able to install the functional unit, the processing required at the time of unit installation is performed. According to this configuration, in the case where the PLC continues to operate, the processing required for the connector of the connector "on the detachable functional unit (on-line detachment of the unit) is because only the CPU unit passes through any of the connectors to the functional unit. An abnormal response is detected during access, and it is determined that the memory content of the state memory of the connector is executed in the first state, so that it is necessary to refer only when an abnormal response is detected as a result of the access to the f-unit. The state memory 'and the conventional example each time the CPU unit accesses each functional unit, it is necessary to greatly reduce the processing load on the system program side compared to the state memory before accessing. On the other hand, when accessing to any one of the functional units occurs, an abnormal response due to a true communication abnormality such as an abnormality in the I/O bus is generated, and since the memory content of the state memory indicates the second state, it is normally When the communication is abnormal, it is processed, and it is necessary to process the system. In addition, while the PLC is still running, for the specified connector,
C 關於使安裝功能單元(單元之線上安裝)所需的處理,係在 判定爲關於任一個連接器之狀態記憶體的記憶內容是從第 1狀態變爲第2狀態時執行。對於關於該單元之安裝結束 後的動作開始’容許一些延遲時間。因爲僅對已線上拆卸 單元監視線上安裝即可,所以系統程式側之處理負擔不成 問題。 在這種PLC ’第2控制手段亦可以如下之方式構成, 係在根據經由連接器從功能單元所讀入之單元識別資訊, -11- 200825911 判定爲在單元更換前後單元不一致時,不執行在單元安裝 時所需的處理。 若依據這種構造,在線上更換單元時,在誤裝其他的 種類之功能單元的情況,因爲關於該單元之運轉不會再開 始,所以可預防錯誤之種類的單元突然加入所引起之意外 的事情。 又,在上述之PLC,亦可又具備有:判定手段,係在 關於任一個連接器判定狀態記憶體之內容從第1狀態變爲 < 第2狀態時,根據經由該連接器從功能單元所讀入之單元 識別資訊,判定有無單元更換錯誤;及旗標控制手段,係 將由判定手段之判定結果,反映於利用可程式控制器之使 用者程式或可程式顯示器的顯示程式可參照之1個或2個 以上的單元更換錯誤旗標之狀態。 若依據這種構造,在發生單元更換錯誤時,因爲馬上 將特定之旗標設定成既定的邏輯値,所以若預先裝入將該 旗標作爲輸入條件來將顯示燈點燈的使用者程式,或者將 / V/ 該旗標作爲輸入條件裝入可程式顯示器的顯示程式,即使 另外工具不存在,亦可馬上通知使用者發生了單元更換錯 誤。 此時,亦可在利用可程式控制器之使用者程式或可程 式顯示器的顯示程式可參照之1個或2個以上的單元更換 錯誤旗標,包含有表示在線上更換時失敗的旗標。 若依據這種構造,只要預先裝入將該旗標作爲輸入條 件來將顯示燈點燈的使用者程式,或者將該旗標作爲輸入 -12- 200825911 條件裝入可程式顯示器的顯示程式,即使另外工具不存 在,亦不論如何可經由顯示燈或可程式顯示器通知使用者 因故而在單元之線上更換發生失敗。 又,亦可在利用可程式控制器之使用者程式或可程式 顯示器的顯示程式可參照之1個或2個以上的單元更換錯 誤旗標,包含有表示弄錯功能單元之種類的旗標。 若依據這種構造,只要預先裝入將該旗標作爲輸入條 件來將顯示燈點燈的使用者程式,或者將該旗標作爲輸入 f \ I 條件裝入可程式顯示器的顯示程式,即使另外工具不存 在,亦可經由顯示燈或可程式顯示器通知使用者在將已拆 卸之單元裝回時誤裝回其他的種類之單元。此外,若將那 種旗標作爲輸入條件,並裝入相當於線上更換錯誤時之對 策處理的使用者程式,亦可因應於錯誤之種類採取適當的 對策。 此外,亦可在利用可程式控制器之使用者程式或可程 式顯示器的顯示程式可參照之1個或2個以上的單元更換 ~ 錯誤旗標,包含有表示弄錯關於單元側之1個設定項目的 設定之旗標。 若依據這種構造,只要預先裝入將該旗標作爲輸入條 件來將顯示燈點燈的使用者程式,或者將該旗標作爲輸入 條件裝入可程式顯示器的顯示程式,即使另外工具不存 在’亦可經由顯示燈或可程式顯示器通知使用者在將已拆 卸之單元裝回時弄錯關於單元側之i個設定項目的設定。 此外’若將那種旗標作爲輸入條件,並裝入相當於線上更 -13- 200825911 換錯誤時之對策處理的使用者程式’亦可因應於錯誤之種 類採取適當的對策。 〔發明之效果〕 若依據本發明,可提供一種可程式控制器,其可實現 單元之無工具的線上拆裝,而且在單元拆卸之判定時可減 輕系統程式側的處理負擔。 【實施方式】 以下,一面參照附圖一面詳細說明本發明之PLC的最 佳實施之一形態。 第1圖係表示PLC之基本單元的構造圖。如第1圖所 示,此基本單元1係亦稱爲底板或母板等之細長長方形的 板狀構件,在其表面定義CPU單元安裝區域1 a和複數個 功能單元的安裝區域1 b。 在此,作爲CPU單元以外之各種功能單元,如本業者 所周知般,可列舉I/O單元(IN單元、OUT單元、以及IN、 OUT混合單元之總稱)、通信單元(PLC間通信單元、主、 從間通信單元、以及上階裝置間通信單元之總稱)、特殊功 能單元(溫度調整單元、PID控制單元、運動控制單元、位 置控制單元等)等。 在CPU單元安裝區域la配置用以安裝CPU單元之連 接器(未圖示),而且在各種功能單元安裝區域1 b將用以安 裝於那些功能單元之複數個(圖示例爲4個)連接器13a〜 1 3 d配置成一列,那些連接器1 3 a〜1 3 d經由舖設於基本單 元1上之I/O匯流排(包含有位址信號線、資料信號線各種 200825911 控制信號線)11連接。因而,CPU單元和安裝於連接器 〜1 3 d之各種功能單元可經由I/O匯流排1 1進行資料 換。 在各連接器13a〜13d之各個,內建用以根據來自 單元之控制信號而被控制開閉的電源開關(未圖示), 使此電源開關開閉,而可開關對安裝於各連接器之單 通電。又,在各連接器13a〜13d,內建和功能單元之 操作或拆卸操作連動並開閉的單元檢測手段(未圖示) 由使此單元檢測手段開閉,而可檢測已將功能單元安 該連接器、或已從該連接器拆卸功能單元。作爲單元 手段之一例,藉由採用功能單元被安裝於連接器時, 能單元和連接器間信號線變成導通的構造,而可作成 有開關之功能的構造。即,功能單元被安裝於連接器 信號線變成導通,而開關變成導通,從此狀態功能單 成拆卸狀態時,信號線被切斷,而開關變成不導通。 開關之狀態作爲檢測信號,經由信號線1 4a〜1 4d傳給 暫存器1 2即可。 在基本單元1上之各種功能單元的安裝區域lb, 具有和各連接器1 3 a〜1 3 d之各個對應的複數個個別 區域之內部暫存器(相當於本發明之狀態記憶體)1 2 外,此內部暫存器12亦可設置於CPU單元安裝區域 又亦可內建於在CPU單元安裝區域la所安裝的CPU (未圖示)。 內部暫存器1 2之各個別記憶區域,經由和I/O匯 13a 的更 CPU 藉由 元的 安裝 ,藉 裝於 檢測 在功 具備 時, 元變 將此 內部 設置 記憶 。此 la, 單元 流排 200825911 1 1不同之專用的信號線1 4 a〜1 4 d,而和連接器1 3 a〜1 3 d 連接。各連接器1 3 a〜1 3 d所內建之單元檢測手段的檢測信 號,經由信號線14a〜14d,而傳給內部暫存器12。結果, 和對任一個連接器1 3 a〜1 3 d之功能單元的拆卸操作之進 行連動,將第1狀態(例如“ 1 ”)自動地記憶於內部暫存器1 2 內之關於其連接器的個別記憶區域,而且和對任一個連接 器之功能單元的安裝操作之進行連動,將第2狀態(例如 “0”)自動地記憶於內部暫存器1 2內之關於其連接器的個別 ί " 記憶區域。因而,在內部暫存器12的各個別記憶區域,總 是處於已記憶表示時時刻刻之各連接器的單元拆裝狀態 (已安裝或已拆卸於單元之狀態)之資料的狀態。 內部暫存器1 2亦和I/O匯流排1 1連接。因而,內部 暫存器1 2之各個別記憶區域的記憶內容,可經由I/O匯流 排11而從CPU單元讀取。因而,CPU單元藉由經由I/O 匯流排11參照內部暫存器1 2之各個別記憶區域的記憶內 容,而可識別各連接器之單元拆裝狀態。 ^ " 此外,在第1圖,CPU21係內建於CPU單元的運算處 理部(包含有微處理器或ASIC)。又,記憶體22係綜合表 示CPU單元所包含之系統記憶體、工作記憶體、使用者程 式記憶體、系統設定記憶體、I/O資料記憶體、線上更換狀 態記憶體等。 其次,說明CPU單元。在第2圖表示CPU單元所內建 之微處理器管理的位址空間之指派的記憶體圖。 如第2圖所示,在位址空間,指派系統記憶體區域Μ 1、 -16- 200825911 工作記憶體區域M2、使用者程式記憶體區域M3、系統設 定記億體區域M4、I/O資料區域M5、以及線上更換狀態記 憶體區域M6。 系統記憶體區域Μ 1係記憶爲了實現構成CPU2 1的微 處理器作爲PLC之功能所需的各種系統程式(軔體)之區 域。 . 工作記憶體區域M2係在該微處理器執行系統程式時 用作記憶運算中途結果等之各種工作區域的區域。 ( 使用者程式記憶體區域M3係用以記憶使用者程式之 區域,而該使用者程式係使用者利用階梯圖語言等適當地 組合之用以實現所要的控制功能的控制程式。 系統設定記憶體區域Μ 4係在系統程式的執行時用以 記憶在預先所準備之各種選擇的設定、選擇等所需之系統 設定資訊的區域。 I/O資料區域Μ5係用以記憶使用者的控制對象系統所 包含之各種外部輸入機器(按鈕開關、極限開關、微開關等) / 的狀態、各種外部輸出機器(繼電器、各種致動器等)之狀 態等的區域。此I / 0資料區域Μ 5的資料係可用作使用者所 使用之各指令(LD指令、IN指令、OUT指令、AND指令、 〇 R指令等)的運算元。換言之,此I / Ο資料區域]V[ 5之記憶 資料可被使用者程式適當地參照。 線上更換狀態記憶體區域M6係和本發明相關聯而新 設置的區域。在此線上更換狀態記憶體區域M 6,如在第2 圖之放大所示’包含有線上更換失敗旗標Μ 6 1 0、單元種類 200825911 弄錯旗標M620以及單元側設定錯誤旗標(設定i)〜(設定 N)M631〜M63N而構成。 線上更換失敗旗標M6 1 0,係在因故對線上單元交換 (於持續運行PLC下,取卸任一之功能單元,而後,安裝上) 時失敗時由“ 0 ”置定成“ 1 ”之旗標。如後所述般,線上 單元更換失敗之原因,係存在有弄錯單元種類之情形、單 元側設定有所出錯情形等等之種種的原因。 單元種類弄錯旗標M620,係於線上單元交換之際,例 如,將原本須安裝OUT單元,弄錯而安裝成IN單元時, 於弄錯單元之種類時從“ 0 ”置定成“ 1 ”之旗標。 單元側設定(設定1〜N )錯誤旗標Μ 6 3 1〜Μ 6 3 N,係在 因故進行單元更換時,若將單元側之設定(例如在通信單元 的情況,設定1 =節點號碼(在網路上特定作爲節點之PLC 的資訊)、設定2 =單元號碼(在PLC上特定單元的資訊)等) 設定錯誤,和此設定項目相關聯地從“0”置定爲“ 1 ”的旗標。 上述之各旗標Μ610、Μ620、以及Μ631〜Μ63Ν係可 ( 用作構成使用者程式之各指令(LD指令、IN指令、OUT指 令、AND指令、OR指令等)的運算元。換言之,此I/O資 料區域Μ 5之記億資料係可被使用者程式參照。 在第3圖表示CPU單元所包含之微處理器的處理之整 體的總流程圖。如第3圖所示,在此PLC之CPU單元,在 因送上電源而剛被起動,並執行起始處理(步驟301)後,重 複地執行共同處理(步驟3 02)、使用者程式執行處理(步驟 303)、I/O重清處理(步驟304)、以及周邊服務處理(步驟 200825911 3 0 5 ) ° 在起始處理(步驟3 〇 i),係執行系統程式之執行所需要 的各種旗標或暫存器類之起始設定等的處理。 在共同處理(步驟3 02),進行包含有內部匯流排之檢查 的各種硬體檢查。在此硬體檢查時,執行和本發明相關聯 之單元已安裝確認處理(確認單元從已自連接器拆卸之狀 態變成已安裝於連接器的狀態之處理)。 在此單元已安裝確認處理,如後面之參照第5圖的詳 ( 述所示,CPU單元經由I/O匯流排11讀入內部暫存器12 之各個別記憶區域的記憶內容,再根據所讀入之記憶內 容,判定複數個連接器1 3 a〜1 3 d之各個是否從已自單元拆 卸之狀態變成已安裝的狀態之處理。 在使用者程式執行處理(步驟3 03 ),係從使用者程式記 憶體區域Μ 3 g賈出使用者使用階梯圖語言等適當地組合之 相當於使用者所要的控制規格之使用者程式並執行,而且 根據其執行結果,進行將I / 〇資料區域Μ 5內之所指定的 , I/O資料之內容改寫的處理。 在I/O重清處理(步驟3 04),係進行經由I/O匯流排1 1 向I/O單元送出在使用者程式執行處理(步驟3 0 3 )所改寫之 I/O資料區域Μ5的OUT區域之內容,而且將經由1/0匯流 排1 1從I / Ο單元所取入的輸入資料寫入I / 〇資料區域Μ 5 之IN區域的處理。 在周邊服務處理(步驟3 0 5 ),係和經由通信所連接之遙 控I/O或其他的PLC進行通信,在和其等之通信節點之間 -19- 200825911 更換資料,並經由通信和工具進行資料更換’藉此進行程 式之製作、編輯、顯示等的處理’又經由通信和可程式顯 示器進行資料更換’藉此進行將所指定之內部資料顯示於 外部等的周邊服務處理。此外,在此周邊服務處理’因應 於需要,亦進行關於各種特殊功能單元(溫度調整單元、PID 控制單元、運動控制單元、位置控制單元等)等之各個的處 理。 在以上一連串的處理(步驟3 02〜3 0 5 )之間,在複數個 ' 連接器13a〜13d之任一個,進行單元之安裝操作(安裝單 元的操作)或拆卸操作(拆卸單元之操作)時,如後述所示’ 經由信號線1 4 a〜1 4 d向內部暫存器1 2傳送主旨的信號’ 並將內部暫存器1 2之符合的個別記憶區域之記憶內容更 新爲單元已安裝狀態(本發明之第2狀態)或單元已拆卸狀 態(本發明之第1狀態)。在此,「單元之已安裝狀態」係單 元已被安裝於連接器的狀態,「單元已拆卸狀態」係已從連 接器拆卸單元的狀態。 又,在一連串的處理(步驟3 02〜3 0 5 )之間,對單元處 於已拆卸狀態之連接器進行用以讀入資料的存取時,因爲 符合之單元不存在,所以對CPU單元檢測到異常響應(經過 既定時間亦自符合之單元無響應的狀態)。在本發明,如後 述所示,利用此異常響應,而單元拆卸(單元自安裝狀態變 化成拆卸狀態)的判定所需要之內部暫存器(狀態記憶體)1 2 的參照頻次減少,藉此可減輕系統側之處理負擔。 其次,說明在一連串的處理(步驟3 02〜3 0 5 )之間’向 -20- 200825911 任一個單元存取時,在得到異常響應之情況的處理。 在第4圖表示來自單元之異常響應輸入時的細部流 程。如第4圖所示,在I/O重清處理或周邊服務處理,每 次向任一個功能單元存取,便每次要判定有無檢測到異常 響應(步驟4 0 1 ),而在判定爲未檢測到異常響應時(步驟4 0 1 爲Ν Ο ),不參照內部暫存器丨2的記憶內容,並移至所預先 決定之其他的處理。即,不必如習知例所示,在向功能單 元嘗試存取之前總是參照內部暫存器1 2的記憶內容。 而’作爲向任一個功能單元存取之結果,判定爲檢測 到異常響應時(步驟401爲YES),接著,讀入基本單元1 上之內部暫存器1 2的各個別記憶區域之內容,再根據其內 容,判定和異常響應有關之連接器處於單元已安裝狀態(已 安裝單元的狀態)、或單元已拆卸狀態(已拆卸單元的狀 態)(步驟403 )。 在此,若判定爲單元已拆卸狀態(步驟403爲YES), 在PLC依然繼續運轉下,關於所指定之連接器,爲了能拆 卸功能單元,而執行規定的單元拆卸時處理(步驟4 0 4)。在 此單元拆卸時處理(步驟404),爲了避免以後從符合之連接 器讀入錯誤的資料,而執行關於連接器之通信處理的切 斷、電源切斷等之處理。另一方面,若判定爲不是單元已 拆卸(步驟40 3爲NO),識別係由I/O匯流排1 1之異常等所 引起的真正之通信異常,並執行規定的通信異常時處理(步 驟4 0 5 )。作爲此通信異常時處理(步驟4 0 5 )的內容,可列舉 200825911 系統當機所需之各種處理等。 如此,在本發明,在PLC依然繼續運轉下,對於所指 定之連接器,關於能拆卸功能單元(單元之線上拆卸)而需 要的處理(步驟404),因爲僅當在CPU單元經由任一個連 接器向功能單元存取時檢測到異常響應(步驟40 1爲 YES) ’而且已判定關於該連接器之內部暫存器(狀態記憶 體)12的記憶內容係已拆卸狀態(第1狀態)時執行(步驟4〇3 爲YES),所以發生參照內部暫存器(狀態記憶體)12之必要 ^ 性的,係僅當在向單元存取之結果上檢測到異常響應時, 和每當CPU單元向各功能單元存取,在存取之前總是需要 參照狀態記憶體的習知例相比,大幅度減輕系統程式側之 處理負擔。 另一方面,在向任一個功能單元存取時,若發生以I/O 匯流排11之異常等真正的通信異常爲原因之異常響應,因 爲內部暫存器(狀態記憶體)1 2的記憶內容表示已安裝狀態 (第2狀態),所以正常地執行通信異常時處理,並進行系C The processing required to install the functional unit (on-line installation of the unit) is performed when it is determined that the memory of the status memory of any of the connectors is changed from the first state to the second state. It is allowed to allow some delay time for the start of the operation after the installation of the unit. Since it is only necessary to install the line monitoring line on the line, the processing load on the system program side is not a problem. The second control means of the PLC can be configured as follows. It is determined that the unit identification information read from the functional unit via the connector is determined to be inconsistent between the unit before and after the unit replacement, and is not executed. The processing required for unit installation. According to this configuration, when the unit is replaced on the line, in the case of misloading other types of functional units, since the operation of the unit does not start again, it is possible to prevent accidental addition of the unit of the wrong type of accident. thing. Further, the PLC may further include: a determination means for determining whether the content of the state memory is changed from the first state to the <second state in the case of the connector, and the slave functional unit is connected via the connector The unit identification information read in, determines whether there is a unit replacement error, and the flag control means, which is reflected in the display program of the user program or the programmable display using the programmable controller. The status of the error flag is replaced by one or more units. According to this configuration, when a cell replacement error occurs, since the specific flag is immediately set to a predetermined logical volume, if the flag is used as an input condition, the user program for lighting the display lamp is loaded. Or the /V/ flag can be loaded into the display program of the programmable display as an input condition. Even if the other tool does not exist, the user can be notified immediately that a unit replacement error has occurred. In this case, the error flag may be replaced by one or more units that can be referred to by the user program of the programmable controller or the display program of the programmable display, and includes a flag indicating that the online replacement failed. According to this configuration, it is only necessary to preload the user program that lights the indicator light using the flag as an input condition, or the flag is used as an input -12-200825911 condition to load the display program of the programmable display, even if In addition, the tool does not exist, and in any case, the user may be notified via a display light or a programmable display to cause a failure in the line of the unit for any reason. Further, the error flag may be replaced by one or more units that can be referred to by the user program of the programmable controller or the display program of the programmable display, and include a flag indicating the type of the wrong function unit. According to this configuration, it is only necessary to pre-load the user program that lights the indicator light using the flag as an input condition, or load the flag as an input f \ I condition into the display program of the programmable display, even if another If the tool does not exist, the user can be notified via a display light or a programmable display to misload the unit of the other type when the removed unit is replaced. In addition, if the flag is used as an input condition and a user program equivalent to the countermeasure for online replacement error is loaded, an appropriate countermeasure can be taken depending on the type of error. In addition, it is also possible to replace the error flag with one or more units that can be referred to by the user program of the programmable controller or the display program of the programmable display, including a setting indicating that the unit side is mistaken. The flag of the project setting. According to this configuration, it is only necessary to preload the user program that lights the display lamp with the flag as an input condition, or loads the flag as an input condition into the display program of the programmable display, even if another tool does not exist. 'It is also possible to notify the user via the indicator light or the programmable display that the setting of the i setting items on the unit side is mistaken when the unit that has been disassembled is replaced. In addition, if the flag is used as an input condition and the user program corresponding to the countermeasures for the error is replaced on the line, it is also possible to take appropriate measures in response to the type of error. [Effects of the Invention] According to the present invention, it is possible to provide a programmable controller which can realize the toolless online assembly and disassembly of the unit, and can reduce the processing load on the system program side when the unit is disassembled. [Embodiment] Hereinafter, one embodiment of the best implementation of the PLC of the present invention will be described in detail with reference to the drawings. Fig. 1 is a structural diagram showing a basic unit of a PLC. As shown in Fig. 1, the basic unit 1 is an elongated rectangular plate-like member, which is also referred to as a bottom plate or a mother board, and defines a CPU unit mounting region 1a and a plurality of functional unit mounting regions 1b on its surface. Here, as various functional units other than the CPU unit, as is well known in the art, I/O units (IN unit, OUT unit, and a general term for IN and OUT mixing units) and communication units (inter-PLC communication units, A general term and a communication unit between the master and the inter-unit communication unit, a special function unit (temperature adjustment unit, PID control unit, motion control unit, position control unit, etc.). A connector (not shown) for mounting the CPU unit is disposed in the CPU unit mounting area 1a, and a plurality of (four in the illustrated example) connections for mounting the functional units in the various functional unit mounting areas 1b are provided. The devices 13a~1 3d are arranged in a row, and the connectors 1 3 a~1 3 d are connected via the I/O bus bar (including the address signal line and the data signal line various 200825911 control signal lines) laid on the basic unit 1. 11 connections. Therefore, the CPU unit and various functional units mounted on the connectors 1-3d can be exchanged via the I/O bus 1 1 . A power switch (not shown) for controlling opening and closing according to a control signal from the unit is built in each of the connectors 13a to 13d, and the power switch is opened and closed, and the switch can be connected to each connector. power ups. Further, in each of the connectors 13a to 13d, a unit detecting means (not shown) in which the built-in and the operation and disassembly operations of the functional unit are interlocked and opened and closed is opened and closed by the unit detecting means, and the functional unit can be detected to be connected. , or the functional unit has been removed from the connector. As an example of the means of the unit, when the functional unit is mounted on the connector, the signal line between the unit and the connector becomes conductive, and a structure having a function as a switch can be realized. That is, when the functional unit is mounted on the connector, the signal line becomes conductive, and the switch becomes conductive. When the state function is simply removed, the signal line is cut off and the switch becomes non-conductive. The state of the switch is transmitted as a detection signal to the register 1 2 via the signal lines 14a to 14d. The mounting area lb of the various functional units on the base unit 1 has an internal register of a plurality of individual areas corresponding to each of the connectors 1 3 a to 1 3 d (corresponding to the state memory of the present invention) 1 In addition, the internal register 12 may be provided in the CPU unit mounting area or may be built in a CPU (not shown) installed in the CPU unit mounting area la. The individual memory areas of the internal register 1 2 are stored by the more CPU of the I/O sink 13a by means of the installation of the element, and the meta-change internally sets the memory. This la, unit flow row 200825911 1 1 different dedicated signal lines 1 4 a~1 4 d, and connected to the connector 1 3 a~1 3 d. The detection signals of the unit detecting means built in each of the connectors 1 3 a to 1 3 d are transmitted to the internal register 12 via the signal lines 14a to 14d. As a result, in conjunction with the disassembly operation of the functional unit of any of the connectors 1 3 a to 1 3 d, the first state (for example, "1") is automatically memorized in the internal register 1 2 for its connection. The individual memory areas of the device, and in conjunction with the mounting operation of the functional units of any of the connectors, automatically remember the second state (eg, "0") in the internal register 1 2 about its connector Individual ί " memory area. Therefore, in the respective memory areas of the internal register 12, it is always in the state of the data of the unit disassembly state (the state in which the unit has been mounted or disassembled) that has been memorized at all times. The internal register 1 2 is also connected to the I/O bus 1 1 . Therefore, the memory contents of the respective memory areas of the internal register 12 can be read from the CPU unit via the I/O bus line 11. Therefore, the CPU unit can recognize the unit disassembly state of each connector by referring to the memory contents of the respective memory areas of the internal register 1 via the I/O bus 11 . ^ " In addition, in Fig. 1, the CPU 21 is built in the arithmetic processing unit (including a microprocessor or an ASIC) of the CPU unit. Further, the memory 22 comprehensively displays the system memory, the working memory, the user program memory, the system setting memory, the I/O data memory, and the online replacement state memory included in the CPU unit. Next, the CPU unit will be described. Fig. 2 shows a memory map of the assignment of the address space managed by the microprocessor built in the CPU unit. As shown in Figure 2, in the address space, the system memory area is assigned Μ 1, -16- 200825911 working memory area M2, user program memory area M3, system setting memory area M4, I/O data The state M5 and the state memory area M6 are replaced on the line. The system memory area Μ 1 is a memory area for realizing various system programs (body) required for the microprocessor constituting the CPU 2 1 to function as a PLC. The working memory area M2 is an area used for various work areas such as the result of the middle of the memory operation when the microprocessor executes the system program. (The user program memory area M3 is an area for storing a user program, and the user program is a control program for appropriately implementing a desired control function by using a ladder diagram language or the like. System setting memory The area Μ 4 is an area for storing system setting information required for setting, selecting, and the like of various options prepared in advance when the system program is executed. The I/O data area Μ 5 is used to memorize the user's control target system. Various external input devices (button switches, limit switches, micro switches, etc.) / states, various external output devices (relays, various actuators, etc.), etc. This I / 0 data area Μ 5 The data can be used as an operation unit for each instruction (LD instruction, IN instruction, OUT instruction, AND instruction, 〇R instruction, etc.) used by the user. In other words, the I/Ο data area]V[5 memory data can be used. It is appropriately referred to by the user program. The online replacement state memory area M6 is an area newly associated with the present invention. The state memory area M 6 is replaced on this line. As shown in the enlarged view of Figure 2, 'including the wire replacement failure flag Μ 6 1 0, unit type 200825911 error flag M620, and unit side setting error flag (setting i) ~ (setting N) M631~M63N And the online replacement failure flag M6 1 0 is set to "0" when the online unit exchange (for the continuous operation of the PLC, the function unit is removed or not, and then installed) fails. The flag of 1 ”. As will be described later, the reason for the failure of the online unit replacement is that there are various types of wrong unit types, and the unit side setting has an error situation, etc. Unit type error flag M620 When the online unit is exchanged, for example, when the OUT unit is originally installed and mistakenly installed as an IN unit, the flag of "1" is set from "0" when the type of the unit is mistaken. Setting (setting 1 to N) error flag Μ 6 3 1~Μ 6 3 N, if the unit is replaced for some reason, set the unit side (for example, in the case of the communication unit, set 1 = node number (in Information about a PLC that is a node on the network , setting 2 = unit number (information on a specific unit on the PLC), etc.) setting error, and flag set from "0" to "1" in association with this setting item. Each of the above flags Μ610, Μ620, And Μ631~Μ63Ν can be used as operands for each instruction (LD command, IN command, OUT command, AND command, OR command, etc.) constituting the user program. In other words, this I/O data area Μ 5 The data can be referred to by the user program. Fig. 3 shows the overall flow chart of the processing of the microprocessor included in the CPU unit. As shown in Fig. 3, the CPU unit of the PLC is powered by the power supply. And immediately after being started, and performing the initial processing (step 301), the common processing (step 312), the user program execution processing (step 303), the I/O re-clear processing (step 304), and the periphery are repeatedly performed. Service processing (step 200825911 3 0 5 ) ° In the initial processing (step 3 〇i), the processing of the various flags or the start settings of the scratchpad class required for execution of the system program is executed. In the joint processing (step 3 02), various hardware inspections including the inspection of the internal bus bars are performed. At the time of this hardware inspection, the unit that performs the execution of the present invention has installed the confirmation processing (the processing of confirming that the unit has been removed from the connector to the state in which it has been mounted to the connector). In this unit, the confirmation processing is installed. As will be described later with reference to FIG. 5 (the CPU unit reads the memory contents of the respective memory areas of the internal register 12 via the I/O bus 11 and then according to the Read the memory content, and determine whether each of the plurality of connectors 1 3 a to 1 3 d has been changed from the state in which the unit has been removed to the state in which it has been installed. The user program performs processing (step 3 03 ), The user program memory area Μ 3 g is used by the user to appropriately combine the user program corresponding to the user's desired control specification using a ladder diagram language or the like, and based on the execution result, the I / 〇 data area is performed. The processing of rewriting the contents of the I/O data specified in Μ 5. In the I/O re-clearing process (step 3 04), the user is sent to the I/O unit via the I/O bus 1 1 The program execution processing (step 3 0 3 ) rewrites the contents of the OUT area of the I/O data area Μ 5, and writes the input data taken from the I / Ο unit via the 1/0 bus 1 1 to I / 〇 Processing of the IN area of the data area Μ 5. Peripheral services (Step 3 0 5), communicate with remote I/O or other PLC connected via communication, exchange data with its communication nodes -19- 200825911, and exchange data via communication and tools 'The process of creating, editing, displaying, etc. of the program is performed, and the data is exchanged via the communication and the programmable display'. The peripheral service processing for displaying the designated internal data to the outside is performed. Processing "In response to the need, various processing of various special function units (temperature adjustment unit, PID control unit, motion control unit, position control unit, etc.) are also performed. In the above series of processing (step 3 02~3 0 5 Between the plurality of connectors 13a to 13d, when the unit is mounted (operation of the mounting unit) or disassembled (operating the unit), as described later, 'via the signal line 1 4 a ~1 4 d to transfer the message of the subject to the internal register 1 2 and update the memory contents of the individual memory areas of the internal register 1 2 to the unit The installed state (the second state of the present invention) or the unit removed state (the first state of the present invention). Here, the "unit mounted state" is the state in which the unit has been mounted on the connector, "the unit has been removed. "State" is the state in which the unit has been detached from the connector. Also, during a series of processes (steps 3 02 to 3 0 5 ), when the connector in the detached state is accessed for reading data, Since the matching unit does not exist, an abnormal response is detected to the CPU unit (a state in which the self-conforming unit does not respond after a predetermined time). In the present invention, as described later, the abnormal response is utilized, and the unit is disassembled (unit The reference frequency of the internal temporary memory (state memory) 1 2 required for the determination of the installation state to change to the disassembled state is reduced, whereby the processing load on the system side can be reduced. Next, a description will be given of a case where an abnormal response is obtained when accessing any of the units -20-200825911 between a series of processes (steps 3 02 to 300). Figure 4 shows the detail flow from the unit's anomalous response input. As shown in FIG. 4, in the I/O re-clearing process or the peripheral service processing, each time it is accessed to any one of the functional units, it is determined whether or not an abnormal response is detected each time (step 4 0 1 ), and it is determined as When the abnormal response is not detected (step 4 0 1 is Ν Ο ), the memory contents of the internal register 丨 2 are not referred to, and the processing is moved to another predetermined process. That is, it is not necessary to always refer to the memory contents of the internal scratchpad 12 before attempting access to the function unit as in the conventional example. On the other hand, when it is determined that an abnormal response is detected as a result of accessing to any one of the functional units (YES in step 401), the contents of the respective memory areas of the internal temporary memory 1 on the basic unit 1 are read, Further, based on the content, it is determined that the connector related to the abnormal response is in the unit mounted state (the state of the mounted unit), or the unit has been disassembled (the state of the disassembled unit) (step 403). Here, if it is determined that the unit has been disassembled (YES in step 403), and the PLC continues to operate, the specified unit is removed in order to disassemble the functional unit (step 4 0 4). ). When the unit is disassembled (step 404), in order to prevent the erroneous data from being read from the matching connector, the processing of the communication processing of the connector, the power cut, and the like are performed. On the other hand, if it is determined that the unit has not been disassembled (NO in step 40 3), the identification is a true communication abnormality caused by an abnormality of the I/O bus 1 1 or the like, and a predetermined communication abnormality processing is executed (step 4 0 5 ). As the content of the communication abnormality processing (step 405), various processing required for the 200825911 system crash can be cited. Thus, in the present invention, the processing required for the detachable functional unit (on-line detachment of the unit) is required for the designated connector (step 404) while the PLC is still operating, because only when the CPU unit is connected via any one. When an abnormal response is detected when the device accesses the function unit (YES in step 40 1), and it is determined that the memory content of the internal register (state memory) 12 of the connector is in the disassembled state (first state) Execution (step 4〇3 is YES), so the reference to the internal scratchpad (state memory) 12 is necessary only when an abnormal response is detected on the result of accessing the unit, and whenever the CPU The unit accesses each functional unit, and it is always necessary to refer to the state memory prior to access, and the processing load on the system program side is greatly reduced. On the other hand, when accessing to any one of the functional units, an abnormal response due to a true communication abnormality such as an abnormality of the I/O bus 11 occurs because of the internal memory (state memory) 1 2 memory. The content indicates the installed state (second state), so the communication abnormality processing is performed normally, and the system is performed.
U 統當機等之必要處理。 其次,說明在PLC依然繼續運轉下,對於所指定之連 接器’用以實現能安裝功能單元(單元之線上安裝)之處理。 在第5圖係表示單元已安裝判定時處理之細部流程 圖。如第5圖所示,在CPU單元每當共同處理(步驟302) 到了’藉由讀入內部暫存器1 2之記憶內容,而確認單元拆 裝狀態。然後,根據內部暫存器! 2之記憶內容,判定有無 單元安裝(從已拆卸單元之狀態變成已安裝的狀態)。在 -22- 200825911 此,判定爲無單元安裝時(步驟5 0 2爲Ν Ο ),什麼也未執行 地,馬上移至已決定之其他的處理。 而判定爲有單元安裝時(步驟502爲YES),移至以下 一連串的處理(步驟503〜508)。首先,藉由送上連接器電 源,而開始對此連接器所連接之單元供電(步驟5 0 3 ),而且 從該單元經由I/O匯流排1 1讀入既定之單元識別資訊(由 複數個項目構成),再將其和在前面之單元安裝時所讀入並 記憶的單元識別資訊(由複數個項目構成)比對,藉此識別 Γ' % 單元種類(步驟5 04)。 在此,作爲該比對之結果,若判定爲新安裝之單元的 種類和之前所安裝之單元的種類一致(步驟5 0 5爲YES), 就使規定的單元安裝時處理開始(步驟5 06)。在此單元安裝 時處理開始(步驟5 06),執行使通信再開始等之對各單元所 預先決定的正常動作之復原處理。 而,若判定爲新安裝之單元的種類和之前所安裝之單 元的種類不一致(步驟5 0 5爲NO),就不執行該單元安裝時 % ^ 處理(步驟5 06),替代之,藉由比較新安裝之單元的單元識 別資訊(由複數個項目構成)和之前所安裝之單元的單元識 別資訊(由複數個項目構成),而產生錯誤資訊。將照這樣 所得的錯誤資訊儲存於CPU單元之記憶體內的線上更換狀 態記憶體區域Μ 6。 如上述所示,在此線上更換狀態記憶體區域Μ 6,包含 有線上更換失敗旗標Μ 6 1 0、單元種類弄錯旗標Μ 6 2 0以及 單元側設定錯誤旗標(設定1)〜(設定Ν)Μ631〜Μ63Ν,在 -23 - 200825911 此錯誤資訊儲存處理(步驟5 0 7),將在上述所產生之錯誤資 訊反映於那些旗標M610、M620、以及M631〜M63N的狀 態(例如“1”或“〇”)。 因此,使用者以將這些旗標M610、M620、以及M631 〜M63N作爲輸入條件來將既定之顯示燈點燈的方式裝入 使用者程式,或者如第6圖所示,在市面上之可程式顯示 器,將那些旗標M610、M620、以及M631〜M63N作爲條 件,顯示合乎那些旗標之意義內容的文字或圖形,藉此, 即使在P L C未連接工具,亦經由一般之顯示燈或可程式顯 示器6上的文字或圖形,而可易於確認線上更換失敗、失 敗原因在於弄錯單元種類、設錯單元側之哪一個設定等。 此外,在第6圖,2係CPU單元,3係I/O單元,4係 通信單元,5係運動控制單元或PID控制單元等之特殊功 能單元,在本例,係替代從基本單元1拆下已故障之通信 單元4a,而新安裝正常的通信單元4b。 此時,例如,若安裝其他的單元,而不是故障之通信 單元,線上更換失敗旗標M6 10及單元種類弄錯旗標M6 20 就被設定爲“ 1 ”。又,若設定項目1〜N的任一個係錯誤, 旗標Μ 6 3 1〜Μ 6 3 N之符合者就被設定爲“ 1 ”。U is necessary to handle the machine. Next, it is explained that, in the case where the PLC continues to operate, the specified connector s is used to implement the process of installing the functional unit (on-line installation of the unit). Fig. 5 is a detailed flow chart showing the processing when the unit has been mounted. As shown in Fig. 5, the CPU unit confirms the unit disassembled state by collectively processing (step 302) to "by reading the memory contents of the internal register 12". Then, according to the internal register! 2 Memory contents, determine whether there is a unit installation (from the state of the removed unit to the installed state). In -22-200825911, when it is determined that there is no unit installation (step 502 is Ν Ο), if nothing is executed, it is immediately moved to the other processing that has been decided. When it is determined that there is a cell installation (YES in step 502), the process proceeds to the following series of processes (steps 503 to 508). First, power is supplied to the unit to which the connector is connected by supplying the power of the connector (step 503), and the predetermined unit identification information is read from the unit via the I/O bus 1 1 (by the plural The item structure is compared with the unit identification information (consisting of a plurality of items) read and memorized in the previous unit installation, thereby identifying the Γ'% unit type (step 504). Here, as a result of the comparison, if it is determined that the type of the newly installed unit matches the type of the previously installed unit (YES in step 505), the predetermined unit mounting processing is started (step 506). ). At the time of installation of this unit, the processing is started (step 506), and the restoration processing of the normal operation predetermined for each unit such as restarting the communication is performed. However, if it is determined that the type of the newly installed unit does not match the type of the previously installed unit (NO in step 505), the % ^ processing (step 5 06) at the time of the unit installation is not performed, instead, by The unit identification information (consisting of a plurality of items) of the newly installed unit and the unit identification information (consisting of a plurality of items) of the previously installed unit generate error information. The error information thus obtained is stored in the line in the memory of the CPU unit to replace the state memory area Μ 6. As shown above, the status memory area Μ 6 is replaced on this line, including the wired replacement failure flag Μ 6 1 0, the unit type error flag Μ 6 2 0, and the unit side setting error flag (setting 1)~ (Settings Μ) Μ 631 Μ Μ 63 Ν, in -23 - 200825911 This error information storage processing (step 507) reflects the error information generated above in the states of the flags M610, M620, and M631 to M63N (for example) "1" or "〇"). Therefore, the user loads the predetermined display lamp into the user program by using these flags M610, M620, and M631 to M63N as input conditions, or as shown in FIG. The display, with the flags M610, M620, and M631~M63N as conditions, displays text or graphics that conform to the meaning of those flags, thereby allowing the general display or programmable display even if the PLC is not connected to the tool. The text or graphics on the 6 can easily confirm the failure of the online replacement. The reason for the failure is the type of the wrong unit, which setting on the wrong unit side. In addition, in Fig. 6, a special function unit such as a CPU unit, a 3-series I/O unit, a 4-series communication unit, a 5-series motion control unit or a PID control unit is used in this example instead of being removed from the basic unit 1. The failed communication unit 4a is installed, and the normal communication unit 4b is newly installed. At this time, for example, if another unit is installed instead of the failed communication unit, the line replacement failure flag M6 10 and the unit type error flag M6 20 are set to "1". Further, if any of the setting items 1 to N is incorrect, the match of the flag Μ 6 3 1 to Μ 6 3 N is set to "1".
因此,以將這些旗標Μ610、Μ620、以及Μ631〜Μ63Ν 作爲輸入條件來將既定之顯示燈點燈的方式裝入使用者程 式,或者如第6圖所示,在市面上之可程式顯示器,將那 些旗標Μ610、Μ620、以及Μ631〜Μ63Ν作爲輸入條件, 顯示合乎那些旗標之意義內容的文字或圖形,藉此,在PLC -24 - 200825911 未連接工具,亦經由一般之顯示燈或可程式顯示器6上的 文字或圖形,而可易於確認線上更換失敗、失敗原因在於 弄錯單元種類、設錯單元側之哪一個設定項目等。 此外’若將那種旗標作爲輸入條件,並預先裝入相當 於單元更換錯誤時之對策的使用者程式,亦可對該.各單 元,因應於錯誤的種類,採用在限定動作範圍或動作條件 之後繼續運轉等之適當的對應。 [工業上之可應用性] 若 依 據 本 發 明 ,可提供一種可程式控制器,其可 實 現 單元 之 Μ J V ΝΝ 工 具 的 線 上拆裝,而且在單元拆卸之判定時 可 減 輕系 統 程 式 側 的 處 理負擔。 【圖 式 簡 單 說 明 ] 第 1 圖 係 PLC 之基本單元的構造圖。 第 2 圖 係 表 示 C P U單元內之資料配置的記憶體圖 〇 第 3 圖 係 表 示 C P U單元之處理整體的流程圖。 第 4 圖 係 來 白 單元之異常響應輸入時的細部流程 圖 〇 第 5 圖 係 單 元 已安裝時處理之細部流程圖。 第 6 圖 係 本 發 明之作用說明圖。 【元 件 符 號 說 明 ] 1 基本單元 la CPU單元安裝區域 lb 各種功能單元安裝區域 2 CPU單元 3 I/O單元 -25 - 200825911 /Therefore, the flag Μ 610, Μ 620, and Μ 631 Μ Μ 63 Ν are used as input conditions to load a predetermined display lamp into the user program, or as shown in FIG. 6, the commercially available programmable display, The flags Μ610, Μ620, and Μ631~Μ63Ν are used as input conditions to display texts or graphics that conform to the meaning of those flags. Thus, the tools are not connected in PLC-24 - 200825911, and the general display lights or The text or graphics on the program display 6 can be easily confirmed by the failure of the online replacement, and the failure is caused by the type of the wrong unit, which setting item on the wrong unit side. In addition, if the flag is used as an input condition and a user program corresponding to the countermeasure for the unit replacement error is preloaded, the unit may be used in a limited range or action depending on the type of error. After the condition, continue the operation and the appropriate correspondence. [Industrial Applicability] According to the present invention, a programmable controller can be provided which can realize the online disassembly and assembly of the unit Μ JV ΝΝ tool, and can reduce the processing load on the system program side when determining the unit disassembly. . [Simple description of the drawing] Fig. 1 is a structural diagram of the basic unit of the PLC. The second figure shows the memory map of the data configuration in the C P U unit. The third figure shows the flow chart of the processing of the C P U unit as a whole. Figure 4 shows the detail flow when the abnormal response is input to the white unit. Figure 5 Figure 5 is a detailed flow chart of the processing when it is installed. Figure 6 is an explanatory diagram of the action of the present invention. [Element Symbol Description] 1 Base unit la CPU unit installation area lb Various function unit installation areas 2 CPU unit 3 I/O unit -25 - 200825911 /
4 通信單元 5 特殊功能單元 6 可程式顯示器 11 I/O匯流排 12 內部暫存器 13a、13b、13c、13d 槽 14 信號線 2 1 CPU 22 記憶體 Ml 系統記憶體區域 M2 工作記憶體區域 M3 使用者程式記憶體區域 M4 系統設定記憶體區域 M5 I/O資料區域 M6 線上更換狀態記憶體區域 M6 1 0 線上更換失敗旗標 M620 單元種類弄錯旗標 M63 1 〜M63N 單元側設定錯誤旗標(設定1〜N) -26 -4 Communication unit 5 Special function unit 6 Programmable display 11 I/O bus 12 Internal register 13a, 13b, 13c, 13d Slot 14 Signal line 2 1 CPU 22 Memory Ml System memory area M2 Working memory area M3 User program memory area M4 System setting memory area M5 I/O data area M6 Online replacement status memory area M6 1 0 Online replacement failure flag M620 Unit type error flag M63 1 to M63N Unit side setting error flag (Setting 1~N) -26 -