PROGRAMMABLE CONTROLLER

Abstract: A programmable controller which handles both bit data and word data includes storage means (1) having a memory area which is divided into blocks (B₁, B₂, B₃ ... and W₁, W₂, W₃...) each having a predetermined length which corresponds to the number of bits constituting one word. An address is put to each of the blocks, and one bit data or one word data is selectively stored in each of the blocks. Thus, the memory area is provided with flexibility, and the preparation of a program is facilitated.

Description: When both bit data and word data are handled in a conventional programmable controller (hereinafter abbreviated to a "PCS"), it has heretofore been general practice to handle them separately from each other or handle word data as a set of pieces of bit data irrespective of whether the system is a small-scale PCS or a large-scale PCS. Thus, no consideration has heretofore been taken to facilitation of programming and simplification of the circuit configuration. In the conventional programming, it is general practice to set an area for outputting bit dat and an area for outputting word data separately from each other. This conventional method surffers, however, from the following problem. Since each of the above-described areas is determined in advance, it is impossible to cope with a change in the ratio in size between bit data and word data which may occur due to the difference between users' programs. Accordingly, it is impossible with the above-described conventional method to satisfy a specification demanded by each individual user. In addition, when the program is changed, after a PCS has been delivered to a user, so that the amount of bit data or word data is excessively large, such data cannot be accommodated in a predetermined area, which means that it is impossible to store the program, disadvantageously. It should be noted that examples of prior arts related to the device of the type described above include those disclosed in Japanese Patent Laid-Open Nos. 57111/1981 and 23110/1982. Prior art document EP-A- 0 156 316 discloses a memory device for a picture display. In it, selectively either entire words can be addressed or single bits. In dependence of this selection, different parts of a 16-bit address are used for addressing. In case of word addressing, writing and reading can be effected, whereas in case of bit-addressing only writing can be effected. Prior art document US-A 4 099 253 discloses a random accesss memory with bit-or byte -addressing capability. Bytes are stored in memory banks. One memory bank consists of eight chips, each having the same bit capacity. When a byte has to be stored, the bits are distributed over the eight chips. For bit-addressing, one of these chips can be selected in accordance with the signals from three further address lines. It is a primary object of the present invention to provide a PCS which is capable of handling both bit data and word data with a simplified circuit configuration and which is designed to facilitate programming. This object is solved in accordance with the features of the independent claims, dependent claims are directed on preferred embodiments of the present invention. In the following, single embodiments according to the present invention are described with reference to the figures, wherein Figs. 1 and 2 respectively show bit data and word data which are stored in respective memory areas in accordance with one embodiment of the present invention; Fig. 3 shows bit data and word data which are mixedly stored in one memory area in accordance with the embodiment of the present invention; Fig. 4 shows the way in which data is exchanged between a storage means and an input/output circuit according to the embodiment of the present invention; Fig. 5 is a time chart showing signals transmitted through data and address buses in the embodiment of the present invention; Fig. 6 shows the state of the internal output in the embodiment of the present invention; Figs. 7 and 8 respectively show bit data and word data which are stored in respective memory areas in a large- or medium-scale PCS; Fig. 9 shows bit data and word data which are mixedly stored in one memory area in a large- or medium-scale PCS; Fig. 10 shows the way in which data is exchanged between a storage means and an input/output circuit in a large- or medium-scale PCS; Fig. 11 is a time chart showing signals transmitted through data and address buses in a large- or medium-scale PCS; Figs. 12 and 13 respectively show bit data and word data which are stored in respective memory areas in a small-scale PCS; Fig. 14 shows bit data and word data which are mixedly stored in one memory area in a small-scale PCS; Fig. 15 shows the way in which data is exchanged between a storage means and an input/output circuit in a small-scale PCS; Fig. 16 is a time chart showing signals transmitted through data and address buses in a small-scale PCS; Fig. 17 shows the state of the internal output in a large- or medium-scale PCS; and Fig. 18 shows the state of the internal output in a small-scale PCS. DESCRIPTION OF THE PREFERRED EMBODIMENTS Data which is handled by a PCS includes bit data concerning, for example, an input representing the ON/OFF state of a switch and an output for starting/stopping a motor and word data concerning, for example, an input representing a temperature value, an output for controlling the angle of opening of a valve and the result of comparison of a count. Many of small-scale PCSs handle bit data alone. However, it has become essential for small-scale PCSs to handle also word data in order to widen the range within which they can process data. In handling bit data and word data in PCSs, critical consideration lies in memory assignment of data and exchange of data between a storage means and an input/output (I/O) circuit, and the memory assignment is related directly to programming carried out by a user. The memory assignment of data will first be explained below. There are two methods of assigning bit data to a memory as shown in Figs. 7 and 12. In the method shown in Fig. 12, the seventh bit in each address is assigned to each bit of the five bit data items B1 to B5. Accordingly, a memory area for five addresses from AAA0 to AAA4 is needed for five bit data items, for example, B1 to B5. In this case, the bit 0 to the bit 6 are not used. In the method shown in Fig. 7, on the other hand, a memory area for one address AAA0 is assigned to bit data from B1 to B8, and a memory area for another address AAA1 is assigned to the next bit data from B9 to B15. In this way, memory areas are successively assigned to subsequent bit data items. In this case, eight bit data items are stored in a memory area for one address alone, and all the memory area is used. Comparison between the methods respectively shown in Figs. 12 and 7 finds that the method shown in Fig. 7 involves higher memory utilizing efficiency and enables data to be stored in a memory area which is an eighth of that in the case of the method shown in Fig. 12. However, when the bit data is processed, the method shown in Fig. 7 necessitates taking out a necessary bit from an 8-bit address, which means that the method shown in Fig. 12 is easier than the method shown in Fig. 7 and involves a higher processing speed than that in the latter. There are also two methods of assigning word data to a memory as shown in Figs. 8 and 13. In the method shown in Fig. 13, only the seventh bit in each memory area is used, and eight addresses, for example, from AAA0 to AAA7, are needed for one word. In this method, the bit 0 to the bit 6 are not used in a manner similar to that in the method shown in Fig. 12. In the method shown in Fig. 8, one address is assigned to one word, and therefore all the memory area is used efficiently. In general, the method shown in Fig. 8 is superior to the method shown in Fig. 13, but the latter has the merit that the same hardware arrangement as that for the method shown in Fig. 12 can be employed. In the course of accomplishing this invention, the present inventor examined a method obtained by combining together the two methods shown in Figs. 7 and 8 and a method obtained by combining together the two methods shown in Figs. 12 and 13. The combination of the methods shown in Figs. 7 and 8 was mainly examined from the viewpoint of memory utilizing efficiency. In general, one memory area is fixedly used for word data, while another memory area is fixedly used for bit data, and a predetermined memory area is allowed to be used for both bit data and word data for the purpose of increasing flexibility. Accordingly, when a user uses one word in programming, a memory area for eight bit data items becomes impossible to use, and this hinders the device from being handled easily. More specifically, when word data and bit data are mixed in a program, for example, when one word data, five bit data items and one word data are successively stored from the address AAA0 in the memory, one word data occupies a memory area for eight bit data items as shown in Fig. 9. Further, since one word data cannot be stored in such a manner that it is scattered over two consecutive addresses, when bit data is present between two word data items as shown in Fig. 9, if the number of bit data items is smaller than eight, there are blank bits at the address where the bit data is stored, resulting in a lowering of the memory utilizing efficiency. In addition, sicne word data and bit data are mixed together, numbers which are consecutively put to word and bit data items stored at respective addresses are not necessarily coincident with the corresponding address numbers, which involves much time and labor in preparation of a program. disadvantageously. On the other hand, the combination of the methods shown in Figs. 12 and 13 enables the conventional hardware to be used but requires a relatively large memory area to store word data, which means that the memory utilizing efficiency disadvantageously low. Accordingly, this method also fails to enable the user to handle the device easily in a manner similar to that in the case of the combination of the methods shown in Figs. 7 and 8. More specifically, when word data and bit data are mixed in a program as in the case of the combination of the methods shown in Figs. 7 and 8, for example, when one word data, five bit data items and one word data are successively stored from the address AAA0, addresses are divided into blocks each consisting of a number of addresses which is equal to the number of bits constituting one word data, and either word data or bit data is stored in each block as shown in Fig. 14. In the example shown in Fig. 14, word data W1 is stored from the address AAA0 to the address AAA7, and bit data items B1 to B5 are respectively stored at the addresses AAA8 to AAAC. The addresses AAAD, AAAE and AAAF are blank addresses, and the subsequent word data W3 is stored from the address AAB0 to the address AAB7. In this case, if bit data items are stored at all the addresses AAA0 to AAA7, the numbers B1 to B8 are put to these bit data items, respectively. Accordingly, the number B9 is put to the bit data item which is stored at the ninth address AAA8, and the numbers B10 to B13 are put to the following bit data items, respectively. Similarly, if word data items are stored at all the addresses AAA0 to AAAF, the word data which is stored from the address AAB0 to the address AAB7 is the third word data, and the number W3 is therefore put to this word data. Since one word data cannot be stored in such a manner that it is scattered over two consecutive address blocks each consisting of eight addresses, if the number of a series of bit data items is less than eight, there are blank addresses, so that the memory utilizing efficiency is further deteriorated in the case of a program in which word data and bit data are mixed together. In this example also, since word data and bit data are mixed together, numbers which are consecutively put to word and bit data items stored at respective addresses are not necessarily coincident with the corresponding address numbers and may be inconsecutive, which involves much time and labor in preparation of a program, disadvantageously. The exchange of data between a storage means and an input/output circuit will next be explained. There are two methods, which are respectively shown in Figs. 10 and 15, respectively corresponding to the combination of the methods shown in Figs. 7 and 8 are the combination of the methods shown in Figs. 12 and 13. In the method shown in Fig. 10, there are eight data buses and therefore word data can be handled as it is in response to one address signal. As to bit data, however, since one address data contains eight bit data items, it is necessary to take out one bit from the eight-bit data, which means that the circuit configuration is complicated, but the address space can be utilized efficiently. Fig. 11 exemplarily shows signals transmitted through data and address buses shown in Fig. 10. If bit data has been stored at a particular address, when a signal designating this address is applied to the address bus, bit data items stored at the address are output to eight data buses in the form of digital signals "1" or "0". In this method, since eight bit data items are simultaneously output in response to one address signal, it is necessary to select a necessary bit from the output bit data items by the use of a gate circuit or the like. Further, in order to read the bit data items successively, it is necessary to output the address signal eight times and successively read the bit data items output in response to each address signal, and this involves the problem that it takes much time to read out bit signals. If data which has been stored at a particular address if word data, it is read out as it is in response to one address signal and then transmitted to the input/output circuit. In the method shown in Fig. 15, since there is only one data bus, each bit data item can be input or output in response to one address signal, but word data must be input or output in the form of temporally serial data by successively changing address signals. Since this method uses only one data bus, the circuit configuration is simplified. Fig. 16 exemplarily shows signals transmitted through the data and address buses shown in Fig. 15. If data stored in a particular memory area is bit data, since one bit data item is stored at one address, each bit data item can be read out immediately in response to one address signal. If data stored in a particular memory area is word data since word data is stored in such a manner that bits constituting each word data are scattered over eight consecutive addresses, it is necessary to successively output eight address signals in order to transmit data items read out from the respective addresses in the form of temporally serial data. Accordingly, it takes much time to transmit word data, and it is necessary for the reception side to provide a circuit for connecting the serial data into one word data. The following is a description of the method of using an internal output in a program. The internal output is a result of a sequence processing which is not output to the outside but temporarily stored inside the PCS so as to be used for another sequence processing. Fig. 17 is a table showing internal output assignment corresponding to the combination of the methods shown in Figs. 7 and 8. Since a bit output and a word output cannot be used simultaneously for the same address in programming, care must be taken to avoid overlapping of the bit and word outputs, so that it takes much time to prepare a program. For example, when the word data W2 is used, it is impossible to use the output of eight bit data items B9 to B16, and it is necessary to arrange a program while calculating the number of bits that cannot be used, and this needs much time and labor and great care to prepare a program. Further, since one word data corresponds to eight bit data items, the number of available internal word outputs is an eighth of the number of available internal bit outputs. Fig. 18 is a table showing internal output assignment corresponding to the combination of the methods shown in Figs. 12 and 13. In this case also, problems similar to the above are encountered when a program is prepared, and since each word data is scattered over eight consecutive addresses, the number of available internal word outputs is reduced disadvantageously. As described above, neither of the combination of the methods shown in Figs. 7 and 8 nor the combination of the methods shown in Figs. 12 and 13 can achieve both an increased memory utilizing efficiency and facilitated determination of addresses in programming and can attain the object to enable both bit data and word data to be readily handled. One embodiment of the present invention will be described hereinunder with reference to Figs. 1 to 6. In this embodiment, the methods of using the memory area which are respectively shown in Figs. 12 and 8 are combined together, and a memory area which corresponds to the number of bits constituting one word data (eight bits, in this embodiment) is ensured in advance for all the addresses. Accor-dingly, it is unnecessary to distinguish program addresses one from another, and when word processing is effected, there is no reduction in the number of remaining usable addresses. When word data is handled, all the bits are subjected to processing as shown in Fig. 2, whereas, when bit data is handled, one specific bit (generally either the least or highest significant bit) is processed. Word processing or bit processing is selected according to the designation made by the program. In the case of bit processing, one specific bit is fixed at the least or highest significant bit in advance. In consequence, after the whole of bit data has been fetched to a microcomputer inside the PCS, the contents of the bit data can be output simply by shifting a register once in either direction so that the least or highest significant bit is output. Thus, the output speed can be increased. Fig. 3 exemplarily shows word data and bit data which are mixedly stored. When word data and bit data are mixed together, for example, when one word data, five bit data items and one word data are consecutively stored from the address AAA0, in this embodiment the word data W1 is stored at the address AAA0, while the bit data items B2 to B6 are respectively stored at the addresses AAA1 to AAA5, and the word data W7 is stored at the address AAA6. Thus, in this embodiment, both bit data and word data are stored in the same manner, that is, one data is stored at one address irrespective of whether it is bit data or word data. Therefore, the numbers which are respectively put to data items stored at respective addresses can be consecutive numbers which are coincident with the ordinal numbers of the corresponding addresses regardless of the kind of data, that is, whether a particular data is word data or bit data. Accordingly, numbers which are respectively put to data items stored at respective addresses in preparation of a program are only required to be put according to the ordinal numbers of the corresponding addresses, so that it is possible to greatly reduce the time required to prepare a program. Further, since the area of a memory which is occupied by one bit data and that by one word data are equal to each other, it is possible to readily rewrite data stored at one address from bit data to word data and vice versa. In addition, even when bit data and word data are mixed together, there is no blank address, and therefore the memory utilizing efficiency is not lowered. Exchange of data between the storage means and an input/output circuit in accordance with this embodiment is shown in Fig. 4. In this embodiment, there are eight data buses, and therefore one word data can be handled with one address signal. As to bit data, since the seventh bit alone is used, one bit data can be handled with one address signal in a manner similar to that in the case of the method shown in Fig. 15. Accordingly, when bit data is handled, it is only necessary to examine a signal transmitted through a specific one of the eight data buses. It is therefore possible to read bit data simply by generating an address signal only once, so that data transmission can be effected speedily. The following is a description of the method of using the internal output in a program in accordance with this embodiment. Fig. 6 is a table showing internal output assignment in accordance with the present invention. In this embodiment, both bit data and word data can be handled in the same way, and therefore it is only necessary to put simply consecutive numbers to data items stored in the memory. Accordingly, it is possible to facilitate preparation of a program, and the time required for programming is reduced by a large margin. In addition, it is possible to obtain a number of word outputs which is equal to the number of bit outputs and to readily replace bit data and word data one with the other. Thus, it is possible to obtain a programmable controller which has excellent flexibility and which is considerably convenient.

Claims: A data storing method in a programmable controller processing both word data and bit data, and including an I/O circuit (2), selecting means, processing means and a storage means (1) divided into a plurality of memory areas of equal length, each area having a bit length corresponding to a number of bits constituting one data word of fixed length, and said areas respectively having specific addresses assigned thereto, characterized in comprising the steps of: defining a specific single bit data subarea at either one of highest significant bit or least signigicant bit in each of the areas, the specific single bit data subarea being at the same location in all of said areas; selecting word processing or bit processing according to a designation based on a program; processing said word data of the bit length of the area when word processing is selected, and storing a processed data word in all the bits of one of the areas when word processing at a random address of the assigned addresses; processing bit data when bit processing is selected, and storing a processed data bit of the length of a single bit in only the specific single data bit subarea of one of the areas when bit processing at a random address of the assigned addresses and leaving the other bits of the area as irrelevant bits. A programmable controller for processing both word data and bit data, comprising an I/O circuit (2), a storage means (1) connected with said I/O circuit (2) by a plurality of data buses (4) and divided into a plurality of memory areas having different addresses (AAAo...) assigned therto, each of said memory areas having a plurality of bits constituting one data word of fixed length, selecting means for selecting word processing or bit processing according to a designation based on a program, processing means for processing either word data or bit data according to the selection made by said selecting means, characterized in that each of said memory areas includes a specific single bit data subarea located at either one of highest significant bit or least significant bit in each of the areas, the specific single bit data subarea being at the same location in all of said memory areas, a processed data word is stored in all the bits of one of the areas when word processing is selected and stores a processed data bit of the length of a single bit in only the specific single data bit subarea of one of the memory areas leaving the other bits of the area as irrelevant bits, when bit processing at a random address of said assigned addresses is selected. A programmable controller according to claim 2, wherein each memory area is provided with an address so that one data bit or one data word can selectively be stored therein. A programmable controller according to claim 2, wherein said data buses (4) are provided in such a manner that the number of said data buses (4) corresponds to the number of bits constituting one word, so that bit data are transmitted between said storage means (2) and said I/O circuit through one of said data buses (4) which corresponds to a bit address at which said bit data are stored, whereas word data are transmitted through all the data buses (4).

Inventors: UEDA, AKIHISA
Applicants: HITACHI, LTD.
Application year: 1987
Main classification: G05B19
IPC codes: G05B19, G06F12