Crestron Programming Software

 admin  

.  Crestron SIMPL+ Software Programming Guide. This document was prepared and written by the Technical Documentation department at: Crestron Electronics, Inc.

This is a list of what you will need to begin and finish this Crestron Programming Tutorial. How to program a Crestron control system for the. Crestron Software. PepperDash is the leading provider of Crestron and AMX programming services that enable organizations to better leverage their AV/IT technology investments. Authorized Crestron programming and design support for all markets.

15 Volvo Drive Rockleigh, NJ 07647 1-888-CRESTRON All brand names, product names and trademarks are the property of their respective owners. ©2003 Crestron Electronics, Inc.  Crestron SIMPL+ Contents  SIMPL+ Introduction. 1 What is SIMPL+? 1 For Whom is this Guide Intended? 1 Using SIMPL vs.

2 What is Needed to Use SIMPL+? 2 Where Can I Get More Information? 2 Quick Start.

Compiler Errors. 50 Run-time Errors. 50 Debugging with Print. 51 Software License Agreement. 52 Return and Warranty Policies.

54 Merchandise Returns / Repair Service. 54 CRESTRON Limited Warranty. 54 ii.

Contents  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+  SIMPL+ Introduction What is SIMPL+?

SIMPL+ is a language extension to SIMPL Windows but instead it enhances it. With SIMPL+ it is now possible to use a procedural “C- like” language to code elements of the program that were difficult, or impossible with SIMPL alone. SIMPL and when in SIMPL+. The answer of course is not cut-and-dry, and just about any task can be accomplished entirely in one language or the other.

However, the true power of Crestron system programming is unleashed when the strengths of both environments are harnessed simultaneously. (or until it is rebooted). From the skeleton program, find the section of the program that says “Function Main”. Edit it to read the following.

Crestron

Programming Guide – DOC. 5789A Print( “Hello world!” n ); Print( “Crestron people make the difference” n ); Software . 3 SIMPL+. Making it Work This section describes how to make the simple SIMPL+ program written in the last section work inside a Crestron control processor. As was mentioned earlier, SIMPL+ programs cannot run all by themselves.

They must be enclosed inside a SIMPL wrapper.  Crestron SIMPL+ program by clicking on the compile toolbar button or selecting Project Convert/Compile. The compile process automatically recognizes that there is a SIMPL+ module in the program and compiles it along with the SIMPL code (even though it was already compiled when it was saved; SIMPL Windows always recompiles because it must link the modules together with the SIMPL Windows program). Examine the following equivalent program, which uses constant definitions in place of actual numbers.  6. SIMPL+ switcherinput = 3; switcheroutput = 2; // video projector switcherinput = 4; switcheroutput = 2; // video projector  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ #DEFINECONSTANT VCRINPUT 3 #DEFINECONSTANT DVDINPUT 4 #DEFINECONSTANT VPROJOUTPUT 2 PUSH vcrselect PUSH dvdselect Note the use of capital letters for the constant definitions.

This is not required, but it makes it clear to see the difference between variables and constants when reading through a program (but of course is not useful if all caps are used for the rest of the program). Software Crestron-Libraries are provided from Crestron and are contained within the Crestron Database. Variable Declarations Variables can be thought of as storage areas to keep data. When writing all but the most basic of programs, users need to use variables to store values.  Crestron SIMPL+ variables are also available with the INTEGER and STRING datatype. Integers are 16 bit quantities.

For the 2-series control system, 32 bit quantities are supported with the LONGINTEGER datatype. Both INTEGER and LONGINTEGER are treated as unsigned values. Signed versions for both of these datatypes are available by using the SIGNEDINTEGER and SIGNEDLONGINTEGER datatypes. (negative- or falling-edge). For example, the following code sends a string to a camera unit to pan left when the left button is pressed and then send a stop command when the button is released.  10. SIMPL+  Crestron SIMPL+ Programming Guide – DOC.

 Crestron SIMPL+ DIGITALINPUT camup, camdown, camleft, camright; This example assumes that STRINGOUTPUT cameracommand; the camera unit being controlled continues to move in a given direction until a PUSH camleft stop command is issued. Some devices function this way, but others do not. // this code runs when any of // these inputs goes high // this code runs anytime anything // on the input list changes x = 0; // this code executes only once  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ This loop runs continuously for as long as the control system is on.

If a construct like this is used, it is recommended that a ProcessLogic or Delay function in the loop be included to allow the logic processor a chance to handle the rest of the system. If one of these statements is not included, the operating system forces a task switch at some point in time. To understand this, the user must realize what is being seen when looking at the contents of an output variable in a  14. SIMPL+  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ SIMPL+ program. The value of any output is the value of the signal as seen by the outside SIMPL program at that instant. This is critical considering that SIMPL+ does not necessarily “propagate” outputs to the SIMPL program each time they are changed in the program.

Depending upon which operations are perform on a number, the control system decides whether to treat that number as signed or unsigned.  16. SIMPL+  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ When an integer has a value of between 0 and 32767, it is identical whether it is considered signed or unsigned. However, numbers above 32767 may be treated as negative numbers. If they are, they will have a value of x – 65536, where x is the unsigned value of the number. Finally, note that the square brackets were not included after the variable  18.

SIMPL+ a = 100; b = -4; c = a / b; // c = 0 (100/65532) d = a S/ b; // d = -25 (100/-4)  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ name, as was done when it was declared. When assigning a value to a string, that value is always assigned starting at the first character position. It is important to note that the length of the this value does not exceed total length allocated for myString (in this case, 50 characters).

= 0; for (i = 1 to len(argData)) checksum = checksum + byte(argData,i); return (argData + chr(checksum)); // 1-D integer array with 16 elements // 1-D string array with 9 elements  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ The first two examples above define 1D and 2D integer arrays, respectively. The last example looks like it declares a 2D array of strings, yet the comments states that it actually declares a 1D array of strings.

Recall that in “Strings”, it was necessary to define the maximum size of the string in square brackets, which is the same notation used for arrays. Typically, relational operators are used to help control the program flow. That is, test certain conditions and the result determines what happens next.

This is discussed in more detail in “Controlling Program Flow: Branching” on page 24.  22.

SIMPL+  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ Expressions As reading through the later parts of this guide, as well as the latest revision of the SIMPL+ Language Reference Guide (Doc.

5797), the term expression is mentioned in many places. For example, in describing the syntax of the if-else construct, it may. 24. SIMPL+ x = MyInt / 10; print('hello, world!

N'); checksum = atoi(MyString) + 5; // do something here Crestron SIMPL+ // An assignment // A function call /. Assignment using function calls and operators./ Programming Guide – DOC.

 Crestron SIMPL+ Expressions a = 3 b.4 - a/3 One limitation with the if construct, as shown above, is that the code inside the if is run whenever expression1 evaluates as TRUE, but any code after the closing braces runs regardless. // code here executes if // expression = expression1 case (expression2): // code here executes if // expression = expression2 default: // code here executes if none // of the above cases are true  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ Examine an example using the switch-case construct. Perhaps there is a variable that should hold the number of days in the current month. The following example uses switch-case to set the value of this variable. Switch (getMonthNum) Notice that curly braces did not enclose many of the statements in the previous example.

= checksum + byte(someString,i); using the chr function. Note that in this example we only use the low-order byte from the checksum variable./  Crestron SIMPL+ // a trigger signal // the index variable // a 15-element array // event function.  Crestron SIMPL+ while and do-until Loops The for loop discussed in an earlier section is useful for iterating through code a specific number of times.

However, sometimes the exact number of times a loop should repeat is unknown. Instead, it may be necessary to check to see if a condition is true after each loop to decide whether or not the loop should execute again. A function is essentially a more complicated  30. SIMPL+ y = y + x.3 – z.z; if (y = 0) break; y = y + x.3 – z.z; x = x + 1;  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ programming task that has been predefined and given a name.

Crestron Controller Software

Many of the examples in previous sections of this document have used special types of functions called system functions (or built-in functions). To employ system functions, use the following format. The syntax of a SIMPL+ function call is as follows: FUNCTION MyUserFunction( parameter1, parameter2, parametern ) INTEGERFUNCTION MyUserIntFunction( parameter1, parameter2, parametern ) STRINGFUNCTION MyUserStrFunction( parameter1, parameter2, parametern )  32. SIMPL+  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ The FUNCTION keyword is used to tell the SIMPL+ compiler that what follows is the definition of a function and not a function call. The FUNCTION keyword also specifies that there will be no return value for this function. INTEGERFUNCTION and STRINGFUNCTION specify that an integer or string value will be returned as the result of the function.

MyUserFunction1; x = MyUserFunction2( x, 10 ); i = j. 2; k = i – 1; j = i + k; i = 1; j = 2; k = 3;  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ In this program, it should be clear to see that both of the functions defined, as well as the push event, have access to the three global integers i, j, and k. Local variables, on the other hand, can only be accessed within the function in which they are defined.

 36. SIMPL+ localStr = left(var3, 10); STRING leftpart20, rightpart20; leftpart = left(string1,position); rightpart = right(string1,position); string1 = leftpart + string2 + rightpart;  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ String1 = itoa(int1); position = find(“Artist”,CDdata); int3 = max(int1, int2); For clarity, here are some example statements using system functions that do not have return values: Print(“Variable int1 =%d n”,int1); ProcessLogic; CancelWait(VCRWait); It should be clear that, at least as far as system functions go, whether or not a function returns a value depends largely upon what that function is designed to do. = 0; // initialize variable for (i = 1 to len(command)) checksum = checksum + byte(command,i); return(command + chr(checksum)); vcrout = appendChecksum(“PLAY”); vcrout = appendChecksum(“STOP”); Crestron SIMPL+ // calculate the sum //append the byte Programming Guide – DOC. 'MyStringFunctionLib.usl.'

Any number of user libraries can be included within a SIMPL+ module. Special function libraries that are created by Crestron and made available to all customers can be used in a similar manner. The only difference is the use of the #CRESTRONLIBRARY compiler directive in place of #USERLIBRARY. (Function Main). Because of this, the functions, StartFileOperations and EndFileOperations should not be used here. StartFileOperations; if (CheckForDisk = 1) Call ReadMyCompactFlashCard; else if ( WaitForNewDisk = 0 ) Call ReadMyCompactFlashCard; EndFileOperations;  Crestron SIMPL+ Programming Guide – DOC.

 Crestron SIMPL+ DIGITALINPUT readCompactFlashCard; DIGITALINPUT writeCompactFlashCard; INTEGER myInt; LONGINTEGER myLongInt; STRING myStr50; PUSH writeCompactFlashCard PUSH readCompactFlashCard The functions, ReadStructure and WriteStructure, automate the reading and writing of the individual fields within the structure. These functions do not return the number of bytes read or written. INTEGER nNumBytes; StartFileOperations nFileHandle = FileOpen( ' CF0 MyFile.txt', OCREAT ); if( nFileHandle = 0 ) ReadStructure( nFileHandle, myInt, nNumBytes ); Print( “The number of bytes read =%d”, nNumBytes ); FileClose( nFileHandle ); EndFileOperations;  Crestron SIMPL+ Programming Guide – DOC.  Crestron SIMPL+ PUSH startMe It is important to realize that the control system never allows a SIMPL+ program to “lock up” the rest of the system for any significant amount of time.

Thus, whenever a delay function is reached, the control system performs a task switch, meaning that the execution of the current SIMPL+ module stops momentarily as the natural flow through the SIMPL program continues. CancelWait(sysOffWait); // cancel the system off wait event Pulse(2000, screendown); // lower screen for 20 sec. Pulse(9500, liftdown); // lower lift for 9.5 sec.

Wait (1000, sysOnWait1) // 10 second delay Pulse(PULSETIME, vcron); Pulse(PULSETIME, dvdon); Pulse(PULSETIME, lightspre1); Crestron SIMPL+ DESCRIPTION Programming Guide – DOC.  Crestron SIMPL+ // end of push event PUSH systemoff // end of push event Notice that in this example, the CancelWait function was used to cancel any pending waits when the SYSTEM ON or SYSTEM OFF buttons were pressed.

This is analogous to using the reset input on the Delay symbol in SIMPL.  46. SIMPL+ ACTION theString empty “Now is” “the time” “Now is” jukeboxin = 'Artist=Frank Sinatra, Trac' Crestron SIMPL+ theBuffer empty “Now is” “Now is the time” “Now is the time Now is” Programming Guide – DOC.  Crestron SIMPL+ second pass: third pass: If this signal, jukeboxin, were then connected to a STRINGINPUT of a SIMPL+ program, it is likely that the string might not be seen as one complete piece. Thus the artist’s name, the track name, and the album name might not be parsed out for display on a touchpanel. = Find(searchStr,tempStr) + len(searchStr); track = mid(tempStr, startpos, Find(' r',tempStr,startpos) - startpos); searchStr = 'Album='; startpos = Find(searchStr,tempStr) + len(searchStr); album = mid(tempStr, startpos, Find(' r',tempStr,startpos) - startpos); tempStr = '; until (len(jukebox) = 0);  Crestron SIMPL+ Programming Guide – DOC.

 Crestron SIMPL+ This example introduces two new system functions, which are extremely useful for string manipulation, the Find and Mid functions. To search for the existence of a substring inside of another string, use Find. If it is located, the return value of the function is the character position where this string was found. Trying to use a variable that has not been declared, or misspelling a variable. Attempting to assign a value to an input variable (digital, analog, string, or buffer).

Syntax errors  Crestron SIMPL+ Programming Guide – DOC. To determine if a run-time error is occurring in your program, watch the status of the control system's computer port with a program such as the Viewport (available through SIMPL Windows or Crestron VisionTools or some other error message can clue the user in to a problem. Locate the problem by strategically placing Print statements in the code. This Agreement may only be modified by a writing signed by an authorized officer of Crestron.

Updates may be licensed to You by Crestron with additional or different terms. This is the entire agreement between Crestron and You relating to the Software and it supersedes any prior representations, discussions, undertakings, communications or advertising relating to the Software.

“applets” incorporated into the Software), the accompanying media and printed materials, and any copies of the Software are owned by Crestron or its suppliers. The Software is protected by copyright laws and international treaty provisions. Therefore, you must treat the Software like any other copyrighted material, subject to the provisions of this Agreement. CRESTRON shall not be liable to honor the terms of this warranty if the product has been used in any application other than that for which it was intended, or if it has been subjected to misuse, accidental damage, modification, or improper installation procedures.  Crestron SIMPL+ Software This page intentionally left blank.

. 55 Programming Guide – DOC. 5789A SIMPL+. Crestron Electronics, Inc. Programming Guide – DOC.

5789A 15 Volvo Drive Rockleigh, NJ 07647 04.03 Tel: 888.CRESTRON Fax: 201.767.7576 Specifications subject to www.crestron.com change without notice.

Just as the title says. How the heck do you get Crestron's programing software? I have setup an account with them, sent e-mails, and tried calling. I need to get access to it for the school i work. We need to upgrade some of our projectors in our crestron controlled rooms as the new projectors won't be able to be controlled without changing/upgrading the programing. I would love to have the chance to see if I can learn it to save my college the $$$ to do it as we are in a huge budget hole for the forseeable future. Any one have a suggestion on how to get it or apply/buy it?

Thanks for any help you can provide. Crestron software is restricted to the following. 1) Dealers 2) CAIPS 3) A+ Educational Partners Since you are an educational institution you would fall under #3, A+ Partner. You need to apply as a A+ Partner, it not automatic, and you need to work with a Crestron dealer. It would actually be easier for you to go through your current Crestron dealer and have them sponsor your school.

As a Crestron dealer myself, I can sponsor/send anyone to Crestron training or give them access to software. Talk to your Crestron dealer and ask them.

Originally Posted by drewman21 Just as the title says. How the heck do you get Crestron's programing software? I have setup an account with them, sent e-mails, and tried calling. I need to get access to it for the school i work. We need to upgrade some of our projectors in our crestron controlled rooms as the new projectors won't be able to be controlled without changing/upgrading the programing. I would love to have the chance to see if I can learn it to save my college the $$$ to do it as we are in a huge budget hole for the forseeable future.

Any one have a suggestion on how to get it or apply/buy it? Thanks for any help you can provide. AJ Do you have the programming files? If not you will need to rewrite the entire program. Originally Posted by GoGo Delicious Crestron software is restricted to the following. 1) Dealers 2) CAIPS 3) A+ Educational Partners Since you are an educational institution you would fall under #3, A+ Partner.

You need to apply as a A+ Partner, it not automatic, and you need to work with a Crestron dealer. It would actually be easier for you to go through your current Crestron dealer and have them sponsor your school. As a Crestron dealer myself, I can sponsor/send anyone to Crestron training or give them access to software.

Talk to your Crestron dealer and ask them. Well this is too bad. The installer/dealer that we had worked on this and past projects has really boned us. They don't have a policy of giving copies of the programing to us and have erased past installs because the felt they wouldn't need them again.

They won't be willing to get us signed up as a partner as they have us on a hook for any the work that we need to do. It isn't a good situation for us but my bosses don't seem to want to deal with it other than paying out and complaining. How much does it cost for a Crestron Dealer to sponsor a school? I might convince a Dept chair to come up with the money to pay our dealer to get us signed up.

Puts me on the hook for trying to figure it out i guess but it may be better than nothing. Thanks for your help and answers.

Have a good one! Originally Posted by drewman21 How much does it cost for a Crestron Dealer to sponsor a school? I might convince a Dept chair to come up with the money to pay our dealer to get us signed up. Puts me on the hook for trying to figure it out i guess but it may be better than nothing. Thanks for your help and answers. Have a good one! It does not cost the dealer anything.

Crestron

It's up to the dealer if they want to sponsor the client. We have a set of criteria a client has to meet in order for us to sponsor them. Every dealer is different as to if they will sponsor a client, how they go about doing it and what criteria a client has to meet.

Hope that helps. Yes.contact your Crestron rep. See if he can get you in touch with another dealer. If the software is not available, you're starting all over again.

From a timing perspective, you'll need to use an experienced Crestron programmer to get you up and running. Now that you have a working system, get sponsored so the school can move forward.

If the school has a VPN, your 'new' dealer need not be local. As you develop the in-house expertise, that sponsoring dealer can be a mentoring resource (usually not for free but certainly not overly expensive either). Getting someone to come to Fargo in the winter.

That's another issue. I finally got a call back from Crestron direct that let me know we are a A+ partner and that we would be able to get the software from our local Crestron dealer/partner. So I and wait for a few day for our Crestron dealer to see about the software.

When he does call back he lets me know that they don't give out the programing of previous jobs and that they prefer to do programing as it provides work/income for them. I told him I see his point but I would still like to have access to the software as we have hardware that has been mothballed and would be nice to cut my teeth on so to speak. He told me he would make a few calls and see what he could do about getting our staff access to get the software.

So still waiting. The software can be gotten 3 ways(as far as I can tell) one being if your a crestron dealer/installer, you sign up and attend one of Crestron's training sessions, and 3 if you buy enough hardware/programing from a crestron rep for your educational facility. So in my case my school has bought several crestron systems and programing updates for them. We qualify as a A+ partner then. The partners are allowed to have access to the software from their dealer and to some extent skip the other two ways of getting the software. I get that it cuts into their profits but on the other side since we are in such a tight budget year we won't be able to afford new systems and programming from them anyways. If we had to option to buy the hardware and install it ourself that would be a completely different situation.

They don't lose out as much but still can have a some sales if they want to keep us as a customer. If you're a Crestron partner (Dealer, CAIP, or A+), then you'll have a customer # or partner # or something like that. You'll need to find the number, either get it from your dealer, the person in charge of that department, or you may be able to call Crestron and get it. Also - I'm sorry your dealer is railroading you - sounds like you need a new dealer. We actually get very good treatment from our dealers for the most part. Then again, our University does a lot of business with Crestron (we just cut a series of PO's, a large amount of Crestron stuff ordered. Well into 6 figures.) Also, I'd have whoever writes up your bid documents to require that your installers include the source code to the programming, as well as all relevant panel designs, modules, etc.

The integrators may not like it, but if it's in the bid document, they do it or they don't get paid. Also - we've got a few rooms on campus that we don't have source code for.

These were installed before we got our act together in writing bids, or were installed by departments that didn't know what they were doing, and didn't consult us. These rooms bug me to no end, I'm working on reprogramming them all, but our programming backlog is a mile long now. Good luck -Drew Edit.

   Coments are closed