AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual
AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

Programming language
Table of Contents

Advertisement

instruction manual
Axcess
Programming Language
So ft ware

Advertisement

Table of Contents
loading

Summary of Contents for AMX AXCESS CONTROL SYSTEM PROGRAM

  • Page 1 instruction manual Axcess Programming Language So ft ware...
  • Page 2 This warranty extends only to products purchased directly from AMX Corporation or an Authorized AMX Dealer. AMX Corporation is not liable for any damages caused by its products or for the failure of its products to perform. This includes any lost profits, lost savings, incidental damages, or consequential damages. AMX Corporation is not liable for any claim made by a third party or by an AMX Dealer for a third party.
  • Page 3: Table Of Contents

    Table of Contents Table of Contents Introduction .......................1 Device Numbers........................ 1 Video Monitors ........................2 Connecting the System ..................... 2 Blinking Light Status......................3 Axcess Basics ......................5 Format of the Programming Language ................5 Statements and Compound Statements ................5 Comments Within the Program ..................
  • Page 4 Table of Contents Defining mutually exclusive latching ..................21 Defining mutually exclusive toggling ..................21 Putting it all to work ........................ 22 Programming Feedback....................23 Grouping feedback statements ....................23 Device and Channel Keywords ..................24 Define_Combine ........................25 Define_Latching ........................26 Define_Mutually_Exclusive ....................
  • Page 5 Table of Contents Relational Operators ....................... 47 True and false ........................48 Logical Operators ......................49 Bitwise Operators ......................50 Abbreviations........................51 Precedence Among Operators..................51 Operator Keywords ......................52 Bitwise Operator Keywords ..................... 53 Variable Types and Conversions ................55 ASCII Codes........................
  • Page 6 Debugging ......................103 Types of Errors......................103 Compilation Errors and Warnings ................. 103 Run-Time Errors......................105 Using AMX BUG ........................105 Tracking down your errors .................... 106 Tracing program flow ......................106 Viewing Variables......................107 Compiler Error Messages ..................109 The External_Control Protocol ................
  • Page 7 Axcess Keywords ......................126 ASCII Code Chart......................127 Hexadecimal Chart Abbreviations ................. 128 Accessing the AMX BBS ..................129 About Worldgroup Manager ..................129 Installing Worldgroup Manager ..................129 Adding the AMX BBS to the Worldgroup Manager: ............129 Axcess Programming Language...
  • Page 8 Table of Contents Axcess Programming Language...
  • Page 9: Introduction

    Introduction Introduction The Axcess system is a microprocessor-based control system capable of controlling both simple and complex devices, giving you complete control of every device in any system. Through a flexible language, Axcess can be programmed to handle almost any task. It can automatically dim lights, increase volume controls to preset levels, turn on video projectors, and much more.
  • Page 10: Video Monitors

    Introduction As shown in the table above, AMX recommends that all panels, infrared (IR) receivers, and radio frequency (RF) receivers start on device number 128, and that the number increase with each device. All AXB-xxx (boxes) start at device number 96, and increase with each device. The AXB- FD (floppy disk drive) starts at 127 and decreases with each AXB-FD.
  • Page 11: Blinking Light Status

    Introduction Blinking Light Status The green Status LED, on the front of the Central Controller, lights when the Central Controller is plugged in, and power is supplied to the CardFrame. The AXlink LED uses a series of different flash patterns to indicate the status of the control system: •...
  • Page 12 Introduction Axcess Programming Language...
  • Page 13: Axcess Basics

    Axcess Basics Axcess Basics Format of the Programming Language The Axcess programming language is in a free format, meaning that the source code is independent of tabs and carriage returns. Utilize tabs and carriage returns in a consistent method of code placement to make the code readable.
  • Page 14: Comments Within The Program

    Axcess Basics The number of open and closed braces must be the same in your program. After compiling, Axcess will list an error if the numbers are different. PUSH[DEVICE, CHANNEL] (*Input request*) ON [DEVICE, CHANNEL] (*Output command*) X = 5 In this example, when button 1 on PANEL is pressed, relay 5 on RELAY_CARD is turned on.
  • Page 15: Identifiers

    Identifiers are used to denote a device, constant, or variable. For example, T_PANEL could represent an AMX Touch Panel, PLAY could represent the first channel, and CD_SELECT could represent the current compact disc player. There are certain guidelines for identifiers: Identifiers must begin with a letter followed by any combination of letters, numbers, or underscores.
  • Page 16 Axcess Basics 2. Then, it starts at the beginning of mainline, the first line of program code after the DEFINE_PROGRAM header. While executing mainline, the Central Controller processes the statements in the program, taking whatever actions are defined by the program. 3.
  • Page 17: Definition Sections

    Axcess Basics Definition Sections Starting a new program When you begin a new program with the New option in the File menu, there are several definition headings indicating what should be defined in each section: DEFINE_DEVICE DEFINE_CONSTANT DEFINE_VARIABLE DEFINE_LATCHING DEFINE_MUTUALLY_EXCLUSIVE DEFINE_START DEFINE_PROGRAM The program will not operate differently if you do not have any statements under a heading.
  • Page 18: Define_Constant

    AMX encourages the practice of starting control panel device numbers at device 128. This includes radio frequency (RF) receivers, touch panels, softwire panels, and all other control panels and receivers.
  • Page 19: Define_Variable

    Axcess Basics LIGHT_FULL (* LOW VOLTAGE LIGHTING PRESETS *) LIGHT_MED LIGHT_LOW LIGHT_OFF VPROJ_IN_1 = 11 VPROJ_IN_2 = 12 VPROJ_IN_3 = 13 VPROJ_IN_4 = 14 The value of the constant PLAY is now set to 1. Also, STOP has a value of 2. Both of these values cannot be changed anywhere in the program.
  • Page 20: Define_Mutually_Exclusive

    Axcess Basics DEFINE_MUTUALLY_EXCLUSIVE When a channel is turned on in a mutually exclusive set, it activates its physical output as long as the button is pressed. When the button is released, the physical output stops. The status, however, does not work the same way. Even after the physical output stops, the status still indicates the channel is on until another channel in the mutually exclusive set is activated.
  • Page 21: Program_Name

    Axcess Basics Controller gets to the end, it loops back to the top and passes through it again, as shown in FIG. 1 on page 8. PROGRAM_NAME Axcess uses a long file name to provide a more descriptive name for Axcess programs. Thre file name gets embedded into the program the first time it is saved, and will appear in the first line of the program.
  • Page 22 Axcess Basics Axcess Programming Language...
  • Page 23: Using Input And Output

    Using Input and Output Using Input and Output Channels You define what happens when remote inputs occur in mainline. To get inputs into the program, and generate an output, use channels. Almost all methods of control using an Axcess Control System require the use of channels on devices, as shown in FIG.
  • Page 24: Changing The State Of A Channel

    Using Input and Output Input Change Keywords (Cont.) PUSH_DEVICE PUSH_DEVICE is a system variable containing the number of the device hav- ing the channel that was just turned on due to an input change. If a button for device T_PANEL was pressed, PUSH_DEVICE would be equal to the device number of T_PANEL.
  • Page 25 Using Input and Output The output change keywords are described in the table below: Output Change Keywords The ON keyword turns on a channel or variable. If the channel or variable is already on, its status will remain unchanged. Here are two examples: ON [1,2] (* Turns on channel 2 of device 1 *)
  • Page 26: Direct Assignment

    Using Input and Output Direct Assignment Direct assignment is another method of generating an output change, that does not involve using keywords. Any reference to a device-channel that does not have the keywords PUSH or RELEASE preceding it is a reference to the output side of the channel. Thus, assigning a value directly to a device-channel changes the output of the channel.
  • Page 27: Channel Characteristics

    Channel Characteristics Channel Characteristics This section contains information on channel characteristics and how to change the way the status of an output channel behaves. It includes explanations of channel concepts, and examples of Axcess programming code. In this chapter, you will learn how to change the status behavior, which in turn changes the way a channel reacts when it is activated by the output change keywords.
  • Page 28: Mutually Exclusive

    Channel Characteristics button is released), the channel does not go back to OFF (like a momentary channel), it stays ON. It only returns to OFF when the channel is reactivated by a TO keyword. As a result, the status of a latching channel reflects the true ON/OFF state of the channel.
  • Page 29: Defining Mutually Exclusive Latching

    Channel Characteristics Once a channel has feedback in a mutually exclusive group, there will always be one channel with its status on in that group, unless it is turned off with TOTAL_OFF. You will also define the lighting relays as mutually exclusive so that you can utilize last button pressed logic when you program the feedback for these buttons.
  • Page 30: Putting It All To Work

    Channel Characteristics DEFINE_TOGGLING [RELAY,SCREEN_UP] [RELAY,SCREEN_DOWN] Putting it all to work Now that you know how all these different types of channels operate, proceed to the mainline section of the program and add the following lines to activate your system power, screen, drape, and lighting relays: DEFINE_PROGRAM PUSH[TP,8]...
  • Page 31: Programming Feedback

    Channel Characteristics channel. Unlike the DRAPES_OPEN and DRAPES_CLOSE channels, however, the DRAPES_STOP channel turns off when the button is released. Like the others, its status stays on because it is in the mutually exclusive group with the other Drape channels. Programming Feedback This section describes how to assign feedback to a button.
  • Page 32: Device And Channel Keywords

    *) SEND_STRING Ø, "'VCR is online', 13, 1Ø" For a current list of device numbers for Axcess devices, refer to the Devi- ceid.TXT text file, included on the AMX Control Disc. Deviceid.TXT is located in the AMXTools\AMXDOS\Software folder. DO_PUSH This keyword causes an input change from off to on to occur on a specified device-channel without the device-channel being activated by external means.
  • Page 33: Define_Combine

    Channel Characteristics Device and Channel Keywords (Cont.) DO_RELEASE This keyword causes an input change from on to off to occur on a specified device-channel without the device-channel being deactivated by external means. Here is the format: DO_RELEASE (device,channel) If a RELEASE statement corresponding to the device-channel is present in the program, it will be executed.
  • Page 34: Define_Latching

    Channel Characteristics Input and output changes occurring on non-combined panels will not affect combined panels, and vice versa. Define_Latching In this definition section, latching channels and variables are defined. A latching channel is a channel that only changes its state once per PUSH. That is, if a latching channel is activated by a TO keyword, it changes its state;...
  • Page 35: The Variable Assignment Method

    Channel Characteristics The Variable Assignment Method Another method of programming select groups is to use one variable, assigning different values to it depending on what is selected. This method is more powerful than the previous method, providing more flexibility while using less code. You will add just one variable, CUR_CAMERA.
  • Page 36: Sample Program

    A complete example program using a subroutine is given below. Here are the basic requirements for the program: The devices used are one infrared/serial card, three AXB-CAM boxes, and one AMX Touch Panel. The device numbers are 6, 97, 98, 99, and 128, respectively. The IR/serial cards will transmit infrared code to a video projector.
  • Page 37 Channel Characteristics The program is explained step-by-step in the following section. DEFINE_DEVICE VPROJ (* AXC-IR/S: PROJECTOR *) CAMERA_1 = 97 (* AXB-CAM: PAN/TILT *) CAMERA_2 = 98 (* AXB-CAM: PAN/TILT *) CAMERA_3 = 99 (* AXB-CAM: PAN/TILT *) = 128 (* AXU-CVA: COLOR VIDEO PANEL *) The section above defines the five devices used in the program.
  • Page 38 Channel Characteristics Axcess Programming Language...
  • Page 39: Arrays And Strings

    Arrays and Strings Arrays and Strings In this section arrays and strings will be introduced. Understanding these concepts and the associated keywords will allow you to easily handle data, and will provide another means of communicating with the outside world. Defining Arrays In the program developed in the previous sections, you used a variable.
  • Page 40 Arrays and Strings FIG. 7 The value in CAM_PRESETS[3] is assigned to the variable CAM_PRESET_1 You can place values into a storage location by setting the particular location equal to the needed value. For example, CAM_PRESETS was previously defined as having six locations. If you want the second location to hold a value of 6 you would type the following: CAM PRESETS[2]=6 The number 6 is placed into the second location, as shown in FIG.
  • Page 41: Strings

    Arrays and Strings pushes, PUSH [TP, 25] through PUSH [TP,31], are the buttons for PRESETS 1 through 7. Inside the block is an IF statement; the IF statement uses the state of the variable STORE_VOL_PRESET to determine whether to assign the volume card's level to a location in the VOL_PRESETS array, or to send a command to the volume card telling it to go to a previously stored level.
  • Page 42: Arrays As Strings

    Arrays and Strings A string expression cannot contain another string expression; i.e., a set of double quotes cannot enclose another set of double quotes. Assuming that SCREEN_UP is a constant with the value of 1, and X with the value of 10, the string expression is evaluated as a string with values: 1, 5, Ø, 'N', 'O', 1Ø, as shown in FIG.
  • Page 43 Arrays and Strings PRESETS = 'FOUR (* LENGTH = 4 *) PRESETS = 'ONE' (* LENGTH = 3 *) PRESETS = "12,5,'123'" (* LENGTH = 5 *) PRESETS = "PLAY,5,Ø,'NO',X" (* LENGTH = 6 *) The length of a string array cannot exceed the number of storage locations allocated to it in the DEFINE_VARIABLE section.
  • Page 44: Array Manipulation Keywords

    Arrays and Strings DEFINE_PROGRAM TEMP[1] = SCREEN_UP TEMP[2] = 5 TEMP[3] = Ø TEMP[4] = 'N' TEMP[5] = 'O' TEMP[6] = X CAM_PRESETS = TEMP The contents of the array CAM_PRESETS, after this code is executed, depend on the length value of the TEMP variable.
  • Page 45 Arrays and Strings Array Manipulation Keywords (Cont.) FIND_STRING This keyword will search through a string for a specified sequence of charac- ters. When a duplication of the sequence is found, it returns the beginning posi- tion of that sequence. The keywords explained previously are helpful when you know where certain parts of strings are located within a string array.
  • Page 46: Uppercase Vs. Lowercase

    (IDENTIFIER_1 = IDENTIFIER_2) (* This will not be true because 'Fred' and 'FRED' are not the same. *) When programming, you may use whatever capitalizing scheme you wish. As a standard at AMX, we capitalize all keywords and identifiers in the program.
  • Page 47: Sending Strings

    Arrays and Strings Sending Strings To send a string to the outside world, use the SEND_STRING keyword. The syntax is: SEND_STRING device,<string, variable, or string expression> The first value after the SEND_STRING keyword is the device number or identifier to which you wish to send the string.
  • Page 48: String Keywords

    Arrays and Strings Array Keywords (Cont.) MID_STRING Returns the specified number of characters starting at a specified location in the source string. The length value of the array must be greater than 0; the returned value is an array. Syntax: result = MID_STRING (string array, starting position, number of characters) REMOVE_STRING...
  • Page 49: Levels

    Levels Levels Introduction to Levels Devices such as volume control cards, voltage generator cards, and pan/tilt control cards use levels to interface with the outside world. Levels are values related to an analog input or output on an Axcess device. Several Axcess panels have bargraph displays capable of displaying a level. An input/output (I/O) channel in Axcess is usually digital in nature;...
  • Page 50 Levels contain the value of the level with which it is associated. Since this association only needs to occur once, this keyword is only allowed to appear in the DEFINE_START section of your program. In this section, you will develop a new program that handles levels. This system contains a volume control card to control a volume level, and a Touch Panel for the user to control the volume card.
  • Page 51: Level Keywords

    Levels DEFINE_PROGRAM PUSH[TP,17] (* VOLUME UP *) OFF[VOLUME,VOL_MUTE] TO[VOLUME,VOL_UP] PUSH[TP,18] (* VOLUME DOWN *) OFF[VOLUME,VOL_MUTE] TO[VOLUME,VOL_DN] PUSH[TP,19] (* VOLUME MUTE *) [VOLUME,VOL_MUTE] = NOT [VOLUME,VOL_MUTE] [TP,17] = [VOLUME,VOL_UP] [TP,18] = [VOLUME,VOL_DN] [TP,19] = [VOLUME,VOL_MUTE] Notice that the Volume Up and Volume Down buttons will automatically un-mute the volume before starting to ramp the volume up or down.
  • Page 52: Using Levels

    Levels Using Levels Reading Levels When a level is associated with a variable using CREATE_LEVEL, Axcess continually keeps the variable updated with the value of that level. As the user ramps the volume level up, the value in VOL_LEVEL increases. When the volume is ramped up to the maximum, VOL_LEVEL will contain 255, and when the volume is muted, the variable will contain Ø.
  • Page 53: Connecting Levels

    Levels Since this code resides in mainline, it will be executed continually, thus making sure that the bargraph always reflects the value of level number 1 of the volume card. As the volume ramps up, VOL_LEVEL increases and the bargraph fills. As the volume ramps down, VOL_LEVEL decreases and the level indicated on the bargraph also decreases.
  • Page 54 Levels Axcess Programming Language...
  • Page 55: Operators

    Operators Operators Changing and Comparing Values In your Axcess program, you may need to increase the value of a variable, to see if that variable has reached a certain value, or to compare different values to each other. The tools that you use to perform these tasks are called operators.
  • Page 56: True And False

    Operators X = 12 Y = 15 IF (X > Y) (* Statement 1 *) ELSE (* Statement 2 *) Notice that the result of the expression (X > Y) determines the path Axcess takes. Since X is less than Y, Statement 1 is bypassed and Statement 2 is executed. You do not have to specify two paths. However, if there is no ELSE present, Axcess will skip the statement or compound statement underneath the false relational expression.
  • Page 57: Logical Operators

    Operators Logical Operators Logical operators, or Boolean operators, like relational operators produce either true or false result. Instead of using greater or less than signs, logical operators use the following keywords: AND Both conditions must be true for the result to be true. At least one of the conditions must be true for the result to be true.
  • Page 58: Bitwise Operators

    Operators DEFINE_PROGRAM IF (X < 5) X = X + 1 ELSE X = Ø In this case, X acts like a counter. If X does not equal 5, its value is increased by one. Eventually X will equal 5; the Else statement will set it back to 0. Unlike relational operators, logical operators can appear more than once in an expression.
  • Page 59: Abbreviations

    Operators Abbreviations Instead of typing AND and BNOT in your programs, you can use some abbreviations for the logical and bitwise operators. For example, the characters && can take the place of AND, and ~ can replace BNOT. Use the method you are comfortable with; one way is easier to read; the other is faster to type.
  • Page 60: Operator Keywords

    Operators result of this part of the expression is true, becoming the second condition to the AND operator. Since both portions of the AND statement are true, statement 1 executes. X = 2 Y = 7 Z = 12 IF ((X = 2) AND ((Y > 4) OR (Z <= 8))) (* Statement 1 *) Operator Keywords Operator keywords and abbreviations (logical and bitwise) supported in Axcess are listed below.
  • Page 61: Bitwise Operator Keywords

    Operators Bitwise Operator Keywords Bitwise operator keywords and abbreviations supported in Axcess are listed below: Bitwise Operator Keywords BAND (&) Performs a bitwise And operation between two bytes. Each of these bytes can be a constant value, number, or variable. The result of the operation can be tested with an IF statement or assigned to a variable.
  • Page 62 Operators Axcess Programming Language...
  • Page 63: Variable Types And Conversions

    Variable Types and Conversions Variable Types and Conversions ASCII Codes A string is broken up into single letters when placed into a string array. Each storage space returns the letter it is holding when referenced. For the following example, assume that TEMP[3] holds the letter R.
  • Page 64: Conversion Keywords

    Variable Types and Conversions There are certain limitations of integer arrays. If an integer array is assigned to a normal array. Values above 255 are truncated. For more information on truncating values, refer to Definition Sections on page 9. This also happens if an integer array is sent to a device using the keywords SEND_STRING or SEND_COMMAND.
  • Page 65 Variable Types and Conversions Conversion Keywords (Cont.) ITOHEX ITOHEX stands for "integer to hexadecimal". It works in the same manner as ITOA, except that the integer is transformed into a hexadecimal ASCII string. If you substitute the ITOA keywords in the previous example with ITOHEX key- words, this would be the result: STR = ITOHEX(123) (* STR = '7B' *)
  • Page 66 Variable Types and Conversions Axcess Programming Language...
  • Page 67: Two-Dimensional Arrays

    Two-Dimensional Arrays Two-Dimensional Arrays The previous sections described how to group data into arrays and how to manipulate those arrays as single units. This section describes how to group multiple arrays together into one two- dimensional array. Two-dimensional arrays provide greater flexibility and power for more complex applications.
  • Page 68: Retrieving Values

    Two-Dimensional Arrays For example: DEFINE_VARIABLE NAMES[1Ø][3Ø] (* two-dimensional array *) PEOPLE[8][2Ø] (* another two-dimensional array *) ONE_NAME[3Ø] (* one-dimensional array *) A_VALUE (* single-value variable *) DEFINE_PROGRAM A_VALUE = 1Ø (* statement 1 *) ONE_NAME = 'EMMITT SMITH' (* statement 2 *) NAMES[1][1] = 6 (* statement 3 *) NAMES[1][2] = A_VALUE...
  • Page 69 Two-Dimensional Arrays This line of code takes whatever value is in the sixth location of the third row in the two- dimensional array NAMES, and assigns it to the variable VALUE. In the context of the previous examples, VALUE will now contain an E. Only the first index value is used when retrieving a whole row.
  • Page 70 Two-Dimensional Arrays Axcess Programming Language...
  • Page 71: If And The Boolean Expressions

    IF and the Boolean Expressions IF and the Boolean Expressions While your first program may seem complicated, it doesn't show the real power of the Axcess language. At this point, the program is button-for-button. This means that each button has only one function, with no special conditions or considerations.
  • Page 72: The If Statement

    IF and the Boolean Expressions A Boolean expression can have one of two results: true or false. In Axcess, any non-zero value is true, while a zero value is false. When Axcess evaluates a Boolean expression, it assigns a 1 for a true result, and a Ø...
  • Page 73: The Select

    IF and the Boolean Expressions IF (X = 5) IF (Y = 1Ø) (*Statement 1*) ELSE (*Statement 2*) The alignment of the ELSE statement with the IF (X = 5) suggests that they should be associated. The second IF statement in this example is not intended to have an ELSE counterpart. However, Axcess pairs the second IF statement with the ELSE, because the compiler associates the ELSE with the closest IF statement.
  • Page 74: More Boolean Operators

    IF and the Boolean Expressions SELECT ACTIVE (condition) : (*statement*) ACTIVE (condition) : (*statement*) ACTIVE (condition) : (*statement*) ACTIVE (1) : (*default statement*) Here, the last ACTIVE will always be true, and will execute only if all of the conditions of the previous ACTIVES are false.
  • Page 75: Boolean Keywords

    IF and the Boolean Expressions FIG. 21 An example of how a Boolean expression table is used to compare multiple conditions. The Boolean expression tables in FIG. 22 are a quick reference guide for the result of a Boolean expression. FIG.
  • Page 76 IF and the Boolean Expressions Boolean Keywords (Cont.) IF...ELSE The IF...ELSE statements are similar to the basic IF statement, with the addi- tion of an alternative instruction. If the expression is false, Axcess executes a statement independent of the true expression. For example: IF (expression) (* Statement 1 *) ELSE...
  • Page 77: While Keywords

    While Keywords While Keywords This section decribes the While keywords (WHILE, MEDIUM_WHILE, and LONG_WHILE). WHILE The WHILE family of keywords allow the program to loop through a certain section of a program until a condition becomes true. If the condition is false, Axcess skips the statements immediately following the WHILE.
  • Page 78: While Keywords

    While Keywords While Keywords While Keywords WHILE Axcess checks to see if the condition following it is true, then either executes statements within the WHILE statement, or continues to the next statements in the code. Example: DEFINE_VARIABLE RELAY_INDEX (* FOR TURNING ON RELAYS *) DEFINE_PROGRAM RELAY_INDEX = 1 WHILE (RELAY_INDEX <= 14)
  • Page 79 While Keywords While Keywords (Cont.) LONG_WHILE In cases where a WHILE loop takes longer than one half-second to execute, change the WHILE keyword in question to a LONG_WHILE. You must provide a way out of your LONG_WHILE (by allowing the condition to become false), the program will become stuck inside the LONG_WHILE and no other code outside of the loop will be executed.
  • Page 80 While Keywords Axcess Programming Language...
  • Page 81: Using Buffers

    Using Buffers Using Buffers Communicating to the Outside World One of the most powerful features of Axcess is its ability to send and receive any combination of values using RS-232, RS-422, RS-485, PA-422, MIDI, and a variety of other formats. You have the ability to construct any combination of numbers and characters with the string expression and send it to an external device.
  • Page 82: Retrieving Characters

    Using Buffers If the buffer is full when a character needs to be inserted into it, Axcess drops the first character and shifts the contents of the buffer to the left, and inserts the new character at the end of the buffer, as shown in FIG.
  • Page 83 Using Buffers Getting the data out of the buffer as soon as it enters is usually a two-step process, as shown in this example: DEFINE_PROGRAM IF (LENGTH_STRING(SWT_BUFFER)) TEMP_CHAR = GET_BUFFER_CHAR(SWT_BUFFER) IF (TEMP_CHAR = 'T' || TEMP_CHAR = '.') SEND_STRING Ø,"'SWITCH COMMAND COMPLETE',$ØD,$ØA" These two lines of code are actually one IF statement.
  • Page 84: Buffer Keywords

    Using Buffers REMOVE_STRING will remove all characters up to and including the 'T' or the '.'. So if the SWT_BUFFER contained a 'CI1O1T', then after the line of code: TRASH = REMOVE_STRING(SWT_BUFFER,'T',1) TRASH would be equal to 'CI1O1T'. Once the proper response from the switcher is verified, it Axcess prints out the message SWT ACK to the terminal.
  • Page 85 Using Buffers Buffer Keywords (Cont.) GET_BUFFER_CHAR It has a two-part operation: THIS keyword is used to remove • First, it retrieves the first character in the buffer for your own utilization. characters from a buffer. This creates the same effect as if you retrieved the first storage location of a normal string array.
  • Page 86 Using Buffers Axcess Programming Language...
  • Page 87: Waits And Timer Keywords

    Waits and Timer Keywords Waits and Timer Keywords Controlling Time in Axcess There are several of timing keywords available in Axcess. Functions can be delayed for a few seconds, or they can be delayed until certain conditions are right. The built-in stopwatch allows you to measure time intervals between operations in your program.
  • Page 88 Waits and Timer Keywords DEFINE_PROGRAM PUSH[TP,8] (* POWER ON/OFF *) IF ([RELAY,RACK_POWER]) CANCEL_WAIT 'AMPS ON' OFF[RELAY,AMP_POWER] WAIT 1Ø 'SYSTEM OFF' OFF[RELAY, RACK_POWER] ELSE CANCEL_WAIT 'SYSTEM OFF' ON[RELAY, RACK_POWER] WAIT 1Ø 'AMPS ON' ON[RELAY,AMP_POWER] Notice the organization of the above set of statements. Here is a simplified outline of the structure of this code: PUSH[TP,8] IF (device-channel)
  • Page 89: Multiple Waits

    Waits and Timer Keywords Multiple Waits At this point, the System Power button completes two events, with a delay in between. In many cases, you may want to initiate a series of several events by pressing one button. In this section, you will make the System Power button accomplish several more things when the power is turned on and off.
  • Page 90: Naming Waits

    Waits and Timer Keywords Naming Waits When a WAIT is given a unique name, it can be either canceled, paused, or restarted. To name a WAIT, place a name in single quotes after the WAIT statement. For example: WAIT 3Ø 'DELAY' There are certain considerations in naming WAITs: They should not be previously defined constants or variables.
  • Page 91: Special Uses Of Wait

    Waits and Timer Keywords In this example, Axcess waits 20 seconds, turns on the Screen Up relay, waits 20 more seconds, then turns off the Screen Up relay. Any timed sequence of events can be accomplished with or without nested WAITs. In many cases, using nested WAITs is more readable than non-nested WAITs Special Uses of Wait A WAIT time of Ø...
  • Page 92: Naming And Removing Wait_Untils

    Waits and Timer Keywords It is not necessary to use WAIT_UNTIL in your program yet, but the following program segment illustrates the possible misuse of WAIT_UNTIL: DEFINE_PROGRAM WAIT_UNTIL (Y = 4) X = Ø Y = Ø Y = 4 Y = 3 In this example, Y will never equal 4 at the end of mainline.
  • Page 93 Waits and Timer Keywords Timer Keywords (Cont.) GET_TIMER Usually this keyword is used in conjunction with an IF statement, as shown in the following example: The GET_TIMER system variable contains the current DEFINE PROGRAM status of the timer. IF (GET_TIMER >= 1ØØ) SEND_STRING Ø,"'TIMER VALUE IS = 1ØØ',$ØD,$ØA"...
  • Page 94 Waits and Timer Keywords Axcess Programming Language...
  • Page 95: Using Time, Date, And Day

    Using Time, Date, and Day Using Time, Date, and Day The system variables TIME, DATE, and DAY can be used to create timing functions. TIME contains the current time in the form of the string HH:MM:SS, in which HH equals hours, MM equals minutes, and SS equals seconds.
  • Page 96: Time, Date, And Day Keywords

    Using Time, Date, and Day Time, Date, and Day Keywords Time, Date, and Day Keywords DATE The wildcard character ? is allowed for string comparisons. For example: The system variable DATE IF (DATE = '12/25/??') returns the current date in the form of the string MM/DD/YY, (* These statements are executed every Christmas *) in which MM equals month,...
  • Page 97: Using Subroutines

    Using Subroutines Using Subroutines In larger programs, you may want to break the program into smaller, more manageable parts called subroutines. A subroutine is a section of code that stands alone and can be called from anywhere else in the program. The most common usage of subroutines is to execute the same group of instructions from different places in the program.
  • Page 98: Local Variables And Parameters

    Using Subroutines Local Variables and Parameters Two features that expand on the functionality of subroutines are local variables and parameters. Using these features can help simplify your programs, add more power to your code, and make your program easier to read and understand. Local Variables The first of these two features is the local variable.
  • Page 99: Passing Values Back To The Caller

    Using Subroutines DEFINE_CALL 'DO SWITCH' (CARD,INPUT,OUTPUT) SEND_STRING CARD,"'CI',ITOA(INPUT),'O',ITOA(OUTPUT),'T'" This subroutine is defined as having 3 parameters, CARD, INPUT and OUTPUT (enclosed in parentheses), which are essentially local variables of the subroutine. These variables, however, have their initial values set by the parameters in the CALL statement which called the routine. Here is a CALL to this subroutine: DEFINE_PROGRAM PUSH[TP,49]...
  • Page 100 Using Subroutines When the subroutine SQUARE is called with a variable as a parameter (in this case, X), a series of events occurs. The value of the variable (in this case, 5) is assigned to NUMBER. The subroutine takes the parameter, multiplies it by itself (squaring it) and assigns the result back to itself.
  • Page 101: Local Variables And Parameter Keywords

    Using Subroutines Local Variables and Parameter Keywords The Local Variables and Parameter keywords supported by Axcess are described below: Local Variables and Parameter Keywords CALL For example, to execute the subroutine LIGHTS OFF, type the following where you want the CALL to occur: To tell Axcess to execute a subroutine, use the CALL CALL 'LIGHTS OFF'...
  • Page 102 Using Subroutines Axcess Programming Language...
  • Page 103: Include Files And System_Calls

    Include Files and System_Calls Include Files and System_Calls Managing Large Programs Include files and SYSTEM_CALLS are important in managing large programs, and in simplifying basic programming. Include files allow you to break a large program into smaller, more manageable files. SYSTEM_CALLS provide ready access to pre-canned programming solutions and tools, without having to rewrite them.
  • Page 104: System_Calls And Library Files

    Include Files and System_Calls Place each definition section in its own include file Group sections of the main program into include files Place all subroutines into an include file Place routines that you want to share between multiple programs into an include file Place code you wish to re-use in other systems into include files Include files are loaded and edited using the Axcess editor much like normal program files.
  • Page 105: Factory System_Calls

    Newcalls.TXT and Camcalls.TXT on the AMX Control Disc, or check the AMX BBS. For information on accessing the AMX BBS, refer to Worldgroup Readme on the Control Disc, or refer to the Accessing the AMX BBS section of this manual.
  • Page 106 This subroutine takes three parameters. The purpose of the subroutine is to send the two strings to the device specified in the parameter variable CARD, with a delay of 2 seconds between sends. The following line will send the string 'AMX', followed 2 seconds later by the string 'Axcess' to SWT, defined as card 3: SYSTEM_CALL 'SEND' (SWT1,'AMX','Axcess') This code compiles and works fine.
  • Page 107 Include Files and System_Calls The number in the brackets is the instance number. The instance number tells the compiler to compile multiple copies of the routine, and have the different SYSTEM_CALLs each call a separate copy. The compiler does this by using the instance number to modify the actual name of the DEFINE_CALL before compiling it.
  • Page 108 Include Files and System_Calls Axcess Programming Language...
  • Page 109: Pre-Processor Statements

    Pre-Processor Statements Pre-Processor Statements Pre-Processor Statements supported by Axcess include the Include File and System_Call Keywords, described below: Include File and System_Call Keywords INCLUDE When the compiler reaches the INCLUDE statement, it jumps to the specified file and continues compiling. When it has reached the end of that file, it comes back to the line following the INCLUDE statement and continues compiling.
  • Page 110 Pre-Processor Statements Include File and System_Call Keywords (Cont.) #WARN Its purpose is to remind the user of certain conditions that were placed in the program. For example: This compiler directive key- word forces a warning mes- #WARN 'This is obsolete code' sage to be displayed after the #End_If program is compiled.
  • Page 111: Debugging

    Debugging Debugging No programs are ever written without errors on the first try, and one of the most time-consuming parts of programming is debugging. Use this section as a reference to help minimize this process. Types of Errors There are three general types of programming errors: Compilation errors: Errors that occur at compile time.
  • Page 112 • Assigning the result of a function that returns a non-array type to a one- or two-dimensional array variable (for example, X = ATOI('AMX'), where X is a one- or two-dimensional array variable). This message is a warning and not an error, because X = ITOA(12) works correctly when X is a simple variable, since the result is a single value between Ø...
  • Page 113: Run-Time Errors

    These errors occur in the Central Controller, usually when it could not perform a particular operation in the program. Using AMX BUG Normally, there is no way to tell if a run-time error occurred, or what type of run-time error occurred.
  • Page 114: Tracking Down Your Errors

    ARY[X] = 123 (* This will cause an error *) SEND_STRING Ø, "'...AFTER', $ØD, $ØA" The resulting output from the Central Controller would look like this if the AMX BUG is on: BEFORE...BAD ELEMENT ASSIGN BYTE ARRAY ...AFTER By using the SEND_STRING statements, you can determine that the array assignment is causing the run-time error message.
  • Page 115: Viewing Variables

    Debugging Viewing Variables There are two ways to view the values in variables as a program is executed. You can use the SEND_STRING Ø method to display a variable's value at certain points in a program, or you can use the variable watch window. The variable watch window is accessed through the Diagnostics menu, and it can only be activated if there is a compiled program loaded in the computer and Central Controller.
  • Page 116 Debugging <F7> - Toggles the Step mode between run and single step mode. In run mode, the system program is executed normally in the Central Controller. In single step mode, program execution is suspended between each pass through mainline. <F8> - In single step mode, this key causes mainline to be executed once. This key only functions in single step mode.
  • Page 117: Compiler Error Messages

    Compiler Error Messages Compiler Error Messages This section lists all of the messages that can occur when there is an error during the compilation of your program. Unlike warnings, errors must be corrected before your Axcess program can be executed. Compiler Error Messages Error Description...
  • Page 118 Compiler Error Messages Compiler Error Messages (Cont.) Library file not found The library file containing the specified SYSTEM_CALL could not be found. Maximum string length exceeded String literals are limited in length to 132 charac- ters, including spaces. Must be char array reference An array type variable was expected in CREATE_BUFFER, CREATE_MULTI_BUFFER, or CLEAR_BUFFER.
  • Page 119 Compiler Error Messages Compiler Error Messages (Cont.) Too few parameters in Call There are not enough parameters being passed to the subroutine. Too many include files A program may only contain up to 20 include files. Too many parameters in Call There are too many parameters being passed to the subroutine.
  • Page 120 Compiler Error Messages Axcess Programming Language...
  • Page 121: The External_Control Protocol

    The External_Control Protocol The External_Control Protocol Controlling Axcess from the Outside Not every Axcess system is controlled by control panels; sometimes the control comes from another device, such as a computer (via modem, if necessary) or another Axcess system. To facilitate this, Axcess supports a simple serial communications protocol that allows every Axcess function to be controlled from an outside source via an AXC-232 RS-232/422 Control Card or RS- 232 port on another Axcess control system.
  • Page 122: Responses From Axcess

    The attention byte remains the same as before, but the command changes to $Ø4, to tell Axcess to send a string. The device number is next, followed by the number of bytes comprising the string-in this case, 3. The hexadecimal values for each letter of AMX is next, and the packet ends with the checksum.
  • Page 123: External_Control

    The External_Control Protocol This is the exact packet as sent previously with the exception of a different attention byte; it is $26 because this is a response. If you don't want these responses to appear, you can turn them off by sending the RESPONSE MASK command (11) with the appropriate mask byte.
  • Page 124 The External_Control Protocol Axcess Programming Language...
  • Page 125: Appendix

    1. Keep pertinent job information in a consistent order in the program name. Standard: PROGRAM_NAME='AMX Ø1, BOARDROOM, SO#99999, REV2, FA/BETA' (* DEALER ID, JOB NAME, SO#, REV#, AUTHOR'S INITIALS *) When naming Axcess or Touch Panel files, indicate that the file requires Extended Memory by following the job name with "(EXT.MEM)".
  • Page 126 Appendix Standard: PROGRAM_NAME='AMX01, BOARDROOM, SO#99999, REV2, XXX/BETA' (* DATE:04/08/95 TIME:01:23:45 (* SYSTEM TYPE: ENHANCED MASTER V3.500 (*********************************************************) (* REV2: ADDED EL+ FIXED PROJ POWER GETTING OUT OF SYNC (* REV1: CHANGED IR CODES FOR TUNER (*********************************************************) (*********************************************************) DEVICE DEFINITIONS GO BELOW (*********************************************************) DEFINE_DEVICE 5.
  • Page 127 - CONTROL ROOM PANEL *) 7. List all devices in numerical order in the DEFINE_DEVICE section, using descriptive names. In a comment after the device definition, put the actual AMX model number and describe what equipment will be connected. Not recommended:...
  • Page 128 Appendix Standard: DEFINE_DEVICE (* devices here *) DEFINE_COMBINE (* makes things more obvious *) DEFINE_CONSTANT (* constants here *) 10. Include files should be listed after all DEFINE_CALLs and before DEFINE_START. Standard: DEFINE_CALL 'IMPORTANT STUFF' (* IMPORTANT STUFF CODE *) INCLUDE 'MORECODE.AXI' (* CONTAINS CODE THAT (* DOES VARIOUS THINGS *)
  • Page 129 Appendix 13. Every command should be on its own line. Not recommended: OFF [RELAY,1] OFF [RELAY,2] WAIT 30 'STOP DECK' OFF [RELAY,3] Standard: OFF [SYS_PWR,1] (* SYSTEM POWER OFF *) OFF [AMP,AMP_PWR] (* AMP POWER OFF WAIT 30 'STOP DECK' OFF [VCR,VCR_STOP] 14.
  • Page 130 Appendix 16. No line should extend beyond the edge of the screen, and multi-line commands should be aligned. Not recommended: IF(SYSTEM_POWER AND(SYSTEM_POWER AND([INPUT,TV_POWER]OR IN | CALL 'CHANGE CHANNEL' (TUNER,CHANNEL) [TP,169]=SYTEM_POWER AND ([INPUT,TV_POWER] OR [(INPUT,VCR_| Standard: IF(SYSTEM_POWER AND (SYSTEM_POWER AND ([INPUT,TV_POWER] OR | INPUT,VCR_POWER]))) CALL 'CHANGE CHANNEL' (TUNER,CHANNEL) [TP,169] = SYTEM_POWER AND ([INPUT,TV_POWER] OR...
  • Page 131 Appendix Not recommended: PUSH[TP,25] TO [RELAY,3] (* LIGHTS OFF *) [TP,25]=[RELAY,3] SYSTEM_CALL [1] 'VCR1' (VHS,TP,1,2,3,4,5,6,7,0,0) PUSH[TP,26] TO [RELAY,4] (* LIGHTS ON [TP,26]=[RELAY,4] Standard: (* TRANSPORT CONTROL ***************************) SYSTEM_CALL 'VCR1' [1] (VHS,TP,1,2,3,4,5,6,7,0,0) (* LIGHTING CONTROL ****************************) PUSH[TP,26] TO [RELAY,4] (* LIGHTS ON [TP,26]=[RELAY,4] PUSH[TP,25] TO [RELAY,3]...
  • Page 132 Appendix Standard: (* LIGHTING CONTROL ****************************) PUSH[TP,25] TO [LIGHTS,LIGHTS_ON] (* LIGHTS OFF *) PUSH[TP,26] TO [LIGHTS,LIGHTS_OFF] (* LIGHTS ON [TP,25]=[LIGHTS,LIGHTS_ON] [TP,26]=[LIGHTS,LIGHTS_OFF] Also acceptable: (* LIGHTING CONTROL ****************************) PUSH[TP,25] TO [RELAY,3] (* LIGHTS OFF *) [TP,25]=[RELAY,3] PUSH[TP,26] TO [RELAY,4] (* LIGHTS ON [TP,26]=[RELAY,4] 24.
  • Page 133 27. List any PUSH_CHANNEL ranges used in the program above the DEFINE_DEVICE section. Include the section comment so it can be found later using the 'SEARCH' command (ALT+S). Standard: PROGRAM_NAME='AMXØ1, BOARDROOM, SO#99999, REV2, XXX/BETA' (* DATE:Ø4/Ø8/95 TIME:Ø1:23:45 (* SYSTEM TYPE: ENHANCED MASTER V3.5ØØ...
  • Page 134: Axcess Keywords

    Appendix DEFINE PROGRAM (* KEYPAD *) IF(PUSH_CHANNEL>=8Ø AND PUSH_CHANNEL<=89) (* CODE TO EXECUTE GOES HERE *) Axcess Keywords Keywords are certain identifiers that are reserved for Axcess commands, functions, and system variables. These are integral to the system and cannot be redefined or used as identifiers. The table below contains an alphabetical list of the Axcess keywords.
  • Page 135: Ascii Code Chart

    Appendix ASCII Code Chart FIG. 32 lists the hexadecimal values for all ASCII characters. FIG. 32 ASCII Code Chart Axcess Programming Language...
  • Page 136: Hexadecimal Chart Abbreviations

    Appendix Hexadecimal Chart Abbreviations The following table defines the abbreviated terms in the ASCII chart. Hexadecimal chart abbreviations ACK Acknowledge Form feed Bell File separator Backspace Group separator CAN Cancel Horizontal tab Carriage return Line feed DC1 Device control 1 NAK Negative acknowledge DC2 Device control 2 NUL Null...
  • Page 137: Accessing The Amx Bbs

    About Worldgroup Manager Worldgroup Manager is a Windows application designed to provide an intuitive, graphical user interface to the AMX BBS. The software is easily installed on your PC from the Control Disc. Installing Worldgroup Manager Find the folder (directory) named WorldGrp on the Control Disc. Inside you will find the file, SETUP.EXE.
  • Page 138 AMX technical support to get your account updated properly. 6. Click on OK to close the Online Service Properties dialog box. 7. Set up the AMX BBS in the Online Service Properties dialog for internet (telnet) connection. a. Type AMX BBS in the name field b.
  • Page 139 Boolean Expressions 63 A "" was expected 109 Boolean Keywords 67 Accessing and Storing Array Values 31 ELSE Active keyword expected 109 Allowed only in Define_Start 109 AMX BBS 129 IF...ELSE AMX BUG 105 IF...IF ELSE AND 66 SELECT...ACTIVE Arithmetic Operators...
  • Page 140 Index Constants 10 External_Control 115 Controlling Time in Axcess 79 External_Control Protocol 113 Conversion Keywords 56 ATOI Factory System_Calls 97 INTEGER Feedback 23 feedback statement 23 ITOA ITOHEX GET BYTE LEVEL 114 CREATE_BUFFER 73, 76 GET CHANNEL STATUS 113 CREATE_LEVEL 41 GET DEVICE ID 114 CREATE_MULTI_BUFFER 76 GET LEVEL 114...
  • Page 141 Index Local Variables 90 Passing values back to the caller 91 Local Variables and Parameter Keywords 93 precedence among the operators 51 Local Variables and Parameters 90 Pre-Processor Statements 101 LOCAL_VAR 93 Program_Name must be on line 1 110 Logic errors 103 Programming Feedback 23 Logical Operators PULSE 113...
  • Page 142 Strings 33 Unrecognized character in input file 111 Subroutine may not call itself 110 Uppercase vs. Lowercase 38 Subroutines 89 Using AMX BUG 105 Syntax error 110 Using Levels SYSTEM_CALL 101 Connecting Levels System_Call name not same as Program_Name in 110...
  • Page 143 Index Axcess Programming Language...
  • Page 144 AMX reserves the right to alter specifications without notice at any time. brussels • dallas • los angeles • mexico city • philadelphia • shanghai • singapore • tampa • toronto* • york 3000 research drive, richardson, TX 75082 USA • 469.624.8000 • 800.222.0193 • fax 469.624.7153 • technical support 800.932.6993...

This manual is also suitable for:

Axcess

Table of Contents