Creating Custom Video Screens


With HomeVision (and HomeVision-Pro), you can create your own video screens. You can even use your remote control to control them. This article shows how to create a simple screen that displays the time and date. It also shows how to create a "menu" that you select from with your remote. Your remote can perform different functions depending upon which screen is being displayed, allowing virtually unlimited control options. This article also shows how to extend this to create virtually any screen you can think of.

To download a Microsoft Word version of this article, click here.

 

Operation Overview

Here's a summary of how the custom screens will work once they're set up:

bulletThe screen drawing commands will be contained within a separate periodic event for each screen. The periodic event will be set to run "each loop", but will initially be disabled.
bulletTo display the screen in your schedule, you'll:
bulletSet the variable "Custom TV Screen #" to the ID number of the screen you want to display (you'll have a unique # for each screen).
bulletRun the macro "Start Custom TV Screen". This macro will:
bulletInitialize the video system and create a blank screen to draw on.
bulletDisable all the periodic events that draw custom screens (this ensures they won't be drawn simultaneously).
bulletEnable the periodic event that draws the desired screen (as specified in the variable "Custom TV Screen #").

The enabled periodic event will then draw the desired screen each time it runs (about every 20ms). By repeatedly drawing the screen in the periodic event, any data which changes will be immediately updated.

bulletActions to perform when the user presses an infrared remote button while viewing the screen will be contained in the IR signal actions for the respective button. This could display a different custom or built-in screen, run a macro, shut off the video system, or just about anything else you can think off.
bulletTo shut off the custom screen in your schedule, run the macro "Stop Custom TV Screen". This macro will:
bulletDisable all the periodic events that draw custom screens.
bulletSet the variable "Custom TV Screen #" to 0 to indicate that no custom screens are being displayed any more.
bulletThe "power failure recovery" event will also run the macro "Stop Custom TV Screen" every time power is restored to the unit. This ensures it starts up properly.

 

Example Screen

This article develops a simple screen to the display the time and date and a short menu, as shown below:

 
Screen 1

 

 

 

 

 

 

This screen is included in the example schedule shipped with HomeVision. The object numbers (macros, periodic events, etc.) are different than those used here, but their names and the concepts are the same. You can view it from main menu page 4 by pressing button #2.

 

Creating The Schedule

Step 1 - Create Variable

Create one variable:

# NAME INITIAL
VALUE
DESCRIPTION
1 Custom TV Screen # 0 Indicates the number of the custom screen being displayed. Each screen must have a unique ID # (preferably starting at 1 and progressing up). It will be set to 0 (zero) when no custom screens are being displayed. Note that this is different from the built-in screen numbers.


Step 2 - Create Periodic Event

Create one periodic event:

# NAME RATE INITIAL
STATE
DESCRIPTION
1 Custom TV Screen #1 Each loop Disabled Repeatedly writes all the desired information for this custom screen. By repeatedly drawing the screen, any data which changes will be immediately updated.

This event must initially be disabled so that it does not draw anything. It will enabled when it's time to start drawing.

This event should not clear the screen, as flickering will result when it is repeatedly cleared and redrawn.

NOTE: If you want to create more than one custom screen, use a separate periodic event for each.

Enter these actions for the periodic event:

   Video: Set cursor row to 1
   Video: Set cursor column to 2
   Video: Display text 'Example Custom Screen'
   ;
   Video: Set cursor row to 4
   Video: Set cursor column to 3
   Video: Display current time
   Video: Display text ', '                   {note that there's a space after the comma}
   Video: Display current date
   ;
   Video: Set cursor row to 8
   Video: Set cursor column to 1
   Video: Display text '1 - To Main Menu Page 4'
   ;
   Video: Set cursor row to 9
   Video: Set cursor column to 1
   Video: Display text '2 - Exit Video System'
          

NOTE: After you enter these and leave the actions entry screen, the event will be enabled automatically. Be sure to disable it.

 

Step 3 - Create Macros

Create these macros:

# NAME DESCRIPTION
1 Start Custom TV Screen Starts displaying the custom screen specified in variable #1 (Custom TV Screen #).
2 Stop Custom TV Screen Stops all custom screens from being displayed by disabling the corresponding periodic events.

Enter these actions for the macros:

MACRO #1: Start Custom TV Screen

   ;In this example, we'll display the screen on a blank background (not on incoming video):
   Video: Start internal video mode
   ;
   ;Display built-in screen #0, which is a blank screen to write your own information on:
   Video: Display video screen #0
   ;
   ;Next, we disable all the periodic events that are used to draw custom screens:
   Disable periodic event #1 (Custom TV Screen #1)
   ;
   ;Finally, we determine which custom screen to display and enable its periodic event.
   ;The desired screen # must be in variable #1(Custom TV Screen #) before this macro runs.
   If
      Var #1(Custom TV Screen #) = 1
   Then
      Enable periodic event #1 (Custom TV Screen #1)
   End If
          

NOTE: In this example, there's only 1 custom screen. Therefore, there's only one command to disable it, and one If-Then statement to enable it. In this case, it seems odd to disable the event, then re-enable it. However, this concept makes much more sense when you have multiple custom screens, and we wanted the example to show this. Here's how this macro would look if you had three custom screens:

      ;In this example, we'll display the screen on a blank background (not on incoming video):
      Video: Start internal video mode
      ;
      ;Display built-in screen #0, which is a blank screen to write your own information on:
      Video: Display video screen #0
      ;
      ;Next, we disable all the periodic events that are used to draw custom screens:
      Disable periodic event #1 (Custom TV Screen #1)
      Disable periodic event #2 (Custom TV Screen #2)
      Disable periodic event #3 (Custom TV Screen #3)
      ;
      ;Finally, we determine which custom screen to display and enable its periodic event.
      ;The desired screen # must be in variable #1(Custom TV Screen #) before this macro runs.
      If
         Var #1(Custom TV Screen #) = 1
      Then
         Enable periodic event #1 (Custom TV Screen #1)
      End If
      If
         Var #1(Custom TV Screen #) = 2
      Then
         Enable periodic event #2 (Custom TV Screen #2)
      End If
      If
         Var #1(Custom TV Screen #) = 3
      Then
         Enable periodic event #3 (Custom TV Screen #3)
      End If
           

MACRO #2: Stop Custom TV Screen

   ;First, we disable all the periodic events that are used to draw custom screens:
   Disable periodic event #1 (Custom TV Screen #1)
   ;
   Then, set variable a to 0 to indicate that no custom screens are being displayed:
   Var #1(Custom TV Screen #) = 0
          

NOTE: As noted with the first macro, you would disable the other periodic events here also if you have more than one custom screen.

 

Step 4 - Create Infrared Signals

In this example, we're only using two infrared buttons (1 and 2). However, we recommend you set up all 16 of the signals that are used to control the video system. This will make it easier to later assign actions to them for other purposes.

To set up these signals, you must know the device code and key code for each button on your remote. If you're not sure what this means, refer to the owners manual chapter 14 (under "IR Signal Reception Details" and "Configuring the Controller to Control the Video Screen System"). Once you schedule has been set up to control the video system, you can view the actual device codes and key codes on the "Video Remote Control" screen located under the "Configure" menu in the PC software.

The default HomeVision device and key codes are shown in the following table (these are for a Hitachi TV, One-for-All remote code 145). These are the same as used in the example schedule. If you've remapped any of the keys (such as the "enter" or "cancel" keys), or selected a different remote device, use their actual codes, not the ones shown here.

NOTE: All of these signals have these same settings:

bulletIR Signal Type: Standard
bulletDevice Code: 10
# NAME KEY
CODE
DESCRIPTION
0 Remote Input 0 48 This is the number 0 button.
1 Remote Input 1 176 This is the number 1 button.
2 Remote Input 2 112 This is the number 2 button.
3 Remote Input 3 240 This is the number 3 button.
4 Remote Input 4 56 This is the number 4 button.
5 Remote Input 5 184 This is the number 5 button.
6 Remote Input 6 120 This is the number 6 button.
7 Remote Input 7 248 This is the number 7 button.
8 Remote Input 8 32 This is the number 8 button.
9 Remote Input 9 160 This is the number 9 button.
10 Remote Input Channel Up 152 This is the "channel up" button.
11 Remote Input Channel Down 24 This is the "channel down" button.
12 Remote Input Volume Up 72 This is the "volume up" button.
13 Remote Input Volume Down 168 This is the "volume down" button.
14 Remote Input Enter 80 This is the "enter" button.
15 Remote Input Cancel 208 This is the "cancel" button. Since some remotes don't have a button labeled "cancel", this may be assigned to the "mute" button.

Enter these actions for these two IR signals:

INFRARED SIGNAL #1: Remote Input 1

   If
      Var #1(Custom TV Screen #) = 1
   Then
      ;Do whatever you want to happen when displaying custom screen #1 and button 1 is pressed.
      ;In this example, we want to go to main menu page 4, which is built-in screen #55.
      ;But first, we must stop the custom screen from being displayed:
      Do macro #2 (Stop Custom TV Screen) once
      Video: Display video screen #55
   End If
           

INFRARED SIGNAL #2: Remote Input 2

   If
      Var #1(Custom TV Screen #) = 1
   Then
      ;Do whatever you want to happen when displaying custom screen #1 and button 2 is pressed.
      ;In this example, we want to shut the video system off entirely.
      ;But first, we must stop the custom screen from being displayed:
      Do macro #2 (Stop Custom TV Screen) once
      Video: Stop video mode
   End If        


Infrared Signal Actions Notes:

It's important to understand when the controller will execute these actions. If these buttons were not the same ones used to control the video menu system, then they would execute every time the buttons were pressed. However, buttons set up to control the video menu system behave differently:

bulletWhen no video screens are being displayed (the video system is turned off), the actions are performed whenever the corresponding button is pressed.
bulletWhen you're displaying your own custom screen using built-in screen #0, these actions are also performed whenever the corresponding button is pressed.
bulletWhen you're displaying any of the built-in screens (except for #0), these actions ARE NOT PERFORMED. Instead, the buttons are used to control the built-in screens.

HomeVision is set up this way so the buttons can control the built-in video system when you are using it, AND do other things (like control your own screens or perform macros) when you're not using it.

In this example, when the custom screen is being displayed, these infrared signal actions will be performed. We use the If-Then statement to determine which custom screen is being displayed, then perform whatever actions we want. Of course, in this example there's only one custom screen. But if you had more, you would have one If-Then statement for each screen, like this:

   If
      Var #1(Custom TV Screen #) = 1
   Then
      ;Do whatever you want to happen when displaying custom screen #1 and button 2 is pressed.
   End If
   ;
   If
      Var #1(Custom TV Screen #) = 2
   Then
      ;Do whatever you want to happen when displaying custom screen #2 and button 2 is pressed.
   End If
   ;
   If
      Var #1(Custom TV Screen #) = 3
   Then
      ;Do whatever you want to happen when displaying custom screen #3 and button 2 is pressed.
   End If
          

With this setup, the buttons will behave differently depending on which screen you're currently watching. This give you tremendous power when creating your own screens.

 

Step 5 - Power Failure Recovery Event

Enter the following command in the power failure recovery event:

   Do macro #2 (Stop Custom TV Screen) once          

This is done in case power goes out while you're displaying a custom screen. When the controller restarts, the periodic event for the screen will still be enabled, and it will write to the screen. When you then start the video menu system, the periodic event will overwrite it, causing flickering (or alternating between the two screens). Running this macro prevents this by disabling all the periodic events.

 

Controlling Your Screen

We're now ready to use this screen in a schedule. Here's how to start and stop displaying it.

Starting a custom screen

Anywhere in your schedule you want to start this screen, enter these commands:

   Var #1(Custom TV Screen #) = 1
   Do macro #1 (Start Custom TV Screen) once          

That's all there is to it. First, you set the variable to the screen number you want to display, then you run the macro to start it.

You could also start the screen using main menu page 4 of the built-in video menu system. For details on using main menu page 4, refer to the file "Screens" provided on the HomeVision installation disks. Basically, it displays options on the screen and allows you to perform a macro when the corresponding button is pressed. To display a custom screen from there, create a macro (perhaps called "Start Custom TV Screen #1"), and include in it the two commands shown above. Then, use the "Custom TV Menu" screen, located under the "Advanced" menu in the PC software, to assign this macro to the desired entry on menu page 4. When the user presses the corresponding button, the macro will be performed and the custom screen appears. This is the method used in the example schedule provided with HomeVision to start the custom screens.

 

Stopping a custom screen

Whenever you want to stop any custom screen, enter this command:

   Do macro #2 (Stop Custom TV Screen) once          

In this example, we did this in the two infrared signal events. After stopping the custom screens, you might also want to:

bulletshut off the video system (like we did for IR signal #2), or
bulletgo back to the menu system (like we did for IR signal #1), or
bulletgo to another custom screen (by setting variable #1 to the new screen number and running macro #1 (Start Custom TV Screen) again).

 

Custom Screen Notes

bulletRemember that you must always display built-in screen #0 when showing your own screen. Screen 0 is a blank screen for you to write on. If you display any other built-in screen, HomeVision will repeatedly redraw the specified screen (as it is part of the video menu system), making it impossible for you to write on. In fact, if you write data to one of these screens, it will probably be immediately overwritten and never be seen.
bulletWhen you're first creating your own screens, you'll probably run into this problem. Either when you first run the schedule, or when you try to display the menu system, you'll see the screen start flickering or alternating between two screens. What's happened is that one of the periodic events that draw your screens is enabled at the same time as the built-in menu system is active. Since both repeatedly write to the screen, they overwrite each other, resulting in a mess.

If you entered the power failure recovery action we recommended, you can remove and reapply power to stop this. However, you'll need to figure out where you went wrong and correct it. Check the periodic events in your schedule and make sure they are disabled (note that when you close the actions entry screen, the periodic event will be enabled automatically, so this is a common source of this problem).

bulletYou can use an If-Then statement to determine what to write to the screen. For example, you could look at the state of a flag to determine the security system status to display, like this:
   Video: Display text 'System is '        {note blank space at end}
   If
      Flag #1 (Security System State) is set
   Then
      Video: Display text 'armed   '       {note 3 blank spaces at end}
   Else
      Video: Display text 'disarmed'
   End If                    

If the status changes while you're watching the screen, you'll see it change. When doing this, be sure that the possible text values are the same length. That way, they completely overwrite what was previously on the screen. In this example, consider what could happen if 'armed ' did not contain 3 blank spaces at the end. If the system was initially disarmed, then got armed while displaying this screen, the word 'armed' (without the blanks) would not completely overwrite the word 'disarmed', resulting in:

   System is armedmed                      

being displayed. By putting the three blank spaces at the end, we completely overwrite the previous value.

bulletRefer to the file "Screens" on the HomeVision installation disks for more information on the video screens. It includes a complete listing of the built-in screens and their numbers.

 

Conclusion

You can use these methods to create virtually any screen you want. With some work and creativity, you can create screens to:

bulletShow your own menu system (bypassing the built-in system entirely if you like).
bulletPerform your favorite macros.
bulletPlay different radio stations.
bulletList the compact disks in your 300 disk changer by title and play the selected one.
bulletReport the last few times the security system was armed and disarmed.
bulletShow status of your home (alarm status, thermostat mode, house mode, # of phone calls since you last left home, etc.)
bulletDisplay weather information (from a directly-connected weather station or downloaded over the serial interface from your PC).

Good luck and have fun!

 

Back Up Next

Last updated:
19 June 2012

Copyright 1996-2012, all rights reserved, by:
Custom Solutions, Inc.
1705 Canterbury Drive, Indialantic, FL 32903

HomeVision is a registered trademark of Custom Solutions, Inc.

Web Browser Picture Gallery Viewer