|
|
SUMMARYThis technical note discusses some of the issues that you should be aware of when creating schedules and programs that you want to download to the Magic Module (MM). What follows are some notes about various features and limitations of the MM and how they effect HCA.
Limitations on download to MMWhen you select programs and schedules for download to the Magic Module, the download wizard prevents you from selecting some programs and some schedules. This list describes what types of things that will prevent a program or schedule from being selected for download. All of these limitations are directly related to the instruction set within the Magic Module and its memory. It is a simple processor that exposes a simple interpreter with an instruction set created by Elk Products. Some of these limitations are minor and some are major.
Schedule downloads have these limitations:
Programs with these elements can't be downloaded
These elements are dropped from download programs. They are considered minor:
These elements have limitations:
These are several other limitations:
More information on how HCA programs handle their triggersAs part of the program properties you can specify what happens when the trigger for a
program is received when the program is already running. In HCA you have three
options: When downloaded to the MM, all programs act as if they had option #2, that is, they restart from the Begin Here. You have no option on this. There is a second related complication of this that is a bit technical when Delay elements are added to the mix. Suppose a program looks like this: Suppose this program is triggered on an A1 ON. If an A1 ON arrives the program starts. If during the delay another A1 ON arrives, the "ON Lamp" is done and then the delay restarts from 1 minute. This should be clear. Now, suppose you have this program Again assume that the an A1 triggers this program. An A1 ON happens and the Lamp goes on. Then let's assume that Flag1 is No, so the test succeeds and Flag1 is set to True, then the delay starts. Now assume another A1 ON happens during that delay. The program starts again: It does the On Lamp. Since Flag1 is Yes, the failure path of the test happens and the program exits. But what about that unexpired delay from the first invocation of the program? When the minute is up the Off of Lamp will still happen ! This is because of how HCA has used the MM event facilities - how the MM responds to various events like a clock tick, an X10 reception, or a change in input voltage - in assembling programs for download. Take note if you care about this sort of thing.
Downloading programs that don't have triggersSelect a program and go look at the advanced properties. In the group labeled "Start", focus your attention on the option labeled "When HCA is started normally". If this option is checked for a program that is selected for download, that program will start running immediately after the download completes. That is, it does not need to be triggered. Also, if the MM is powered off, then powered on again the program will start at its beginning. Why would you use this? In the MM all flags start off as "No". If you wanted to set up the
state of the flags to some special values or you wanted to select a schedule, you can
create a program that does this. The program would run, do what it needs to do and
exit. This program would complete before the MM starts fielding program triggers or
time based events. You could write a single program that gets downloaded that has a forever loop in it - perhaps with some delays. All that the Magic Module would do is in this program and it is marked to start right after download. As an example, I used the Magic Module to build a solution for a friend of mine who needed to cure some material in a temperature controlled box for a few days. I used the MM and the MM temperature sensor to turn on and off light bulbs using the MM relays. Once downloaded the program started. It checks the temperature and if it's too low, it turns on the lights. If it's too high then it turns the lights off. This program delays for a bit and loops back to test the temperature again. I created this program in HCA and downloaded it to the MM which was then disconnected from the PC and given to him. Now when he needs to run the temperature controlled box he just powers up the MM and lets it go. When he is done he powers it down. Nothing needs to start the program - it starts when the MM is powered on.
Magic Module NetworkOne of the nice features of the Magic Module is that you can use more than one and, if connected to the same 485 bus, they can operate as a network. This has several advantages. You can use it to expand the number of housecodes responded to (the housecode limitation described earlier), one MM can offer it's X10 interface or iButton reader for use by other Magic Modules, Each MM can have it's own programs and schedules downloaded to it. For example, suppose you have two programs. One responds to A1 the other to B1. Clearly both can't be downloaded into the same MM. But you could download one program to one MM and the other program to the other MM. Only one of the MMs needs to have a X10 interface. The other MM gets its X10 services from the MM with the X10 interface. So back to the example. MM one has the X10 interface and in its memory resides the program that triggers on A1. MM two has the program that triggers on B1. Even though MM two doesn't have an X10 interface it still gets the B1 trigger and starts the program running. That program could also send X10 commands using the interface on MM one. It is important that MM one be programmed to broadcast X10 receptions on the 485 bus. This is done in step 2 of the download wizard. The same facilities are available for an access device reader (IButtons, etc) attached to a MM. All MMs will receive the scans from it. In addition to sharing the X10 interfaces, a network of MMs can:
In the above this we talk about two Magic Modules, one and two. But don't forget that you can have as many as 31 MMs connected on the same network. But there are a few limitations
Finally, remember it is up to you to fashion your download into the various MMs on the
network. You need to decide what goes where. |