SIMPL+ Best Practice

I just finished watching the videos posted of Toine lecturing at Crestron Masters 2017.  Sadly, this was a session I really wanted to sit in, but the space was reserved for veteran programmers (and this was my first time attending Masters).

He has many good points about how SIMPL+ has many bottlenecks to understand and work with, but one of his talks at the end covered GatherAsync.  He prefaced this section by quickly covering what he considers the best practice for writing a CHANGE event in SIMPL+.

Here’s an example showing the design pattern:

THREADSAFE CHANGE From_Device
{
    String Temp[MAX_LINE_LENGTH];

    While (1)
    {
        Temp = Gather("\r", From_Device);
        MakeString(To_Device, "RX: %s", Temp);
    }
}

This pattern works for 2-series and 3-series processors.  Toine even says he can’t think of a better way to process incoming data from a device.

Normally, SIMPL+ operates at the lowest thread priority.  The Gather function, however, runs at a higher priority so it can quickly service data coming in from devices.  I wanted to pull this one idea out of his talk and put it into a blog post so I could easily remind myself that this is Crestron’s best practice.

What’s In a Name?

Crestron SIMPL Windows uses “named signals” to wire up programming logic.  These signals are referred to as digital (either high or low), analog (a 16-bit number), or serial (a string of characters).  Color is used to distinguish what type a signal is–blue for digital, red for analog, black for serial, green for ambiguous–but otherwise, your only clue about what information a signal carries is left up to its name.

How then should you name your signals?  Let’s look at a few examples and see why they are good choices for signal naming.

Continue reading “What’s In a Name?”