577 - Send_Level Does Not Seem To Be Working
Table of Contents
Question:
Do you ever find that SEND_LEVEL does not behave as expected - it just doesn't send the level when you think it should?
Symptoms and Causes:
SEND_LEVEL is a "smart" command. The master tracks the last level value sent and won't send it again. This is actually a feature - it allows a programmer to put a naked SEND_LEVEL in your code without having to track whether it's changed or not.
For example, you can write:
DEFINE_PROGRAM SEND_LEVEL <device>,<level>,<value>
Instead of:
DEFINE_PROGRAM
IF (<new value> <> <old value>)
{
<old value> = <new value>
SEND_LEVEL <device>,<level>,<new value>
}In Axcess, the master tracks what was sent by line number - each SEND_LEVEL statement is tracked separately. If you have a number of SEND_LEVELs throughout your code, they just may not work because at each specific SEND_LEVEL, the same value was sent as the last time on that particular line.
In NetLinx, the master's device manager tracks what was last sent to a particular level on a device. This allows a bit more flexibility.
Resolution:
In Axcess systems, it is critical that:
- The Device parameter must not be a variable.
- The Level parameter must not be a variable.
- The Value parameter MUST be a variable.
In addition, it is highly recommended that you have only one SEND_LEVEL in your program for each device, level pair. This will be in your DEFINE_PROGRAM section.
For example:
DEFINE_DEVICE
VOL = 96 (* volume device *)
TP = 128 (* touch panel device *)
DEFINE_VARIABLE
TP_L1 (* variable to store touch panel level 1 *)
DEFINE_START
(* tell master to store touch panel level 1 in TP_L1 *)
CREATE_LEVEL TP, 1, TP_L1
DEFINE_PROGRAM
(* send level from tp level 1 to vol levels 1 & 2 *)
SEND_LEVEL VOL, 1, TP_L1
SEND_LEVEL VOL, 2, TP_L1
(* end *)While it is not as critical to program this way in NetLinx, you still need to be aware that if you have sent a particular value to a particular DEVLEV, a send level that sends that same value again will not work until a different level value is sent to the DEVLEV, or until the device goes off-line, and the master realizes the level has reset to 0 (and you're not sending a value of 0).
Table of Contents