X-10 Control Program for Windows (X10CTL) Ver. 1.3 NOTICE This program is available at no cost from the Author, Larry E. Fosdick [CIS 70105,1142]. No warranty, either expressed or implied, covers losses of data, fingernails, or hair from the use or abuse of this software. This program may be freely distributed. No money is to be collected for this software, especially by the author, who did this for recreation. The source code is NOT available. INTRODUCTION This program, written in Microsoft Visual BASIC, provides complete access and control for the X-10 Powerhouse Interface (X-10 USA Inc.). Features include: - True multiple window application - X-10 clock can be automatically synchronized to computer system clock - Console window for immediate control - Descriptive unit definitions entered by user - Timed events are easily added, deleted, or modified, with changes downloaded automatically to the interface - Timed event sets can be saved to and restored from disk files - Timed events can be set to Today, Tomorrow, Everyday, Weekdays, Weekends, or Specific Days - Event list can be printed for reference - 16-position dimmer function for lamp units or light switches X10CTL requires VBRUN100.DLL for operation, available on CompuServe. X10CTL also requires the X-10 Powerhouse interface from X-10 (USA), Model CP290. It can be purchased from DAK Industries Incorporated Heath Company 8200 Remmet Ave. P.O. Box 8589 Canoga Park, CA 91304 Benton Harbor, MI 49023-8589 800-325-0800 (Orders) 800-253-0570 800-888-9818 (Tech Info) Heath Item BC-290-P DAK Item No. 5851 You may wish to ensure that the hardware model CP290 is still the one being sold. There is no telling what changes could have been made if the hardware model number has changed. I do not endorse any equipment vendor. This information is provided to answer queries Revision 1.00 generated. There may be other vendors, but these are the only ones known to me. I bought my X-10 Powerhouse from DAK about three years ago, and it works very well. PROGRAM OPERATION The first time the program is started, X10CTL.INI is created in your Windows directory. This file maintains initialization parameters for X10CTL, including the COM port number, window positions, and unit descriptions. You will be required to enter the COM port for the X-10 Interface the first time the program is run. If you change the port in the future, you will have to edit X10CTL.INI, since the program will not operate without the Interface active. Main Window The Main window provides access to the other windows in the application. Access can be gained by double-clicking the appropriate icon, or through the menu system. The Unit, Event, and Console windows can be open concurrently, with free movement between these windows. Unit Window This window allows the user to describe up to 256 units (A1 - P16). The descriptions are stored in X10CTL.INI in the format HUU=Description String where H is the House Code (A-P) and UU is the unit number (01-16). The leading zero is required. Unit descriptions are added by first selecting House and Unit codes, then clicking the Add/Edit button. A dialog box is opened, allowing the user to enter a series of characters describing the function of the unit. Changes are saved when the application is terminated. Unit descriptions can be edited by first selecting the unit to be edited, either using the House and Unit buttons, or by clicking the entry directly on the list, followed by clicking the Add/Edit button. Unit descriptions can be deleted by selecting the unit of interest, followed by clicking the Delete button. In Version 1.2 and later, unit number 17 (which does not exist physically) is predefined as "All Lights On/Units Off". This function was added at the request of users, who wished to be able to program "All Off" functions as events. Note that any "On" events are translated automatically to "Dim00" (Highest lamp unit output) so that "On" functions will only work on lights connected to lamp or wall switch modules. The "Off" functions will work with all units assigned to the given House Code. Event Window When the Event window is first opened, the events stored in the X-10 Interface are uploaded to the computer, then displayed. Events can be added, updated (modified), or deleted. All changes to the event list are sent to the X-10 Interface immediately. The Event window thus always represents the current action list in the X-10 Interface. The Event List can be printed for reference or easy review. Events are added by selecting the following components in any sequence: - Unit - Mode (Today, Tomorrow, Everyday, Weekdays, Weekends, or Specific Days) - Action (On, Off, or Dim) - Time (24-hour format) - Security (Checked or Unchecked) The Unit and Mode are selected from drop-down lists. The Unit list is constantly updated from the Unit window. If a desired unit is not defined, simply switch to the Unit window, add the unit description needed, then switch back to the Event window. Remember that both windows can be open concurrently. I tried to make it possible to view both windows without overlap, but there is simply too much information needed for full functionality. If Mode is Specific Days, a Day Selection control box is displayed. Check the days you wish to have the action take place. The box is not displayed in the other modes, since the days are implicit in the mode definition. If Action is Dim, a Dim Level control is displayed. Use the scroll bar to select the dim level between 0 (full bright) to 15 (full dim). To change the Time, click on the hours or minutes areas, then use the scroll bar to change the selected value. Events can be updated by first clicking on the line describing the event, then changing controls as needed, followed by clicking on the Update button. When an event is selected by clicking on it, all controls are updated to match the event. This simplifies changes, since most controls will be correct. Note that the days in the Specific Days mode appear gray to differentiate the days selected in the interface from those being changed. Events can be deleted by clicking on the event, followed by clicking the Delete button. There is no undelete function. Event files are accessed through the Event window by clicking on Files. The current list of events can be saved to disk (default extension is .X10). Events loaded from a disk file will completely replace the events in the interface, i.e., any events in the interface are erased when an event file is loaded. Thanks to all the folks that provided feedback. Without it, the bugs couldn't have been swatted as fast. There may still be more, so be careful until you are satisfied. I used the DOS-based software to save my event list before using this program at first, since you can easily restore any errors that way. All you have to do is unplug the interface and remove the battery for a few seconds. DON'T use the change base code function, since your unit descriptions get lost as well in the DOS-based version supplied with the interface. ERROR MESSAGES AND THEIR CAUSES Error Opening Port Either some other program, such as a comm program or mouse driver, is using the port, or the X10CTL application suffered an uncontrolled crash. If the former, adjust the port assignments in your computer. If the X10CTL has crashed, you must restart Windows, since the port was not closed, and access is cut off. If X10CTL crashes, record as much information concerning your actions at that point, then e-mail a summary to me. Error with X-10 Interface The port has been opened and configured. The initial attempt to communicate with the X-10 Interface has failed. Possible causes include: 1. Wrong com port selected 2. X-10 Interface not connected 3. X-10 Interface unplugged Correct the cause(s), if found, and try again. If everything seems normal, then it may be an unknown bug in X10CTL. If you can, try using a different program to access the interface to make sure the X-10 itself is OK. Please forward comments, compliments, complaints, bug reports, or suggestions to Larry E. Fosdick [70105,1142] *** Changes in Version 1.3 Corrected some problems with the file handler. It seems that events were uploaded to the Interface faster than it could accept them, resulting in garbage. Also corrected some strange things that crept into Version 1.2 somehow that affected the appearance but not the performance. *** Changes in Version 1.2 The ability to print the event list has been added. A unit description of "All Lights On/Units Off" has been added to the Unit Window. This was primarily added for those who wish to send "All Off" commands while away from home. I have no idea who will use it to turn lights on. Please note that the code uses DIM00 instead of ON, so that this control will only turn on lights that are connected to lamp modules or wall switches. The off function affects all units on the selected house code. The unit number for this function is 17, which is not real, but gives the software a hook. I also had a request for a macro function in X10CTL. I assume the requester is interested in saving command sequences to disk and executing them at will, as opposed to preprogrammed events or immediate commands through a console. There are some interesting technical problems with this, depending on the design chosen to enter and maintain macros. If anyone is interested in this function, please let me know. If there is sufficient interest, I may give it a try. *** Changes in Version 1.1 First of all, version numbers became two digits. If I get to version 9.9 then I'll be going nuts. The event upload has been changed again. It should now work for any speed CPU, without adding silly delays. If you have trouble with this version, please retest the program with a slower cpu speed, if your computer allows cpu speed switching, then report the results to me. The intro window was added once I saw how long the screen went blank while initializing the program. An odd quirk of Windows causes the focus to go to a window other than the Main window on my system, so I tried to incorporate a work-around using the timer. It caused more problems than it solved, so I took it back out. If the Main window doesn't have the focus when it first comes up, sorry. It turns out that if you terminate a multiple window Visual BASIC program (like this one), the Form Unload subprogram is only executed on the primary window unless you unload explicitly the other windows. This "feature" caused problems with saving changes to the Unit Decription List. This has now been fixed. *** Changes in Version 1.01 Three changes were made. The first addresses an "Illegal Function Call" error when first starting the program and setting the COM port for the X-10. This was a silly oversight. I use the timer function to ensure that the Main window gets the focus after the intro window is removed (normally, the focus goes to some other window). I now start the timer after the port configuration window is closed. The second fix deals with Event updates not working properly in 1.00. It was simply a bookeeping error. The third fix deals with uploading events from the interface. The X-10 Powerhouse does not support any form of handshaking, and so the event uploading has to be handled by a combination of timing and waiting for the right number of characters in the buffer. There are actually two wait periods. I have tried to improve the robustness of the routines, and have added message boxes to help determine where the errors lie. If you get an error message box, please record the message and let me know. CPU's faster than my 16 MHz 386SX may be too fast for my algorithm. I am trying to avoid making it too conservative, as this slows event uploads.