automated multiple vcr - iowa state...

54
Automated Multiple VCR Master Control Unit Final Report Project Team: May01-13 Submitted: April 16, 2001 Client: ISU Engineering Distance Education Paul Jewell Faculty Advisor: Dr. Edwin Jones Team Makeup: David Douglas (CprE) ____________________ Matthew Engelbart (EE) ____________________

Upload: vukien

Post on 14-Apr-2018

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Automated Multiple VCRMaster Control Unit

Final Report

Project Team: May01-13

Submitted: April 16, 2001

Client: ISU Engineering Distance EducationPaul Jewell

Faculty Advisor: Dr. Edwin Jones

Team Makeup:

David Douglas (CprE)____________________

Matthew Engelbart (EE)____________________

Hank Huang (EE)____________________

William Ogier (CprE)____________________

Page 2: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Executive Summary

The Engineering Distance Education program at Iowa State University in Howe Hall is dealing with the issue of multiple VCRs that cause problems when recording or duplicating many tapes simultaneously. The current recording facilities consist of thirty-seven different VCRs from three different manufacturers in two different rooms. It is necessary for the individual in charge of recording lectures to manually press the buttons on each VCR since using a single remote control will not work. This is highly inefficient and results in timing discrepancies between the different tapes in each VCR. A solution is necessary that allows the individual in charge of operating the VCRs to do so without timing discrepancies between the tapes. The solution designed will save time, increase the efficiency of VCR operators, and reduce the recording errors made during the copying of lectures each day.

The project was fueled by the requests of the Engineering Distance Education program and all decisions made were an attempt to meet those requests. Based on planning and designing throughout the first semester, the design team began working on the solution in January 2001. Although some ideas from the original design did not make the final design, many of them were kept in the design and are reflected in the final work. The overall idea of the solution was retained, but some of the details were changed when differences in theoretical design and actual design occurred during development.

This project consists of a hardware/software solution that will communicate with different banks of VCRs via infrared emitters. The software provides the graphical user interface (GUI) that the VCR operator will interact with. Through the GUI, the operator can make any selection of VCRs to control and do so as if the computer screen were a single remote control that can control all of the VCRs simultaneously. The GUI allows for the addition of new VCRs into the work environment because it has the ability to record new remote control protocols and assign them to the corresponding VCRs.

The hardware control unit consists of logic unit circuitry and a power supply. The circuitry is made up of two main sections: IR signal processing and VCR addressing. The signal processing portion of the hardware allows for remote control signals to be received as well as emitted through the proper IR probes. The control unit needs to receive signals when recording and storing the IR protocols of VCRs for each basic VCR function. It will then emit the stored signals appropriate for the function desired to the VCRs desired, all manipulated by software input. The addressing portion of the hardware is necessary to direct IR signals to the desired VCR. The circuitry is powered by a commercial power supply that is enclosed into a metal casing with the circuitry that is suitable for mounting in a standard VCR rack.

The software communicates to the hardware portion of the solution via the parallel port of the computer. Three types of communication take place over the port: incoming infrared waveforms, outgoing infrared waveforms, and VCR addressing. Incoming IR waveforms are sent from an infrared receiver located on the hardware and passed to the computer port for storage. Outgoing IR waveforms are the signals from the computer to the control unit that tell the VCR what function to perform. The VCR addressing points the corresponding outgoing IR waveform to the specific VCRs that need to be controlled.

1

Page 3: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

The project has been completed to the best of the ability of the design team in the given time frame. Initial hardware testing as well as initial configuration and programming of the software proved to be tedious. The solution has been put into use at the Distance Education program video recording lab in Howe Hall. The solution is self-sustaining and should require little maintenance to keep it running. The Distance Education staff can properly operate the hardware/software and will continue to do so in the future. Should the need arise, repairs should be possible with the help of the user documentation provided with the solution.

Acknowledgment

The ISU Engineering Distance Education department provided significant financial assistance. Joel Scott provided technical assistance for possible methods of developing a solution, as well as explaining the setup of the current system in use and the goals for the future system. Dr. Jones and Paul Jewel contributed a lot of time and advice throughout the project development.

Definition of Terms

VCR – Video cassette recorder – machine that records video signalsIR – Infrared – light spectrum through which VCR commands are transmittedLED – Light emitting diode – component which transmits IR signal to VCR C++ -- Common programming languageGUI – Graphical User Interface

Introduction

The Engineering Distance Education program at Iowa State University in Howe Hall is dealing with the issue of multiple VCRs with varying models that causes problems when recording or duplicating large numbers of tapes. These VCRs are located in different rooms making it difficult to synchronize duplication. In order to solve this problem, a hardware and software solution is proposed to control the existing VCRs, as well as allowing for expansion up to sixty-four VCRs. The goal of this project is to develop a user interface that will allow the control operator to control a VCR or a bank of VCRs with a click of a mouse button. The user interface will operate on a Windows based operating system in the control room. The control box will be nearby and will route the signals and commands to the designated VCR, whether it be in the same or different room. The control box will be fit into a metal casing that will be the equivalent in size to a regular VCR so that it can slide into the rack with the other VCRs. Cable will run from ports on the control box to each of the VCRs where an IR emitter will be attached firmly to the front panel of the protocol sensor. This solution should allow the operator to accomplish his/her task in a timely fashion.

Technical problem:

The Engineering Distance Education Learning facility deals with a large quantity of tapes that need to be recorded and sent out daily. Manually controlling each of these VCRs becomes a problem when synchronizing multiple tapes as well as the inconvenience factor of dealing with multiple makes and models. This system will have the capability to select or deselect which

2

Page 4: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

VCRs are needed at any point in time from one main control unit. The control unit will interact through the parallel port of the PC using software written in Borland C++ version 5.0 by recording IR protocols from the VCR remotes and replaying the appropriate learned signals to the specific VCRs. The control unit will consist of various off-the-shelf components including a power supply, diodes, resistors, capacitors, as well as various IC chips. The 5 V, 1.5 A power supply will be mounted inside the metal casing to allow for easy transport and handling. To resolve possible heating issues within the casing, a fan will also be inserted and will run off the 5 V power supply. The casing will be sized so that it will be able to be inserted into the rack-mounted shelves where the VCRs are located. Infrared LEDs from the control unit will pass signals to the VCRs without interference by being affixed to the IR probe of each VCR near the protocol sensor using Velcro. The IR LEDs will all run to the back of the control unit where each will be fixed to an individualized port.

Operating Environment:

The Engineering Distance Education Learning facility is located in Howe Hall, so there should be no problems with “extreme” conditions. The control unit will be placed within the rack-mounted shelves along with the other VCRs and the PC running the user interface will be in the same room. The room will be kept at an average of 70˚F, which will allow all the equipment and machinery in the operating room to work collectively without any overheating issues. There should be no humidity issues as well.

Intended User and Uses:

The Engineering Distance Education program will be the initial user, which may be expanded into other departments across campus following implementation of a successful solution. This will allow the individual in charge of taping sessions to record or duplicate lectures without timing conflicts. This will include initiating the recording and stopping of any number of various VCR models at any particular time.

Assumptions: All VCRs must be in proper working condition Standard VCR commands will be implemented: stop, play, record, fast forward, rewind,

and pause The user is computer literate and can operate software and hardware with minimal effort The Engineering Distance Learning program will have adequate funds to acquire

necessary items to implement the project VCR commands will be learned properly by the software Remote control commands will not need be pressed continuously

Limitations: The system will be expandable only to sixty-four VCRs per control box The control unit will not be able to receive any feedback from the VCRs that it will

control, forcing the user to insure the VCR is properly prepared to function as desired Access to the distance learning facilities Knowledge of Visual C++ is limited amongst group members

3

Page 5: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

The group has minimal knowledge of VCR remote control protocols

Design Requirements

Design Objectives:User interface – A software interface produced remote control, which allows the basic six VCR commands and recording of IR protocols from the actual VCR remotes. It will operate on an existing PC system located within 1364 Howe Hall. The user interface will be created using Visual Basic, and the parallel port interface with Borland C++.

VCR control unit – A device that will route signals to all of the appropriate IR emitters after receiving commands from the user interface through the parallel port of the PC. It will also be able to send signals from VCR remotes to the PC via the parallel port to record the commands of new VCRs added to the system.

Functional requirements: Be able to learn commands when new VCRs are purchased The ability to group different VCRs into VCR banks Expandable for new VCRs Perform the six basic VCR functions Control anywhere from one to sixty-four VCRs at once Control VCRs in different rooms Easy to use system for an individual with minimal technical knowledge Robust design to eliminate or minimize the need for maintenance

Design Constraints: Signal loss due to length of wire between control box and LEDs Control unit to fit into the approximate dimensions of a standard VCR Control box will have its own power supply Communication with the PC is based around the parallel port capabilities

Measurable Milestones: Operating a VCR straight from remote control through the signal recorder to the IR

LED. This milestone is met when a VCR can be controlled via a remote control signal passed into the control unit infrared receiver, through the signal processing portion of the control unit, and then emitted to a single VCR.

Talking between the computer and control box to establish a reliable connection measured by the ability to control a single IR emitter. This milestone is met when the software can manipulate the IR emitter on the control unit. This confirms proper parallel port communications.

Controlling a single VCR via the control unit to perform the basic six functions. This milestone is met when the computer stores all six functions of a single VCR, and these functions can be sent to the VCR through the signal processing circuit.

Maintaining adequate power levels to multiple IR LEDs to allow the signal to be picked up by the IR sensor at the VCR. This milestone is measured by the ability to send a signal to all VCR LEDs and have the VCRs respond to the command.

4

Page 6: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Controlling multiple VCRs at once so that all machines can be operated at once. This milestone is met when all VCRs work properly based on the commands entered at the software interface.

Successful testing of the final product. This milestone is met when the software and control unit are in place at Howe Hall and ready to use for real-life production purposes.

End-Product Description

The solution is a software package with an accompanying hardware unit of off-the-shelf components that will allow a user to control multiple VCRs at once by controlling them from one centralized location, a desktop computer. The software allows the user to control any different number of VCRs at any one time, utilizing such commands as play, record, stop, fast forward, rewind, and pause. The hardware unit allows the software to record IR protocols of new makes and models of different VCRs. This product is a powerful tool for commanding multiple VCRs at the same time with the comfort of sitting behind a PC. It is easy-to-use, setting it up only requires it to learn the VCR commands by pointing and clicking the VCR remote at the control unit

Approach and Design

Technical Approaches:

The team initially identified two separate components to this project. A device of custom design and construction would be need to created to send the signals out to the various VCR’s and to capture the remote signals. The second component would be a software program running on a computer at which the operator could control the entire VCR array. These two components led to a third issue, the communication between the two devices. The approaches to these three parts of the project are discussed below, and the accompanying selection criterion follows.

A. Communication Approach

The team was faced with the decision of how to communicate with the hardware device. The two primary options dealt with were the use of the parallel port and the use of the serial port. The serial port was originally viewed as the best approach since it is the original standard for communicating with external devices. The problem with the serial port was that it is a serial communication. Only one bit at a time can be sent across the serial port. This would mean that the team would have to send the addressing information, store that information, and then use that information as the signal came across the line. These limitations would require the team to include a microcontroller in the hardware device. The addition of a microcontroller would add a great deal of complexity to the project by requiring the team to write software for two different computers. It would also have added to the cost.

In comparison to the serial port, the parallel port has multiple lines that can be used for communication. This would allow the use of several pins on the port to send the addressing information, another pin to send out the IR signal, and yet another pin to capture the input signal.

5

Page 7: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Since it would be possible to send multiple signals, the hardware would be simplified considerably and this would reduce the effort and cost of implementing the project. Thus the decision was made to communicate between the computer and the hardware device with the parallel port.

B. Hardware Technical Approach

Choosing what the control unit would be built out of was not a difficult choice, even though there were many options. The options for the control unit consisted of a control unit based around logic devices, a control unit based around a microprocessor, a commercial infrared control system, or a combination of the microprocessor and logic devices.

Initially, the team figured that since a serial port would be used for the communication, that a microprocessor driven control unit should be designed. A microprocessor alone would not be able to do the desired functions, so an addition of logic devices would be needed as well. Eventually the microprocessor idea was dismissed as a viable alternative because of its high cost and need to learn a programming interface to interact with the microprocessor. The commercial infrared control system that was investigated proved to be out-of-date and too costly, and would not be modifiable to accommodate for the sixty-four VCR goal of the project.

The team decided to design a control unit based solely on logic devices such as diodes, NAND gates, and decoders. These devices are fairly standardized and would not be hard to acquire. This also is a less costly alternative than any of the other discussed options. This option would allow the team to use the most creativity in control unit design and cater the end product to the design requirements as well as possible.

C. Software Technical Approach

The team investigated using C++, Microsoft Visual Basic, and Microsoft Visual C++. During the design phase the decision was made to code the program in Microsoft Visual C++. This decision was made because of the belief that it would the most appropriate platform for accessing the parallel port registers to manipulate the hardware. C++ was not the idea choice, despite the team’s familiarity with the language, because it is beyond the team’s skills to bring C++ to the level in which it is a fully functional Windows GUI program. Microsoft Visual Basic was discarded because it lacks the ability to interact with the parallel port. Thus the decision to code the program in Microsoft Visual C++ was made. This decision proved to be a poor one because no one on the team had the knowledge of Microsoft Visual C++ to survive the learning curve needed to create the type of interface desired.

When it was decided that Microsoft Visual C++ was not going to be a viable solution, the team returned to the drawing board and examined the weaknesses of the team’s other choices. Microsoft Visual Basic would be idea for the user interface since it was designed to make the creation of full-blown Windows programs with ease, but it would not work due to its inability to interact with the parallel port. C++ would be idea for interacting with the parallel port, but would prove difficult to make the user interface as desired. Thus it was chosen to combine these two approaches and use a combination of Visual Basic and C++.

6

Page 8: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Selection Criteria for Approaches:1) Fulfillment of functional requirements2) Difficulty of implementation3) Speed of the system in operation4) Difficulty of operation by the user5) Expandability of adding new VCRs6) Cost of the system and development7) Simplicity in the design8) Conventional parts and design9) Minimization of the amount of components

10) Creativity in the design

Technical Design:

Metal Casing - for the control unit, about the same size as a regular VCR and mountable in a standard 19” rack

LED wire – to go from the control unit to the IR emitters, will send the signal clearly and strongly enough so that the VCR understands the command, durable enough to withstand being run between rooms, above drop-ceilings, and through wiring closets

Communication wire – wire to go from the PC to control unit, able to send output to the box (VCR commands) and receive input (new VCR commands)

Learning device – able to send IR signals from new remote controls to the PC to be recorded

Control unit – able to take input from the communication wire, output the correct signals to the appropriate LED wires, receive new VCR IR protocols and send them back to the computer, operate on its own power supply

The technical design can be seen in three aspects, communication, software, and hardware. The following will be a description of how each will implemented and combined to form the resulting product.

Communication Design:

The parallel port has three registers. These registers, the control register, the data register, and the status register. This project requires a total of eight pins. A pin is required to send the signal out, a pin is required to take a sampled signal in, and six pins are required to address 64 VCRs. This leaves seven output pins, used as the data register. The data register has eight bits that can be used for bi-directional communication; the first seven are used, D0 through D6. D0 is used for the signal for the VCR, D1-D6 are used for the addressing. For the input pin the status register’s sixth bit is used, which is ACK for the printer. The data register bits map out to pins P2 – P9 on the twenty-five pin parallel port and ACK maps out to P10. For the purposes of data communication, since the parallel port is design to communicate with a printer, pins P18 - P25 need to be grounded. On most computers the data register is located at hardware address hex 378 and the status register is located at hardware address hex 379.

7

Page 9: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Hardware Design:

A typical remote control for a television set or a VCR operates by sending rapid pulses of infrared light beam. Most of the signals from a typical remote control emit carrier signals around 40 kHz. These flashes are seen as zeros and ones, similar to binary code, where each sequence represents a particular protocol. The base signal is modulated because interference from ambient light may cause interference. It is modulated at high frequencies, usually around 30 kHz to 50 kHz, to reduce this interference. The resulting waveform is called the carrier signal. The success of the control unit would be evident if it could interpret these IR signals.

The serial data are transferred from the carrier signal and are typically encoded in one of the three most common coding schemes: pulse-width coded, space coded, and shift coded.

a) Pulse-width-coded signals vary the length of pulses to code the information. In this encoding scheme short pulses correspond to logic lows and long pulses correspond to logic highs. The lengths of these pulses are typically around 550 µs and 2200 µs.

Figure 3: Pulse-coded signal

b) Space-width coded signals are the same as pulse-coded signals except that the length of the lows are used to encode the highs and lows.

Figure 4: Space-coded signal

c) Shift-coded signals vary the spacing of the highs. This is exactly like pulse coded signals except that signal-length corresponding to logic highs are exactly twice as long as those corresponding to logic lows [1].

Figure 5: Shift-coded signal

Initially, there were concerns about learning exactly how remote controls operated and how IR data was transmitted. Each protocol had its own distinctive characteristics and that would have meant deciphering each of the makes and models of VCRs and their protocols. This approach

8

Page 10: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

was later dismissed due to the fact that the final solution that was chosen would do this operation. The foundation of the solution was taken from an Australian magazine article, which was taken and modified to allow for controlling multiple VCRs. A portion of the text is shown below [2].

“The circuit consists of two parts. The first part is the IR receiver made up of an OP-505 IR photo transistor. This signal is buffered and squared up by the Schmitt trigger inverters (74HC14). The output of this inverter goes directly to the Acknowledge line (pin 10) of the parallel port. The software polls this line in the recording mode and stores the incoming data sequence.

The transmitter consists of a clock generator (555) set to run at 80Khz followed by a 74LS74 D flip-flop. The flip-flop divides the clock signal by 2 giving a precise 50-50 duty cycle on a 40Khz signal. This is then used as a carrier for the transmitter section of the circuit. In playback mode the software turns the D0 line of the parallel port on and off at the same rate that it recorded the signal at. This is used as a gate signal for the 40Khz carrier. The gate action is achieved by controlling the Clear input of the D flip-flop. If the clear line is low, then the Q output is also held low.

This gated signal is then used to drive the IR LED via the driver section. The IR LED driver section consists of a 7405 hex open-collector buffer. All the outputs of the 7405 are tied together to give enough current to drive the IR LED. The two 1N4001 diodes are used to step down the voltage to around 3V for the IR LED. This may seem as an overkill but you can drive several IR LED's simultaneously.

The 555 frequency can be adjusted for remote controls whose carrier frequency varies from the standard 40 kHz.”

This was the basis for controlling one VCR and was used for the majority of testing purposes. Since multiple VCRs needed to be controlled, the signal had to be sent through a decoder where addressing could take place and specify where the signal would be sent. Four 4x16 decoder chips were needed to accommodate the sixty-four units mentioned earlier. To direct the signal to the appropriate 4x16 decoder, a 2x4 decoder IC chip was used to direct the signal to the appropriate cluster of sixteen VCRs. The actual addressing was achieved by taking six inputs from the parallel port of the computer, two of which served as the inputs to the 2x4 decoder to enable the correct group of sixteen VCRs, and the other four inputs served as the inputs to the 4x16 decoders to select the correct VCR out of the group of sixteen. The computer was connected to the control unit via the parallel cable that connected to the rear of the control unit. Originally, NAND gates were purchased in hopes of uniting both the protocol signal and the address of the VCR. After much analysis, this approach was dismissed due to the fact that some of the IC chips already had inverters on the output. After testing various approaches, the NAND chips were used more effectively as inverters to achieve the desired output. These IC chips were tested for correct addressing so that both the signal and address combined to operate the designated VCR. The circuit layout was printed on a circuit board to provide convenience, improve durability, and increase professionalism, and then secured within the metal casing. The wiring for each of the IR emitters was attached to one of the sixty-four jacks on the back of the control unit. The wires lead to the VCRs where the IR emitters were secured with Velcro to the front of the protocol sensor. The jacks consisted of two screws for each polarity that allowed for the wires to be removed in case of maintenance or replacement.

9

Page 11: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Figure 6: Circuit diagram – Signal processing

10

Page 12: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Figure 7: Circuit diagram – Addressing unit

Software Design:

The software is broken into two main parts, the driver for the parallel port and the graphical interface for the user. The drivers for the parallel port were written in Borland C++ 5.0. These drivers make the assumption that the data register and the status register are located at their standard address of 378 and 379. A full listing of the code for the drivers is located in Appendix X.1

The signal-sampling driver, Record.exe, requires a filename for the file that it will write to the drive containing the sampled signal. It then samples the ACK bit for a one. When the ACK bit goes to one the program then stores the ACK bit in an array, delays for an amount of time, and then stores another. This continues until the array of 15000 bits is filled. The program then uses the filename that it was given to store the 15000 bits into a data file with the given name.

The signal output driver, Play.exe, requires a filename for the file that it is to output to the parallel port and at least one number. The number is the location of the VCR on the hardware device. Multiple numbers can be given to the program. The program opens up the file at the filename it was given and stores that file’s contents into 15000-member data array. The program

11

Page 13: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

then takes the first number that it was given and shifts its binary representation one bit higher and adds each data member to it. This result is sent to the data register until the entire 15000 bits are outputted. If the program has additional VCR numbers, it repeats the output process with them until all VCR numbers have been used.

The user interface is composed of two data structures, the clsVCR array which is an array with sixty-four members of the VCRstatus type. The VCRstatus type has two members: the name string, which holds the name of item e.g. VCR 13 and the number, which represents which type of VCR it is. The VCR type is of use in the second data structure, which is the VCRinfo type. The VCRinfo type also has two members: the name string, which holds the name of the model e.g. Panasonic M3432234 and the codes array. The codes array is an array of five boolean values that indicate which operations exist the given model of VCR. These two data structures are saved in files on the hard drive: binVCR.bin and binSetup.bin, respectively.

The graphical portion of the user interface is composed of two different windows. The first, the VCR control window, as shown in Figure X, is broken up into four main areas.

Figure X: VCR control window

The VCR controls area has six buttons for starting the basic functions of the VCR. When one of these buttons is pressed the program then examines which of the sixty-four VCR are checked as active. For the active VCRs the program examines the clsVCR array to find out which VCR model they are associated to, and then if the operation that was

12

Page 14: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

selected has been programmed, Play.exe is called for the appropriate file. The status window located next to the VCR check box is then colored with the appropriate color. The seventh button is used to clear the status icons that are no longer deemed necessary by the user. These buttons are represented by an indexed subroutine btnCommand_Click.

The VCR status area shows all fifty VCRs. Next to each VCR is a check box to select it and a status window that displays its last status. This status window reflects the last command that was issued to that VCR. These check boxes represent which VCRs are currently selected, both to the user and to the program.

The VCR setup area has two buttons. The Set VCR Bank button allows the user to create up to six presets for the VCR check boxes. When the button is pressed it waits for the user to press the button of one of the VCR banks in the VCR bank area of the window. A dialog box will ask the user to select the VCR to be stored in that preset button and instruct them to press the Set VCR Bank button when finished selecting VCRs. After the user presses the Set VCR Bank they will be asked to confirm their selection, and then the VCRs selected will be written to the binPreset.bin file on the hard drive.The second button is the Set Up Selected VCR button. This button will call the VCR setup window for those VCR. The VCR setup window is discussed below. While the VCR setup window is being used the VCR control window is waiting for the global variable gStop to be changed to false by the VCR setup window.

The VCR bank area holds the six VCR Bank buttons for storing pre-selected VCR configurations.

The second window of the graphical interface is the VCR setup window as shown in Figure X. This is the window where the user sets the VCR model that is associated with the various VCRs. This window is also where the user can create a new VCR model. The window has four areas.

13

Page 15: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Figure X: VCR Setup Window

The VCR list box is a list of all of the VCR models that have been setup. This list is filled from the binSetup.bin file when the VCR setup window.

The new VCR text box is used to type in a name for a new VCR model. The text of this box will be what goes in the binSetup.bin file and the VCR list box when the new model is added.

The Create New VCR button takes the text from the new VCR text box and writes it to the binSetup.bin file, then takes the user through the process of storing the six VCR codes with the Record.exe driver. For each code the user must press the appropriate remote button on the remote control for the model of VCR. After the button is sampled, then control then outputs the command to verify that the command was recorded properly.

The Set Selected VCR button closes the VCR setup window and sets the global variable gVCRnumber for the index of the select VCR model.

The user interface is broken into several different files. These files and their functions are shown in Table X. A full listing of each of these files are available in Appendix X.

Table X.1: Software files

VCRmaster.frm

Contains all of the visual elements of the VCR control window and the functions required to operate those elements.Located in Appendix X.2

VCRsetup.frm Contains all of the visual elements of the VCR setup window and the functions required to operate those elements.Located in Appendix X.3

Const.bas Contains all of the constants used in the program, used to hold the two types and the various constant that set the size of various elements of the program.Located in Appendix X.4

File.bas Contains all of the function to control the files used to save all of the program information to the hard drive.Located in Appendix X.5

Global.bas Contains the declaration of all of the global variables used in the program.Located in Appendix X.6

Main.bas Contains the starting function of the program.Located in Appendix X.7

VCR.bas Contains all of the files to manipulate work with the VCR drivers.Located in Appendix X.8

Testing Description:

14

Page 16: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Testing the solution will begin by testing the individual modules separately to determine their capability and functionality. The next step is to piece modules together to perform specific functions filling a project milestone. The next step will require putting all of the modules together to work out compatibility issues and testing the system as a whole. The success of an event will be especially easy to determine given whether the VCR responds appropriately to the signal. Project team members will perform testing with a description of the test being preformed and the results recorded on test forms. This can be seen in Appendix B. If possible, outside testing by personnel in the Engineering Distance Education program will be conducted to determine how easy the system is to use and whether it accomplishes the desired functions. Outside testing will be done with a team member present to answer any questions, speed up the testing procedure, and to record the testing being performed. This is an essential step.

Risks and Risk Management:

One of the serious risks would be in the case of a component not being as accessible as previously thought. This might include an essential part that may have been discontinued from a maker that was considered for purchase. Care must be exercised to avoid damage to any components or to any team members. Another dangerous risk would be the chance of a team member assuming an internship over the spring semester, or being gone unexpectedly for a job interview, funeral, or etc. Breaking the work into pairs has reduced this risk. Another important consideration is if the system does not work together for any number of reasons. Commercial systems already exist that are capable of performing the functions desired, but they are very expensive. In the event that the solution does not work, the commercial system may be purchased.

Recommendation for Follow-on Work:

After performing research over the Internet about the project, it appeared that it should be easy enough to implement, inexpensive, and would not require more time than a semester to build it. The design will use conventional off-the-shelf components, making them easy to find and reducing the time to obtain them. Testing and implementation will be performed in Howe Hall allowing for easy access to the existing VCR network. The solution would save a lot of time and money to the Engineering Distance Education program by not having to run between rooms and reducing the amount of taping malfunctions. The error rate, defined as failure to start machines on time, will be reduced. Overall, the project appears to be possible, practical, and economical. Therefore, it is recommended to complete the project as designed.

Financial Budget

The original cost estimates were comparable to the revised cost estimates, as can be seen in Table 1. The exception with the project poster was a result of the poster being reprinted after it was damaged while trying to mount it to the poster board. The actual final cost represents the amount of money spent to complete the project. It ended up costing more than estimated, but with the support of the Engineering Distance Education department the purchases were possible.

Table 1: Financial budget

15

Page 17: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Item Original Estimated Cost

Revised Estimated Cost

Actual Final Cost

* Parts $120 $100 $xxx

Metal Casing $30 $30 $xxx

Shipping & Handling $30 $30 $xxx

Poster $50 $100 $xxx

Total $230 $260 $xxx

* Extended parts listing can be found in Appendix C

Personnel Effort Budget

The original effort estimates were not comparable to the revised effort estimates, as can be seen in Table 2. The main reason for the differences was the initial impression that equal time would be spent on the project by each member, which is not realistic given the different commitments each team member has, including class load, work, etc. The actual final effort was comparable to the revised estimated effort. The large amount of hours is due to meeting on a very regular basis throughout the spring semester.

Table 2: Personnel effort budget

Personnel Original Estimated Effort

Revised Estimated Effort Actual Final Effort

Hank Huang 100 hours 190 179Matt Engelbart 100 hours 185 181Dave Douglas 100 hours 170 174Bill Ogier 100 hours 155 171

Total Estimated Effort 400 hours 700 705

Project Schedule

The project schedule for 1st semester, including both the original and actual schedules, can be seen as a Gantt chart in Figure 7. The differences between the original and actual schedules were due to the inability to foresee project complications, coursework from other courses, team members being absent for interviews, and so on. However, all and deliverables were completed on time 1st semester.

16

Page 18: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

The estimated schedule for 2nd semester work is more reasonable due to attempting to forecast problems that would occur as a result of lack of time. Figure 8 shows the Gantt chart for 2nd

semester work on the design. This chart takes into account the various activities going on during the semester that do not relate directly to senior design such as spring break, VEISHEA, finals week, etc. Even though an attempt was made at forecasting when it would be difficult to work on the project, it is seen that the project was not usually a step ahead. Once again though, all deliverables were completed on time.

Figure 7: Gantt chart for 1st semester

17

Page 19: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Figure 8: Gantt chart for 2nd semester

Evaluation of Project Success

The primary metric of success for this project was to control all of the VCRs in Engineering Distance Education facility from one location with an easy-to-use software program. Based on this, the project was a success. The VCR remote control system meets this objective. It is capable of controlling up to sixty-four VCRs that are wired into the hardware device. The software provides a listing of 64 check boxes that can be selected or deselected and a simple push button to control them. All milestones were met, as each one was a necessary prerequisite for the next milestone. The final milestone, successful testing and implementation of the final project, is currently being completed and will be finished at the end of the semester.

Commercialization

The object for the project was to create this project for the Engineering Distance Education facility, but anyone with a similar facility could benefit from this device. Marketing the device could be done is several different ways. The first way would be to custom create and set up the unit for similar facilities. This would be much like hand making multiple copies of the current device. Another method to commercialize the device would be to take it into production and sell the components separately. This would require reworking the design so that it could be machine produced, rework the IR emitters so that they could be sold separately from the unit, and rework the software so that the number of VCRs could be determined dynamically by the user. The final marketing method would be to abandon the VCR only approach. This unit would work for any device that is controlled by remote. The device could be marketed as a computer universal remote for a household. Marketing the device as such would require refining the design to the point of a consumer electronic device. The unit would have to be one seal device and the IR

18

Page 20: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

emitters would have to plug into the device instead of being screwed in. The software would also have to be almost completely modified. The software would have to be far more flexible and easier to use and set up.

The cost to setup other facilities similar to the setup of the Engineering Distance Education facility would be less than the cost of the parts. For a design process it was required to buy more parts than necessary to refine the design. The cost to sell the device as a standalone item would require some more research and development, but eventually the cost to produce should be lower because they could be machine produced in quantities. The cost to produce a home universal computer remote would be similar to the cost to prepare the standalone device, but would be produced in much larger quantities, thus driving the price of production lower.

This device could sell at a fairly high price. Some devices that perform similar to this project are as expensive as $1000. Those devices could be undersold at $500 - $800 dollars and still make a good deal of money. The household device would have to be low in cost since the household market will not pay $500 for such a device. If it was possible to create such a device that could sell for under $100 then the device might have a chance.

Recommendations for Additional Work

There are several recommendations that could be made for additional work. On the software side the software made more adaptable. It could also work with a scheduling program. The hardware could be modified to connect to another hardware device. It could also be designed to communicate over the network.

The software could be enhanced to offer the user the ability to specify the exact dimensions of the VCR array. The current software shows sixty-four VCRs even if only two devices are setup. Additional work would yield a software scenario in which their would only be the existing devices shown in the control window, or the user could move the check boxes around so that they visually matched the configuration of the room. This would be another step towards making the software very easy for anyone to use.

The second software enhancement would involve the writing of a scheduling program that could interact with various calendar programs such as Microsoft Outlook, and set the VCRs to start and stop recording at various times depending on the class schedule. This would reduce the work of the Engineering Distance Education facility to loading the proper tapes at the right time.

The hardware could be adapted to work with other device. The Engineering Distance Education facility currently uses two rooms to hold their VCRs. This solution has them running an individual wire to each VCR in the room. It would be easier if only several wires could be run to another unit that would then split and spread the signal to the other VCRs.

The final recommendation is to modify the hardware device so that it connected through the network instead of the parallel port. The software would then be a Java application that ran on a separate computer and could be accessed through the network via a web page. This would

19

Page 21: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

enable the user to bring up the VCR control software at whatever computer they happened to be on, instead of having to go to a separate computer set aside for those purposes.

Any of these enhancements would make the project more valuable to the Engineering Distance Education facility and enhance its usefulness.

Lessons Learned

During the two semesters spent working on this project the team has learned many lessons. The team had many things that went well. Everyone in the team made a good contribution to the project on a weekly basis. All of the group members are busy people and despite the constant scheduling problems the team was able to meet routinely to organize the project. Whenever members of the group were unavailable to other commitments the group still was able to get together and work on the project without the missing member. No member of the group was ever missing for long periods of time, or not interested in the status and progress of the project.

The team was also able to find a great deal of meaningful data from other sources, especially the Internet and university staff. Many variations of this project have been done in the past and the team was able to use ideas from these other projects to help out the design. Whenever problems occurred, Iowa State professors and other technical staff were always willing to help troubleshoot various problems.

The project also ran into several difficulties. Everyone in the group had many other activities going on during the semester. Busy lives meant that the project came to a near stop several times when there were no direct deliverables due in the near future. When various milestones were completed, it was through a burst of activity and time to accommodate a deadline, and the team usually took about a week off from the class after these bursts of activity.

Major problems also occurred along the design route. The first occurred when the initial hardware schematic did not work as planned. The team spent nearly two weeks off track while trying to find a solution, in the end a donation of a different part and were able begin work very quickly after the new part was ordered. The software also ran into difficulties as when it was realized that the time needed to learn enough Visual C++ to accomplish the project made the language a poor choice. The first three weeks of the second semester were wasted researching that language.

During the course of the project the team discovered that is very important to know, from a technical standpoint, the parts the project is designed around. All phototransistors are not the exact same thing, some logic gate return an inverted output, expensive parts might have a cheaper equivalent that can be easily created from several parts. The group learned how to closely read specification sheets and match what those sheets say to what the design requires, and how to rework a design when the specification proved to be different than what was initially thought.

From the software standpoint the group learned a considerable amount about programming with Microsoft Visual Basic and what the languages strengths, and weaknesses are. The team also

20

Page 22: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

learned the value of using good coding techniques to make the code easier for someone other than the author to work on, especially in an environment where several individuals are doing the code development.

The team learned a great deal about accomplishing a task in groups. By separating the tasks into individual or pair activities a great deal could be accomplished faster, but those separations can be difficult to make and all group activities overlap to some degree. The value of time management and good planning was illustrated both when the team tried to work without them, and when the work progressed well with them.

Project Team Information

Table 3: Project team information

Name Address Tele # Fax # E-mail EE/CpEBill Ogier 315 Welch Ave 292-6294 N/A billo CpEDavid Douglas 258 Hyland #9 268-0615 N/A doudav CpEHank Huang 300 Stanton Av #401 292-4519 N/A hhuang EEMatt Engelbart 4625 Steinbeck #16 292-6653 N/A chewdawg EEEd Jones 2210 Coover Hall 294-4962 294-3637 n2ecj EEPaul Jewell 1364 Howe Hall 294-1827 294-6184 pjewell N/A

Summary

With the implementation of the solution, the Engineering Distance Education program will save time and minimize problems in recording multiple copies of lectures each day. It will be much more efficient than the current method of running between rooms and controlling each individual machine. The solution will also run regardless of the model type, which will help in future expansion. The user may choose any combination of VCRs, whether selecting one or the entire bank. To decrease the level of complexity with this project, individual roles were assigned to each group member. In doing this, it was possible to build upon each milestone. The final product/solution is straightforward and simple to use for anyone in charge of these recording sessions. If the situation arises where a control box needs to be repaired or replaced, the documentation is precise enough to accomplish this with minimal difficulty.

21

Page 23: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

References

[1] Final Project: A Remote Control Study. Ed. Bret Connell. Nov. 1995. Washington U. 17 Oct. 2000 <http://www.ee.washington.edu/conselec/A95/projects/pierreg/works/works.htm>

[2] “Universal IR Controller for a PC” Electronics Australia pp.43 September 1998. October 25 <http://www.geocities.com/SiliconValley/Lakes/7156/ir.htm>

Decoding IR Remote Controls.<http://www.ee.washington.edu/circuit_archive/circuits/F_ASCII_Schem_IR.html>

Electronics Components. http://www.digi-key.com

Infrared Emitter Circuit. <http://www.engr.uky.edu/student.orgs/IEEE/SouthEastCON_99/hardware/schematics/gadgets/infrared/ir_em-rec.html>

Infrared remote control decoder. <http://www-s2.semiconductors.philips.com/pip/SAA3049A>

Infrared remote control technology. <http://www.us-epanorama.net/irremote.html>

Messmer, H. The Indispensable PC Hardware Book. London, 3rd Ed. 1997. Addison-Wesley.

Micro-based PIR to IR remote converter. <http://home.iprimus.com.au/eddiema/projects/Pir-remote/pir-remote.htm>

PCIR Infrared© Control System. <http://www.3rdi.com/index.htm>

Schematics of IR receive and transmit. <http://www.ziplabel.com/cir/schem.html>

Q129796 – HOWTO: 32-Bit App Can Determine When a Shelled Process Ends. <http://support.microsoft.com/support/kb/articles/Q129/7/96.asp>

22

Page 24: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Appendix B: Testing Form

VCR Team Test FormDate: ___________________

Performed by: _________________________ Time: __________________

Component/Module/Function Tested: _________________________________________

Tests Performed:

Results:

Comments/Notes:

Team Member Signature: ____________________________________ Date: _________

23

(circle one)

Page 25: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Appendix C: List of Parts

Table C.1: Parts list and costs

Parts Part # Qty Cost Total Cost

IR photo transistor BPW36 3 1.80 $ 5.40Schmitt trigger inverters 74HC14 3 0.55 $ 1.65Clock Generator LM555 3 0.42 $ 1.26D flip-flop 74LS74 3 0.56 $ 1.68Inverters 7405 3 0.88 $ 2.64Diodes 1N4001 150 0.034 $ 5.10IR LED F5F1 80 0.235 $ 18.80Parallel Connector -- 2 2 $4Parallel Cord -- 1 10 $ 10Power Supply -- 1 donated donatedDecoder 4 2.25 $10IR emitters 38 pks

(2 / pk)2.25

Cables 1 roll 65 65Solder 1 13.25 13.25Solder Coil 1 lbWire StripperSwitchCooling FanVoltage Regulators 1 pk 2.20 2.20Metal Casing NAND Gates 2 1.50 3.00IR receiver OP505 2 donated donatedResistors donated donatedCapacitors donated donatedWires donated DonatedPrinted Circuit Board

Costs in italics are estimates only

24

Page 26: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Appendix X --- Software codeX.1: Borland C++ code for the VCR drivers

ir.h#define CONTROL 0x37A#define STATUS 0x379#define OUTPUT 0x378

#define RECORD_SIZE 15000#define DELAY_DEFAULT 3000

Play.ccp#include <fstream>#include <stdio.h>#include <stdlib.h>#include <dos.h>#include <conio.h>#include "ir.h"

unsigned char button1[RECORD_SIZE]; // array to store the dataint Delay=DELAY_DEFAULT;

void RetrieveFromFile(char* argv[]){

ifstream fin; int x,data; fin.open(argv[1]); for(x=0;x<RECORD_SIZE;x++){ data = (char)fin.get();

if (data=='0'){ button1[x]= 0; } else { button1[x]= 1; } // end if } // end for x

fin.close();}

void PlayButton(char * argv[]){ unsigned int i,j,index; unsigned char data, signal; int x=0,y=10;

index = 0;

signal = atoi(argv[2])*2; for(i=0;i<RECORD_SIZE;i++) { data = button1[index]; if (data) { outportb(OUTPUT,signal+1);

25

Page 27: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

} else { outportb(OUTPUT,signal); } index++; for(j=0;j<Delay;j++); } outportb(OUTPUT,0x00);}void main(int argc,char *argv[]){

RetrieveFromFile(argv);PlayButton(argv);

cout << argv[1] <<" has been played on "<< argv[2] << endl;}

Record.cpp#include <fstream>#include <stdio.h>#include <stdlib.h>#include <dos.h>#include <conio.h>#include "ir.h"

unsigned char button1[RECORD_SIZE]; // array to store the dataint Delay=DELAY_DEFAULT; void SaveToFile(char *argv[]){

ofstream fout; int x; fout.open(argv[1]);

for(x=0;x<RECORD_SIZE;x++){ if (button1[x]==0){ fout << "0"; } else { fout << "1"; } // end if } // end for x

fout.close();} // end SaveToFile

void RecordButton(void){ unsigned int i,j,index; unsigned char data; int x=0,y=10;

index = 0;

while(!(inportb(STATUS) & IN_MASK)); // wait for rising edge

for(i=0;i<RECORD_SIZE;i++) { data = inportb(STATUS) & IN_MASK; if (data) {

26

Page 28: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

button1[index] = data; } else { button1[index] = data; } index++;

for(j=0;j<Delay;j++) ; // wait a bit }}

void main(int argc,char *argv[]){ cout << "Press the button now for " << argv[1] << endl; RecordButton(); SaveToFile(argv); cout << "Button recorded";}

X.2: Microsoft Visual Basic 6.0 code for the VCR control window

VCRmaster.frmfrmVCRmaster' Form Settings configured in VB 6.0

Private Sub initialSetup()' Setup of the status array and setupFile' Uses Modules: modFile, modConsts' Uses globals: clsVCR' Modifies: frmVCRControl

Dim count, setupFile, intTest As Integer ' Check to see if the file has been initialized setupFile = modFile.setupAsBinary Get #setupFile, 1, intTest Close #setupFile ' Initialize setupFile and status Array setupFile = modFile.setupFile If intTest = 0 Then For count = 0 To modConsts.ARRAY_NUM modMain.clsVCR(count).Name = "VCR " + Str$(count) modMain.clsVCR(count).number = -1 picStatus(count).Visible = False Put setupFile, count + 1, modMain.clsVCR(count) Next count Else For count = 0 To modConsts.ARRAY_NUM Get setupFile, count + 1, modMain.clsVCR(count) If modMain.clsVCR(count).number = -1 Then picStatus(count).Visible = False End If Next count End If Close #setupFile

27

Page 29: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

End Sub

Private Sub btnBank_Click(Index As Integer)' Restores a saved VCR configuration' Uses Modules: modFile If modGlobal.gBank = 7 Then gBank = Index Else Dim bnkFile, count As Integer Dim blnStatus As modConsts.Bankinfo bnkFile = modFile.bankFile Get #bnkFile, Index + 1, blnStatus Close #bnkFile For count = 0 To modConsts.ARRAY_NUM If blnStatus.status(count) = True Then chkVCR(count).Value = 1 Else: chkVCR(count).Value = 0 End If Next count End If End Sub

Private Sub btnClearAll_Click()' Removes all program files' Uses Modules: modFile modFile.killSetup modFile.killVCR Unload frmVCRControlEnd Sub

Private Sub btnCommand_Click(Index As Integer)' Controls the command buttons for the VCR array' Uses Modules: modConsts' Modifies: frmVCRControl

Dim count As Integer For count = 0 To modConsts.ARRAY_NUM If (chkVCR(count).Value = 1 And picStatus(count).Visible = True) Then If Index <> 6 Then modVCR.Play count, Index Select Case Index Case Is = 0 picStatus(count).BackColor = &HFF00& Case Is = 1 picStatus(count).BackColor = &HFF& Case Is = 2 picStatus(count).BackColor = &H0& Case Is = 3 picStatus(count).BackColor = &H80FF80 Case Is = 4

28

Page 30: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

picStatus(count).BackColor = &H8080FF Case Is = 5 picStatus(count).BackColor = &HFFFF& Case Is = 6 picStatus(count).BackColor = &H8000000F End Select End If Next countEnd Sub

Private Sub btnSetupBank_Click()' Sets the VCRs that are selected for a VCR Bank button' Uses Modules: modConsts, modFile' Uses globals: gBank Dim bnkFile, count As Integer Dim blnStatus As Bankinfo Dim strMsg As String Dim intResult As Integer modGlobal.gBank = 7 MsgBox ("Select the desired configuration and then press the desired VCR Bank Button") While modGlobal.gBank = 7 DoEvents Wend For count = 0 To modConsts.ARRAY_NUM If chkVCR(count).Value = 1 Then blnStatus.status(count) = True Else: blnStatus.status(count) = False End If Next count strMsg = "Are you sure you want to set VCR Bank" + Str(modGlobal.gBank + 1) intResult = MsgBox(strMsg, vbOKCancel)

If intResult = 1 Then bnkFile = modFile.bankFile Put bnkFile, modGlobal.gBank + 1, blnStatus Close bnkFile strMsg = "VCR Bank" + Str(modGlobal.gBank + 1) + " was set" MsgBox (strMsg) End If modGlobal.gBank = 6

End Sub

Private Sub btnVCRsetup_Click()' Calls the VCRsetup form to setup all selected VCRs' Uses Modules: modConsts, modFile' Uses globals: gStop, gVCRnumber, clsVCR' Modifies: frmVCRControl, frmVCRsetup Dim strLabel As String Dim setupFile As Integer

29

Page 31: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Dim count As Integer strLabel = ""

For count = 0 To modConsts.ARRAY_NUM If chkVCR(count).Value = 1 Then strLabel = strLabel + Str$(count + 1) + ", " End If Next count If strLabel = "" Then MsgBox "You must select a VCR to setup" Else strLabel = "Setup VCR " + strLabel strLabel = Left$(strLabel, Len(strLabel) - 2) frmVCRsetup.Caption = strLabel frmVCRsetup.Visible = True frmVCRControl.Enabled = False End If modGlobal.gStop = False While Not modGlobal.gStop DoEvents Wend frmVCRControl.Enabled = True If modGlobal.gVCRnumber <> -1 Then setupFile = modFile.setupFile For count = 0 To modConsts.ARRAY_NUM If chkVCR(count).Value = 1 Then modMain.clsVCR(count).number = modGlobal.gVCRnumber picStatus(count).Visible = True Put setupFile, count + 1, modMain.clsVCR(count) End If Next count End If Close #setupFile modGlobal.gVCRnumber = -1End Sub

Private Sub btnMultiSelect_Click(Index As Integer)' Set the selected column to the opposite of its first entry' Uses Modules: modConst' Modifies: frmVCRControl

Dim switch As Boolean Dim count As Integer ' Find out the status of 1st item If chkVCR(Index * modConsts.ROW_NUM).Value = False Then switch = True Else: switch = False End If ' Set the columns to the proper value For count = (Index * modConsts.ROW_NUM) To (Index * modConsts.ROW_NUM) + modConsts.ROW_NUM - 1 If switch = False Then chkVCR(count).Value = 0

30

Page 32: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Else chkVCR(count).Value = 1 End If Next countEnd Sub

Private Sub Form_Load()' Takes care of the setup and initializes the VCR number' Uses Globals: gVCRnumber

initialSetup modGlobal.gVCRnumber = -1End Sub

X.3: Microsoft Visual Basic 6.0 code for the VCR setup window

VCRsetup.frmfrmVCRsetup.frm' Form Settings configured in VB 6.0

Private Sub btnSet_Click()' Returns to the VCR control form with a VCR number' Uses Globals: gVCRnumber, gStop' Modifies: frmVCRsetup

modGlobal.gVCRnumber = lstVCR.ListIndex modGlobal.gStop = True Unload frmVCRsetupEnd Sub

Private Sub btnCancel_Click()' Exits to the VCR control form' Uses Globals: gVCRnumber, gStop' Modifies: frmVCRsetup

modGlobal.gVCRnumber = -1 modGlobal.gStop = True Unload frmVCRsetupEnd Sub

Private Sub Form_Load()' Sets up the list of VCR's created' Uses modules: modFile, modConsts' Modifies: frmVCRsetup

Dim rcdFile, count As Integer Dim clsVCR As modConsts.VCRinfo Dim strVCRname As String Dim lngIndex As Long rcdFile = modFile.recordFile count = 0

Do Until EOF(rcdFile) Get rcdFile, count + 1, clsVCR

31

Page 33: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

strVCRname = clsVCR.Name lstVCR.AddItem strVCRname, count count = count + 1 Loop Close #rcdFile lstVCR.RemoveItem (lstVCR.ListCount - 1) End Sub

Private Sub btnNewVCR_Click()' Adds txtVCR as a new VCR with addVCR and then updates the lstVCR accordingly' Uses Modules: modVCR' Modifies: VCRsetup

Dim strNewVCR As String Dim intLast As Integer strNewVCR = txtVCRname.Text If strNewVCR = "" Then MsgBox "You must type in a new Name" Else intLast = lstVCR.ListCount modVCR.addVCR strNewVCR, intLast lstVCR.AddItem strNewVCR, intLast lstVCR.Selected(intLast) = True txtVCRname.Text = "" End IfEnd Sub

X.4: Microsoft Visual Basic 6.0 code for const.bas

const.basmodConst

Attribute VB_Name = "modConsts"Option Explicit

Public Const COL_NUM As Integer = 7Public Const ROW_NUM As Integer = 10

Public Const ARRAY_NUM As Integer = COL_NUM * ROW_NUM - 7

Public Type VCRstatus Name As String * 6 number As IntegerEnd Type

Public Type VCRinfo Name As String * 20 Codes(0 To 5) As BooleanEnd Type

Public Type Bankinfo status(0 To ARRAY_NUM) As BooleanEnd Type

32

Page 34: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

X.5: Microsoft Visual Basic 6.0 code for file.bas

file.basmodFile

Attribute VB_Name = "modFile"Option ExplicitPublic Const strSetup As String = "binSetup.bin"Public Const strBank As String = "binBank.bin"Public Const strVCR As String = "binVCR.bin"Public Const strRecord As String = "c:\cplus\record.exe"Public Const strPlay As String = "c:\cplus\play.exe"

Public Function setupAsBinary() As Integer Dim setupFile As Integer setupFile = FreeFile Open strSetup For Binary As #setupFile setupAsBinary = setupFileEnd Function

Public Function setupFile() As Integer Dim FileNum As Integer FileNum = FreeFile Dim temp As modConsts.VCRstatus Open strSetup For Random As #FileNum Len = Len(temp) setupFile = FileNumEnd Function

Public Function recordFile() As Integer Dim rcdFile As Integer rcdFile = FreeFile Dim clsVCR As modConsts.VCRinfo Open strVCR For Random As #rcdFile Len = Len(clsVCR) recordFile = rcdFileEnd FunctionPublic Function bankFile() As Integer Dim bnkFile As Integer bnkFile = FreeFile Dim status As modConsts.Bankinfo Open strBank For Random As #bnkFile Len = Len(status) bankFile = bnkFileEnd Function

Public Sub killSetup() Kill strSetupEnd Sub

Public Sub killVCR() Kill strVCREnd Sub

X.6: Microsoft Visual Basic 6.0 code for global.bas

global.basmodGlobal

33

Page 35: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Attribute VB_Name = "modGlobal"Option Explicit

Public gUnload As BooleanPublic gVCRnumber As IntegerPublic gStop As BooleanPublic gBank As Integer

X.7: Microsoft Visual Basic 6.0 code for main.bas

main.basmodMain

Attribute VB_Name = "modMain"Option ExplicitGlobal clsVCR(0 To modConsts.ARRAY_NUM) As modConsts.VCRstatus

Public Sub main() frmVCRControl.Visible = True gBank = 6End Sub

X.8: Microsoft Visual Basic 6.0 code for VCR.bas

VCR.basmodVCR

Attribute VB_Name = "modVCR"Option Explicit

Public Sub addVCR(strVCRname As String, intLast As Integer)' Stores the new VCR name in the record file at the next place' and sets all code indexes equal to -1' Uses modules: modFile, modConsts

Dim rcdFile, count As Integer Dim addVCR As modConsts.VCRinfo Dim strName As String addVCR.Name = strVCRname For count = 0 To 5 If intLast < 9 Then strName = Right$(Str(intLast + 1), 1)+Right$(Str(count),1) strName = "0" + strName Else strName = Right$(Str(intLast + 1), 2)+Right$(Str(count), 1) End If modShell.ExecCmd (modFile.strRecord + " " + strName + ".txt") addVCR.Codes(count) = True Next count rcdFile = modFile.recordFile Put rcdFile, intLast + 1, addVCR Close rcdFileEnd Sub

34

Page 36: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Public Sub Play(intVCR As Integer, intCommand As Integer) Dim playVCR As modConsts.VCRinfo Dim FileNum As Integer Dim strName As String If intVCR < 10 Then strName = Right$(Str(modMain.clsVCR(intVCR).number),1)

+Right$(Str(intCommand), 1) strName = "0" + strName Else strName = Right$(Str(modMain.clsVCR(intVCR).number), 2)

+ Right$(Str(intCommand), 1) End If modShell.ExecCmd (strPlay + " " + strName + ".txt")End Sub

X.8: Microsoft Visual Basic 6.0 code for shell.bas

shell.basmodShell

Attribute VB_Name = "modShell"' Taken from Microsoft Knowledge Base ID: Q129796' Public Sub ExecCmd(<path>) as long' Stops the program while path is running, then returns the exit code

Private Type STARTUPINFO cb As Long lpReserved As String lpDesktop As String lpTitle As String dwX As Long dwY As Long dwXSize As Long dwYSize As Long dwXCountChars As Long dwYCountChars As Long dwFillAttribute As Long dwFlags As Long wShowWindow As Integer cbReserved2 As Integer lpReserved2 As Long hStdInput As Long hStdOutput As Long hStdError As Long End Type

Private Type PROCESS_INFORMATION hProcess As Long hThread As Long dwProcessID As Long dwThreadID As Long End Type

Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _ hHandle As Long, ByVal dwMilliseconds As Long) As Long

35

Page 37: Automated Multiple VCR - Iowa State Universityseniord.ece.iastate.edu/projects/archive/may0113/Final... · Web viewThe user interface will operate on a Windows based operating system

Private Declare Function CreateProcessA Lib "kernel32" (ByVal _ lpApplicationName As String, ByVal lpCommandLine As String, ByVal _ lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _ ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _ ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _ lpStartupInfo As STARTUPINFO, lpProcessInformation As _ PROCESS_INFORMATION) As Long

Private Declare Function CloseHandle Lib "kernel32" _ (ByVal hObject As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" _ (ByVal hProcess As Long, lpExitCode As Long) As Long

Private Const NORMAL_PRIORITY_CLASS = &H20& Private Const INFINITE = -1&

Public Function ExecCmd(cmdline$) Dim proc As PROCESS_INFORMATION Dim start As STARTUPINFO

' Initialize the STARTUPINFO structure: start.cb = Len(start)

' Start the shelled application: ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _ HIGH_PRIORITY_CLASS, 0&, vbNullString, start, proc)

' Wait for the shelled application to finish: ret& = WaitForSingleObject(proc.hProcess, INFINITE) Call GetExitCodeProcess(proc.hProcess, ret&) Call CloseHandle(proc.hThread) Call CloseHandle(proc.hProcess) ExecCmd = ret& End Function

Appendix X --- User Manual

[ To be added ]

36