Data Logger Using the Sym-1 Microcomputer
Total Page:16
File Type:pdf, Size:1020Kb
/ DATA LOGGER USING THE SYM-1 MICROCOMPUTER by MICHAEL DEAN SCHWARZ B. S. r Kansas State University, 1978 A MASTER'S THESIS submitted in partial fulfillment of the requirements for the degree MASTER OF SCIENCE Department of Agricultural Engineering KANSAS STATE UNIVERSITY Manhattan, Kansas 1984 Approved by: ACKNOWLEDGEMENT D V.kg A11207 S38257 Solar Demonstration /5I1 Special thanks to USDA for funding the projects that made development of the data logger possible. Thanks to Pat Murphy, Dennis Matteson, John Anschutz and Vic Robbins who were also involved in the Solar Demonstration projects. Finally, for their guidance and support, I thank the members of the graduate committee, Dr. Mark Schrock, Prof. Ralph Lipper, Prof. Ralph Turnquist, and my major professor Dr. Stanley Clark. CONTENTS INTRODUCTION 1 LITERATURE REVIEW 2 SELECTION OF THE SYNERTEK SYM-1 MICROCOMPUTER 4 DESIGN OF THE MICROCOMPUTER DATA LOGGER 6 Development System 7 Version 1 8 Version 2 10 Version 3 12 CASSETTE TAPE READER 20 APPLICATION OF THE DATA LOGGER 24 Solar Livestock Demonstration 24 Solar Grain Drying Project 25 Ice Freezing 26 Engine Performance Logging 27 DISCUSSION 28 Programming 28 Data Acquisition Hardware 28 Cassette Tape Reader 30 RECOMMENDATIONS FOR FUTURE WORK 31 SUMMARY 33 CONCLUSIONS 35 REFERENCES 37 APPENDIX A. Data Logger Users Manual 38 APPENDIX B. Data Logger Hardware Diagrams 49 Specifications 50 Parts List 51 SYM-1 Modifications 53 A/D Board I/O connections 54 Schmatics 56 APPENDIX C. Data Logger Program Listings 60 Data Logger Source Listing 61 Data Logger Floating Point Routines 90 Cassette Tape Reader Source Listing 103 APPENDIX D. Apple II Reader Program 128 APPENDIX E. Component Data Sheets 130 SDM856 Data Acquisition System 131 3606 Programmable Gain Amplifier 150 MPC8S Multiplexor 158 MSM5832 Clock 165 HTAA-16W Power Supply 171 INTRODUCTION The design of the SYM-1 based data logger resulted from two USDA sponsored Solar Demonstration Projects. In these projects a total of 19 solar collectors were to be monitored to determine the energy collected during the heating season. As funds were limited, it was not possible to purchase a commercial data logger for each solar collector so an alternative had to be chosen. The decision was made to build and program a data logger for the pro- ject that could be located at each solar collector. In addition to the solar demonstration projects, several other uses of the data logger were made. These were for the ice freezing project (where the logger also served as the controller) and for engine testing. LITERATURE REVIEW In reviewing data loggers there are several types of data loggers available. They range from computer-based data loggers to commercial-dedicated data loggers to custom-built dedicated data loggers. One type of data logging equipment is the computer-based data acquisition system. This type of system is sold as either a full computer with data acquisition interfaces or as data acquisition interfaces that can be used on an existing computer. In this case the computer is a complete single-user system with computer, terminal and disk drives. A disk operating system is available along with a selection of languages for programming. With this type of equipment, data can be acquired and processed on site with full interaction. This is the most flexible type of data logging system but also the most expensive. Since this sys- tem is a complete computer it almost always requires 120 volt AC electrical power for operation. Usually a power outage will com- pletely stop operation and require an operator to restart the operation. Representive of commercial-dedicated data loggers are the Campbell Scientific CR5 and CR21. The CR21 is built primarily as a meteorological data logger but can be used for various other types of data logging. The logger provides a fixed number of analog channels usable for thermocouples and similar inputs and pulse counting channels for wind speed and direction sensing. The CR5 is a more general data logger providing expandable modules that can be added to meet the desired application. These systems can store data on either a printed paper tape or a cassette tape. In addition, a modem can be installed to allow remote interrogation of the data collected on the data logger over telephone lines. These data loggers operate on batteries so that it is not necessary that power is maintained for the logger. The final type of data logger is the custom-built data acquisition system based on a computer. In this type of system a general purpose computer is selected and appropriate data acquisition circuits are added to acquire the data. The computer selected can range from a single-board computer with very limited or no operator input/output capability (such as the Synertek SYM-1) to a computer with full keyboard and monitor (such as the Radio Shack TRS80) . The data acquisition hardware is usually inexpensive and custom built for a specific task. Depending on the application, the data loggers can be designed for either bat- tery operation or other electrical power as available. SELECTION OF THE SYNERTEK SYM-1 MICROCOMPUTER Several considerations were taken into account in the selec- tion of a microcomputer for the data acquisition system. The required features of the microcomputer were as follows: 1. Ease of interfacing the analog to digital (A/D) converter. 2. Handling of power outages during unattended operation. 3. Reliable method of saving data. 4. Being able to transfer data to the Agricultural Engineering computer. 5. Easily programmable for the data logging task. The first computer considered was the Radio Shack TRS-80 Model I with a cassette interface. In analyzing this system, it was found to satisfy requirements 3, 4, and 5 above. The cassette tape is a reliable storage method for data; interfacing to the Agricultural Engineering computer can be made through the RS232 interface; and Basic would provide an adequate programming environment. Requirement 1, interfacing to the A/D converter, is possible since the address and data lines are externally accessi- ble; however, two or three parallel ports would need to be inter- faced before the A/D could be connected and an additional power supply would be needed. Requirement 2, providing the ability to handle power outages, is not an easy problem to handle as the computer provides no EPROM sockets for auto-start operation. The only possible solution allowing for unattended operation is to provide battery backup. The second computer under consideration was the Synertek SYM-1 single board computer. This computer satisfied require- ments 1, 2, 3, and 4 easily. Six parallel ports are provided to allow interfacing of an A/D converter to the computer. Since a power supply must be added to operate the computer, the power supply selected would provide adequate power for both the com- puter and the A/D converter. Power outage handling is provided with EPROM sockets that can be configured to automatically res- tart data logging on power-up. A cassette interface provides data storage capability and the RS232 interface provides access to the Agricultural Engineering computer. The last requirement was the programmability of the computer. Since the Department has an Apple II computer which uses the same MOS Technology 6502 microprocessor, programming could be done on the Apple II and then transferred to the SYM-1 in EPROM for execution. Although programming in Assembly language is not as desirable as in Basic, this was not considered a major deterrent. A third computer that was briefly considered is the SD Sys- tems Single Board Computer which uses the Z-80 microcomputer. The evaluation of this computer is similar to the SYM-1 as the computer provides similar features. Although it was felt the Z- 80 is easier to program, this computer was not used due to the lack of a development system within the Department. DESIGN OF THE MICROCOMPUTER DATA LOGGER The development process for the data logger resulted in three distinct versions of the data logger being produced. These versions show a progression in capabilities from that of a simple data logger programmed for a specific task to a more general data logger that can handle a wide variety of data acquisition tasks. All versions of the data logger use the same microcomputer, the Synertek SYM-1. The primary features of the SYM-1 microcom- puter include a 6-digit LED display and hexadecimal keypad; three 6522 versatile interface adapters (VIA's) providing a total of six 8-bit parallel ports for interfacing the A/D converter; and a cassette tape port for reading and writing tapes used for data storage. The cassette interface also provides motor control automatic starting and stopping of the tape under software con- trol. The peripherals needed for the SYM-1 include a power supply and cassette tape recorder. The Power One HTAA-16W power supply provides 5 volts at 2 amperes and +/- 9 to 15 volts at 0.4 amperes each. The Radio Shack CTR-80 cassette tape recorder was chosen since it is designed for computer use and therefore pro- vided the necessary characteristics for data storage. All the components of the data logger are enclosed in an ABS plastic instrumentation case for protection. The differences in the three versions of the data logger involve the data acquisition hardware, real time clock hardware/software, and control software. All programming was done on an Apple II-Plus computer with dual disk drives and an EPROM programmer in Assembly language. This worked well as both the Apple II-Plus and the SYM-1 share the MOS Technology 6502 microprocessor. Initially the programs were transferred using the RS232 interface from the Apple II-Plus to the SYM-1 for test- ing, but as the program grew in size EPROHs were used for test- ing.