Any strings coming in from your SIMPL program on this input will be qued up in a buffer. In this case, (and IMHO, most) this isn't a problem.īUFFER_INPUT rx$ - this one is special. We won't get into the volatile/non-volatile discussion here - suffice it to say that any variables we declare will not retain their value through a power outtage. #DEFAULT_VOLATILE - this means "when I declare a variable for storage, use memory from the processor's large available pool of volatile memory, not the limited amount of non-volatile memory". #SYMBOL_NAME is simply a constant - this is the name that eventually appears in your Symbol library.
#Crestron simpl dimmer example code
We're about to add some functional code to our SIMPL+ module, but let's just look at the few lines we have already: (I tend to do this when creating modules - before adding any real code to them - in order to make sure I've declared ALL of the signal connections I need to bring in from and take back out to SIMPL) You don't have any added functionality yet, but the point is that you can get your S+ module to a point where it can be integrated into your SIMPL program VERY easilly - if for no other reason than to have points to "land" all the signals you need from the SIMPL program onto the module. Double-click it from there, Alt-Plus all the outputs, and now you can drop all the signals you want from your SIMPL program, and even go ahead and compile it!Īs you can see, your program is ready to load right this second if you wanted. You can now pop back over to SIMPL, open your Symbol Library pane, expand User Modules, then - All User Modules -, and you'll be able to drag Autopatch Parse Test into your logic folder. If we go ahead and save this file as Autopatch Parse Test, then select Build -> Save And Compile, (or just hit F12) you'll see that our four-line module is A-ok as far as the compiler is concerned: In the window that comes up, just go ahead and delete all the text, and add these lines:ĪNALOG_OUTPUT audio_stat, video_stat Īside from coloring, your screen should look something like this: When the SIMPL+ editor appears, we want to select File -> New -> New SIMPL+ Module. To start out - in SIMPL, we'll go File -> New SIMPL+. That leaves us with the need to create 8 analog signals in our SIMPL program - 4 for audio, 4 for video. For the sake of simplicty, we're going to say that we're using an Autopatch half-Y 12x4 switcher. We want both audio and video status, as our system application calls for the possibility of breakaway routes. So given the strings coming in from the switcher, we want a set of analog values in our SIMPL program to reflect which input is currently routed to which output.
We've now been tasked with the requirement that we obtain feedback from the unit to acknowledge our commands AND let us know if a user has simply gone up to the front panel of the switcher and manually done a route.
Let's assume that we've already got a program going that uses the autopatch BCS protocol to initate routes. For example, the string "CL2I3O4T" coming in the com port tells us that the switcher has just routed only the video (level 2) from input 3 to output 4. T - for "take" is the delimiter used by Autopatch to represent the end of a command. In this case, x represents the "level" being switched - for a basic audio/video switcher, x represents a route on the audio level, 2 the video level, and 0 represents an audio follow video route. For part 1 of this example, we're going to work with responses to the Autopatch route command, which comes in this format: "CLxIyOzT". Two good things about Autopatch - a) The protocol is the same across all of their products, and b) operations done from the front panel create the exact same command strings as those sent across the RS232 connection. For this example, we're going to use the protocol for an Autopatch matrix switcher. A request was made in the Crestron discussion forum for some help with parsing strings in SIMPL+.