EasyManua.ls Logo

Crestron SIMPL+ - Page 291

Crestron SIMPL+
374 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Crestron SIMPL+
®
Software
Language Reference Guide - DOC. 5797G SIMPL+
®
z 281
// temporary buffer. A Command looks like
H{out}{l1}{l2}...{l8}
// {2 byte checksum}{CR}{LF} where {out} and {l1}..{l8} are 3
// digit ASCII bytes with leading zeros. An example is
// H001001002003004005006007008{2 bytes checksum}{CR}{LF}
//
makestring(PESABUF,”H%03d%03d%03d%03d%03d%03d%03d%03d%03d”,
// OUTPUT, LEVEL1, LEVEL2, LEVEL3, LEVEL4, LEVEL5, LEVEL6,
// LEVEL7, LEVEL8);
COUNT=0; // Checksum count initialized to 0.
// Add each byte in the string to the running count.
for(i=1 to len(pesabuf))
COUNT = COUNT + BYTE(PESABUF, I);
// The checksum is computed by taking the COUNT and throwing
// away all but the lower byte. The upper nibble + '0' is the
// high order checksum byte, the lower nibble + '0' is the low
// order checksum byte.
// Compute the low byte of the checksum.
CKSLOW = (COUNT & 0x0F) + '0';
// Compute the high byte of the checksum.
CKSHI = ((COUNT & 0xF0) >> 4) + '0';
// Send the checksum command to the COMMAND$ that gets routed
// to the switcher via the SIMPL program.
makestring(COMMAND$, “%s%s%s”, PESABUF, CHR(CKSLOW),
CHR(CKSHI));
}

Table of Contents