Vermont Peripherals "Peripherals and software for product development" PO Box 2063 | Colchester | Vermont | 05446-2063 Compuserve ID# 5063 Type GO SWREG to Order COMPANY SUMMARY, Our products principally stay in the broad area of data acquisition and control systems for the PC. This, of course, would not exclude any particular application. We're motivated and successful in these areas and enjoy what we do. If you do not have a catalog of our products then please ask, you should find our catalog very interesting. If you wish to purchase from us, talk with us, or request our catalog (disk based of course) simply e-mail us at one the following addresses. In short, we build hardware and software for product development, not generally end-user applications, although we are open to any project idea. Compuserve: 74514,2615 Internet: 74514.2615@compuserve.com REGISTER TODAY ON COMPUSERVE - TYPE "GO SWREG" PRODUCT SUMMARY, You have obtained EVIO1.VBX, a VBX for hardware control. Pop this VBX into a Visual Basic (tm) application you're developing and be ready to design anything from a stage lighting system to an industrial control application (SEE LIMITED WARRANTY). I've had some fun with this VBX and I think you will as well. Of course, hobbyists would find this VBX useful. For example, perhaps developing a model train control application for railroad related hardware, or an electronics project requiring an effective interface. I'm sure more than a few applications would benefit by utilizing this VBX. To be more specific, EVIO1.VBX was prepared to facilitate project development involving PC related hardware designs (primarily control and data acquisition) requiring a windows front end. A requirement virtually mandatory these days for any design project involving the PC. As such, we chose the VBX format because it essentially hides all low level activity and provides an incredibly straight forward interface for those individuals using Visual BASIC (tm) An engineer or hobbyist may not take the time to learn all aspects of windows programming, but most would easily construct a C or BASIC program for test purposes (this has been my experience anyway), and would find VB very easy to use. This VBX is compiled in VC++ and provide extremely good execution speeds. Finally, you need not be an engineer to use and appreciate the ease of use and flexibility EVIO1 affords. PRODUCT FEATURES, Polled byte wide I/O Used in most languages, its standard I/O. Our VBX provides this as a foundation. Polled Bitwise I/O Allows Selection of a port and, in addition, a bit from that port. A single check will provide the status of that individual bit. When combined with bitwise output you end up with a bitwise control loop in a few lines of VB code. Event-driven byte wide I/O The moment any activity is detected at the port an event is fired and loads the complete byte into a buffer similar to hardware interrupts. Event-driven bitwise I/O Each instance of the VBX provides eight predefined functions that individually fire if any external bit found to be high. You select which bits to monitor and the VBX takes care of the rest. Each bit can be assigned a mask. SHAREWARE, This product is distributed as shareware. This product is not free. You will have a chance to try our software before buying it. If you continue to use this product you are required to purchase a licensed version. The licensed version will not contain the registration screen. We will e-mail, or snail-mail a licensed copy to you generally within 24 hrs from the date of registration. Copyright laws apply both to shareware and retail software, the copyright holder retains all rights. Shareware differs only in the distribution method, and is not a type of software. See ORDER.FRM EVALUATION SOFTWARE LICENSE AGREEMENT, Read this agreement before installing or using our software. Installation or distribution of our software indicates your acceptance of these terms. We grant the right to copy and distribute our software subject to the following conditions. 1) All files are maintained intact, without any changes or modification of any kind, and complete with all documentation and associated files. In short, you may distribute this software in the same form as released by us. 2) You may NOT sublicense or sell our software without written permission of Vermont Peripherals. LIMITED WARRANTY AND DISCLAIMER, ALL FILES, SOFTWARE AND DOCUMENTATION, ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. VERMONT PERIPHERALS (VP) AND THOSE AFFILIATED WITH VP DO NOT WARRANT, GUARANTEE, OR MAKE ANY REPRESENTATIONS REGARDING THE USE, OR THE RESULTS OF USE, OF THE SOFTWARE OR WRITTEN MATERIALS IN TERMS OF RELIABILITY OR CORRECTNESS. ALL RISK AS TO THE RESULTS OF THE SOFTWARE AND DOCUMENTATION IS ASSUMED BY YOU. YOU MUST ALSO ASSUME ALL COST, RISK, AND PROVIDE FINAL JUDGMENTs AS TO THE SUITABILITY FOR A PARTICULAR APPLICATION. ANY SUGGESTION VP MAKES AS TO USE OF THIS PRODUCT ARE FOR ILLUSTRATION ONLY AND IS SUBJECT TO YOUR JUDGMENT. VP WILL NOT BE HELD ACCOUNTABLE FOR ANY DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS PRODUCT. THIS PRODUCT CONTROLS HARDWARE. VP WILL NOT ASSUME THE COST, OR BE HELD ACCOUNTABLE FOR DAMAGE TO ANY HARDWARE, PC OR OTHERWISE, RESULTING FROM THE USE AND EVALUATION OF THIS PRODUCT. IT IS UP TO YOU AS TO THE METHOD OF EVALUATION THAT POSES THE LEAST RISK TO YOUR EQUIPMENT AND FUNDS. WE WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES (INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS OR INTERRUPTION OF BUSINESS, LOSS OF BUSINESS INFORMATION, AND SIMILAR CIRCUMSTANCES) ARISING OUT OF USE OR MISUSE OF OUR PRODUCTS. EVEN IN THE EVENT THAT VP HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ACKNOWLEDGMENT, BY USING AND/OR EVALUATING THIS PRODUCT YOU ACKNOWLEDGE THAT YOU HAVE READ THE LIMITED WARRANTY, UNDERSTAND IT, AND AGREE TO BE BOUND BY ITS' TERMS AND CONDITIONS. YOU ALSO AGREE THAT THE LIMITED WARRANTY SUPERSEDEAS ORAL OR WRITTEN COMMUNICATIONS BETWEEN THE PARTIES RELATING TO THE SUBJECT MATTER OF THE LIMITED WARRANTY. INTRODUCTION, Our VBX works with Visual Basic( TM) for windows. Two assumptions made in this document are that you program in Visual Basic and have a fair understanding of how I/O works in the PC. Most hobbyist, engineers and application programmers should find this document very straight forward. INSTALLATION, First, copy EVIO1.VBX to your "\windows\system" directory. Most likely you've installed a VBX already, if not, then don't worry, as your most of the way home. Select the "Add File" choice from the "file" option on the menu bar and you'll see the standard directory options presented, choose EVIO1.VBX from the \windows\system directory and you will see the VBX include itself on the VB control bar. Double click on the EVIO1 icon, form1.frm should be loaded with a copy (instance) of the VBX. EVIO1.VBX can be used with ANY I/O port on the PC. So be careful (See WARRANTY), It is designed for use with any hardware that utilizes port I/O, which is everything. EVIO1.VBX will allow applications to control very low level events that, in turn, could control anything from a train set to a doorbell. *** EVIO1 defaults to your PC's LPT1 status and data ports *** Although we do not recommend or suggest the use of EVIO1 for any particular application or suggest fitness of EVIO1.VBX for a specific task, the above examples are provided for illustrative purposes only. EVENT FUNCTIONS, Double clicking on EVIO1 located on form1.frm will immediately show the subroutine; Sub EVIO1_BitIn1 () End Sub In fact, EVIO1 has eight such events, all bitwise of course, called EVIO1_BitIn1 through EVIO1_BitIn8. These subroutines are automatically "fired" when a particular bit from a user selected input port is set to logic one. Each routine will keep firing as long as the input bit is held to logic one or the user (application) takes some course of action to disable the event or cause a logic zero at the input bit. In short, EVIO1 is set up for bitwise operation by default. EVIO PROPERTIES AND ALTERING DEFAULT OPERATION, Hardware may be designed with positive or negative logic, maskable I/O, polled or event driven operation. EVIO1 can be modified using its property list to account for a variety of conditions. Not all the properties will be explained in detail, most are self explanatory, some require a "bit" more verbiage. Here is the list of the most important properties: Enabled Used to activate the VBX, defaults "true" on load. Resolution How often the specified input port is scanned for new data, defaults to 55 mS. PortIn The user selectable input port, defaults to the PC's lpt1 printer status port. PortOut The user selectable output port, defaults to the PC's lpt1 printer data port. InvertIn User selectable logic, defaults to false, positive logic assumed at the input. InvertOut User selectable logic, defaults to false, positive logic assumed at the output. These last two properties can be a source of confusion. For example, if you find each bit event fires on every timer tick chances are that InvertIn should be changed from false to true. It really depends on what kind of hardware your working on. Keep things as simple as possible, I would suggest leaving InvertOut alone, and only altering InvertIn as required. This property was provided mostly to maintain symmetry in the system. DataIn This is the Byte retrieved from the last input scan, or in the case of polled operation, contains the last byte read in using the LatchIn property. See further in this document. LatchIn Use this property when in polled mode, Timer = False, to load DataIn with a byte value from an input port. Defaults to False. Timer Enables event-driven I/O, defaults to true on load. When using polled operation its best to set this property to false. DataOut This is the byte value sent to the port at any point in the program regardless of polled or event I/O operation. PROPERTIES FOR BITWISE OPERATION, EVIO1 allows bit level evaluation of the selected port. BitOut1 through BitOut8, These properties "fire" a single bit high or low at the specified port. This is true at design time or runtime. The bits may be fired as a group or individually. They may be used in polled operation or in event mode. BitIn1 through BitIn8, These are not set by the user, but are used as flags while in polled operation to parse out the status of individual bits. Your application simply reads the value. MaskIn Used to set which bits are to be evaluated eitherin polled mode or event mode. Its interesting to note that EVIO1 will act much like a maskable interrupts at the port level. MaskOut Provide for symmetry reasons, will perform that same action as MaskIn for data begin sent out the port. EXAMPLE USAGE, The best example code would involve external port I/O, that is, I/O designed and used externally to the PC. Preferably, led indicators for output and TTL or similar input for testing events. As I have no way to determine your particular hardware configuration, the example code snippets will stay very generic. Currently EVIO1 defaults to the printer (lpt1) port, this port is an extremely versatile access point for performing control operations. Unfortunately, having a printer attached would pose certain problems as you might guess, of course, this might be the target hardware. If interested, you might develop an example program using EVIO1 with internal PC ports. I would love to see some instructive examples. Go ahead and e-mail some example code to us if this sounds like an interesting challenge. If we include your code in the next manual I'll send you an additional VBX (or upgrade) developed by Vermont Peripherals at no additional charge. (plus give you due credit in our manual). Note *** Keep in mind that Windows 3.1 is message driven and yields tasks, as such, other events going on in Windows 3.1 can and will inhibit operation. So when designing your application keep this in mind. EXAMPLE1, Performing I/O polled mode (or semi-event mode with the button), Dim cnt% Sub Form_Load () EVIO1.MaskOut = 255 ' *** set mask for, "all active", byte operation EVIO1.PortOut = 888 ' *** in decimal, default. You set this to your port EVIO1.Timer = False ' *** disable event mode EVIO1.DataOut = 0 ' *** set output data to zero Text1.Text = "" ' *** set up indicator box End Sub Sub Command1_Click () Text1.Text = Str$(cnt%) EVIO1.DataOut = cnt% ' *** Send data to the port cnt% = cnt% + 1 ' *** Increment data End Sub EXAMPLE2, This next example is for bitwise, event-driven I/O, Dim cnt% Sub Form_Load () EVIO1.MaskOut = 255 ' *** set mask for, "all active", byte operation EVIO1.PortOut = 888 ' *** in decimal, default. You set this to your port EVIO1.PortIn = 889 ' *** in decimal, default. You set this to your port EVIO1.Resolution = 55 ' *** set scan to 55 mS EVIO1.Timer = True ' *** disable event mode EVIO1.DataOut = 0 ' *** set output data to zero EVIO1.InvertIn = True ' *** Ground parallel port input bits, negative logic text1.Text = "" ' *** set up indicator box End Sub Sub Command1_Click () text1.Text = Str$(cnt%) EVIO1.DataOut = cnt% cnt% = cnt% + 1 End Sub Sub EVIO1_BitIn5 () cnt% = cnt% + 1 text1.Text = Str$(cnt%) End Sub The next example allows the user to press a windows button, or press a button attached to bit five of the selected port (lpt1)in order to increment the cnt% variable. In this case the port selected is bit5 (printer out of paper). Although, this of course could just as easily have been a signal for the computer to water the house plants using any port or bit defined. EXAMPLE3, Dim cnt% Sub Form_Load () EVIO1.MaskOut = 255 ' *** set mask for, "all active", byte operation EVIO1.PortOut = 888 ' *** in decimal, default. You set this to your port EVIO1.PortIn = 889 ' *** in decimal, default. You set this to your port EVIO1.Resolution = 55 ' *** set scan to 55 mS EVIO1.Timer = True ' *** disable event mode EVIO1.DataOut = 0 ' *** set output data to zero EVIO1.InvertIn = True ' *** Ground parallel port input bits, negative logic text1.Text = "" ' *** set up indicator box End Sub Sub Command1_Click () text1.Text = Str$(cnt%) EVIO1.DataOut = cnt% cnt% = cnt% + 1 End Sub Sub EVIO1_BitIn5 () cnt% = cnt% + 1 text1.Text = Str$(cnt%) End Sub OBTAINING BYTE/BIT STATUS, I won't provide a full example, however, the following well placed commands will allow you to check the status and value of the input port on a bit and byte wide level. EXAMPLE4, Sub Command1_Click () ' *** must LatchIn for polled operation EVIO1.LatchIn = True ' *** this is byte level in polled mode cnt% = EVIO1.DataIn text1.Text = Str$(cnt%) ' *** this next operation is on the bit level If EVIO1.BitIn5 Then text2.Text = "TRUE" Else text2.Text = "FALSE" End If End Sub This last partial example is fully event driven, bitwise operation, EXAMPLE5 Dim cnt% Sub Form_Load () EVIO1.MaskOut = 255 ' *** set mask for, "all active", byte operation EVIO1.MaskIn=255 ' *** ditto EVIO1.PortOut = 888 ' *** in decimal, default. You set this to your port EVIO1.PortIn = 889 ' *** in decimal, default. You set this to your port EVIO1.Resolution = 55 ' *** set scan to 55 mS EVIO1.Timer = True ' *** disable event mode EVIO1.DataOut = 0 ' *** set output data to zero EVIO1.InvertIn = True ' *** Ground parallel port input bits, negative logic text1.Text = "" ' *** set up indicator box End Sub ' When the system detects a high at bit 4 of the input port it fires ' bit 1 of the output port Sub EVIO1_BitIn4 () bit4t% = bit4% + 1 EVIO1.BitOut1 = TRUE End Sub ' When the system detects a high at bit 5 of the input port it fires ' bit 2 of the output port Sub EVIO1_BitIn5 () bit5% = bit5% + 1 EVIO1.BitOut2 = TRUE End Sub ' When the system detects a high at bit 6 of the input port it fires ' bit 3 of the output port Sub EVIO1_BitIn6 () bit6% = bit6% + 1 EVIO1.BitOut3=TRUE End Sub Because EVIO1 uses the window timer, a limit is imposed on the number of instances of EVIO1 that can be in the system while in event mode, that is, Timer = TRUE. Windows 3.1 has a limit of 31 total timers. Keep this in mind when designing your application. Plus my note above on task yielding above WHAT NEXT ?, Currently we use the windows timer (adjustable down to 55mS ) for parsing out bit events. We do have a high resolution version of EVIO1 in the works. Stay tuned REGISTRATION, Please see and use ORDER.FRM to obtain a release copy with no registration screen. Also, if you register directly on CompuServe you will be e-mailed the release version with no registration message box generally within 24hrs. --> This version may be used for product development on one computer only <-- TRADEMARKS, All brand names and product names used in this document are trademarks, registered trademarks, or trade names of their respective holders. Principally Microsoft Corporation.