Home AMX User Forum NetLinx Studio

Grabbing Data from a DEV Array

Greetings all,

I have a DEV array of four RS-232 TV tuners (232-STA). I have a [4][15] CHAR array for their messages to the system.

I am trying to get the tuner messages into the four rows of the array without using a seperate DATA_EVENT for each tuner.

dvSTA01 = 11:1:0
dvSTA02 = 12:1:0
dvSTA03 = 13:1:0
dvSTA04 = 14:1:0

DEV dSTA []=
{
dvSTA01,dvSTA02,dvSTA03,dvSTA04
}

DATA_EVENT [dSTA]
{
STRING:
{
STA_MESSAGE[DATA.DEVICE.NUMBER]=DATA.TEXT
}
}

This returns nothing to the array. Is DATA.DEVICE.NUMBER the wrong embedded function for this process? Or am I missing the boat elsewhere?

Thank you.

Comments

  • Grabbing Data from a DEV Array

    In your example, DATA.DEVICE.NUMBER is 11, 12, 13, or 14 and not 1, 2, 3, or 4 which is what you need for your array. Since the array is ordered and since the order matches the order of your devices, use GET_LAST() on the DEV array and then use that as the index into the CHAR[] array.

    You should be seeing a Netlinx runtime error in the current version if you enable diagnostics since the array index should be out of bounds.

    Reese
  • TurnipTruckTurnipTruck Posts: 1,485
    Duhh, obvious one. Thanks for the help.

    Is the method I am using acceptable for larger DEV arrays of, let's say, 10 devices that may put out unsolicited messages? Would messages hitting from two devices at exactly the same time cause a mis-assignment of the data into the array?

    Thanks.
  • jeffacojeffaco Posts: 121
    10 devices is fine. As I recall (at least with button_event's), you get into problems if you have > 1024 devchan combinations. For something like 10 devices, no sweat.

    Data won't stomp on each other. Just remember, though, that with RS-232 communications, you're not assured of "where" in the data stream you get the event. If there's data, you may get the event with half the data. Thus, if the protocol says that you get a "line" of data, your input handler should look for the <CR> at the end of the line and handle it accordingly.
  • Grabbing Data from a DEV Array

    As Jeff said, you will be fine with 10 devices both from the DATA_EVENT and the GET_LAST() perspective.

    The restriction Jeff is referring to (see TechNote 383) applies to CHANNEL, BUTTON, and LEVEL events and apparently not to DATA events (although this is not clear). The maximum number of DEVs you specify for an event trigger is 50 and the maximum number of dev/channel triggers for the events is limited to 4000. If your trigger for a CHANNEL_EVENT had 50 devices, you could have at most 80 channels. Worse, if you specify more than 50 devices, anything over 50 is ignored except that it counts against the 4000 total. If you specified 100 devices in a trigger, only the 1st 50 would have any effect yet the maximum number of channel triggers that would be processed would be reduced to 40. These limits should not be a concern in your particular application.

    Reese
Sign In or Register to comment.