沈阳航空工业学院毕业设计论文
each is selected one by one on successive rising edges of the clock. The addressing assigning process is depicted in the following timing diagram.
Figure 2.2
2.1.2 CONTROL WORD
To implement this feature, it was necessary that the modules were able to ?tell? who they are. This was done by using unique 8-bit control words for each module. These control words are constant for a given type of module and built into the modules during their creation. The bit format of the control word is given below.
By reading this control word, the microcontroller is able to recognize the module and then assign an address to it. The control word for any module can be constructed using the following table.
Table 2.1: Configuration control word
2.1.3 ADDRESSING THE MODULES
Since the addressing of each module will be the same, this section has been separated, as it will be common to all the modules.
The addressing of the modules will begin once the configuration cycle has been completed and the user program has been downloaded to the main microcontroller. It will be this microcontroller, which will be responsible for addressing the modules and making them perform according to the user program. Moreover, the user need not be worried about the addresses of the modules because the addresses will be handled by the microcontroller; he will simply have to use the normal syntax, as in other PLCs.
6
沈阳航空工业学院毕业设计论文
Any module is addressed in one machine cycle using the microcontroller?s external memory mode. When the address is completely placed on the address bus, the 16-bit equality comparators of each of the modules compare this address with their assigned address. If it matches their address, a CSsignal goes low and access to the remaining module is permitted.
The timing waveform shown below shows a digital input module being decoded at 13Eh –13Fh address.
Figure 2.3
2.1.4 DIGITAL INPUT MODULE
As illustrated by the control words, a digital input module could have eight, sixteen or thirty-two inputs. The module that we simulated is a 16- input module. The input voltage standards are maintained from those of the industry i.e. 13-24 V represents logic high. The industry standards are converted to TTL levels by the use of optoisolators, which also isolate the following circuits from the high voltage side.
Accessing the Module
The address of the module is decided in the auto configuration stage after reading the control word and the user need not be worried about it.
Figure 2.4
The 16- input module is decoded at two addresses; one for the lower byte and the other for the higher byte. The CONVsignal, from the main microcontroller causes the two latches at the input stage to latch the present status of the inputs simultaneously. Now when we read from the lower address (i.e. A0=0), we are reading the lower eight inputs while reading from the next address (i.e. A0=1), we get the status of the higher eight inputs. So a digital module with 16 inputs is read in two cycles while a module with 32 inputs would require four cycles.
2.1.5 DIGITAL OUTPUT MODULE
Similar to the input module, a digital output module could have eight, sixteen or thirty-two outputs. The module that we simulated is a 16-output module. The output voltage standards are once again maintained from those of the industry i.e. 24 V represents logic high. The module is isolated from the plant by the use of opto- isolators at the outputs and the industry standard is obtained by the use of opto- isolators.
7
沈阳航空工业学院毕业设计论文
Accessing the Module
Once again, the 16-output module is decoded at two addresses; one for the lower byte and the other for the higher byte. However, here the sequence of events is the reverse of what it was for the input module.
Figure 2.5
After the decisions have been taken according to the user program, the logic states are transferred to the output module in two cycles. First the lower byte is written to the output latch by using the lower address and then the higher byte is written to the latch. Once this has been done, the CONVsignal appears and all the states are transferred to the output latches simultaneously. This cycle is repeated in every scan cycle monotonously.
2.1.6 ANALOG INPUT MODULE
The analog module that we simulated is an 8-channel 12-bit signed output module. The MAX120 ADC used for converting the analog voltages to digital provides 500 kilo samples per second and hence a conversion time of 2 μsec including tracking time. It has an internal–5.0 V reference.
The differential input voltage is limited to ± 5V by the use of a voltage divider at every input, as this is the limit of the ADC. The input voltages and their respective references are multiplexed using analog multiplexers. The differential inputs to be converted are selected by a sequential circuit (implemented in a PLD) and are applied to the two inputs of a unity gain differential amplifier. The differential output voltage is passed to the MAX120 for conversion.
Accessing the Module
When a user program is downloaded to the main microcontroller, in which analog inputs are being used, the microcontroller first figures out which inputs are to be converted and according to it, it creates a control word that would be sent to the analog module. This control word is written to address, which was assigned to the module. The sequential circuit interprets the control word, selects and converts the proper input and transfers it to latches from where it is read by the microcontroller.
Although we did manage to successfully simulate the module but constraint of time and facilities forced us to give up its implementation.
2.1.7 ANALOG OUTPUT MODULE
The analog output designed by us is also an 8-channel 12-bit signed module. The MX7547DAC used at the output provides a good conversion time of 2 μsec. The output of each channel is equipped with a track and hold buffer circuit to prevent loading of the DAC.
8
沈阳航空工业学院毕业设计论文
Accessing the Module
Just like a control word was required to access the analog input module, a similar control word generated by the microcontroller is required for accessing the output module. This control word will be used by a sequential circuit to determine which outputs are to receive the following data.
Once this control word is send at the beginning of the user program, on its turn, the address of the output module is sent out. Then the data for the various channels is sent one after the other. The channel to which the data goes is governed by the logic circuit implemented in the PLD. The logic circuit works as a controlled FIFO, as it transfers the incoming data to the outputs starting at the first and proceeding to the last. However, the data goes only to those channels, which were referred to in the control word. As the DAC is very fast, there are no
serious timing problems.
Although we did manage to successfully simulate the module but constraint of time and facilities forced us to give up its implementation.
3. CONCLUSION
In a nut shell, the whole exercise of designing the PLC and then implementing it was a thorough learning experience, although one with a heavy price tag. There is no denying that the project was too long to be taken as a final year project and our teachers should have prevented us from taking such a task but, alls well that ends well. There were many positives to come out of this whole exercise which may be enlisted as follows:
1. The enormity of the project taught us the art of dividing a big task into several small ones so that it becomes easier to meet targets.
2. The use of OrCAD? Pspice? and Layout for simulation and artwork design became
known to us.
3. Designing of complex state machines and cumbersome combinational logics in PLDs was also something new. 4. By designing the PLC according to the computer?s design, we gained a brief insight into how computers are designed.
5. The project the served the purpose of teaching how to work as a team.
6. Our skills of recognizing bugs and then troub leshooting them came to the fore when we worked on the circuits.
7. The development of this PLC would certainly open doors for work to begin in this area to make our country self- reliant in this respect.
These were some of the many benefits that we gained out this coursework. But the project itself does not end here. Just like the commercially available PLCs, this one too has many prospective improvements and enhancements which can be taken up by succeeding batches. For example, the analog modules can be manufactured by someone as it has already been designed, and the instruction set can be made even more powerful by working on it. Hence the setup of this project can easily come in handy to encourage work in this direction.
9
沈阳航空工业学院毕业设计论文
REFERENCES
Books Referred
??Siemens Statement List (STL) For S7-300 and S7-400 Programming Reference Manual
?Digital Fundamentals by Thomas L. Floyd ??Digital Design by Morris Mano
??Microprocessor and Interfacing by Douglas V. Hall
??Op-Amps and Linear Integrated Circuits by Ramakant A. Gayakwad ??Operational Amplifier Characteristics and Applications by Robert G. Irvine ??The 8051 Microcontroller by I. Scott McKenzie Web Sites Visited ??www.8052.com ??www.laticesemi.com ??www.atmel.com ??www.maxim.com
10