Data.Text help
prakash
Posts: 33
Hi all,
Can anyone please explain how to know, what i am getting in data.text buffer? And from where i can get all the properties of data.text?
Sent from my Nexus 4 using Tapatalk
Can anyone please explain how to know, what i am getting in data.text buffer? And from where i can get all the properties of data.text?
Sent from my Nexus 4 using Tapatalk
0
Comments
Sent from my Nexus 4 using Tapatalk
http://www.amx.com/techsupport/techNote.asp?id=616
this is it: It's a global structure and holds the current or last incoming string if nothing is current of all input buffers. Netlinx is single thread so only one event can be processed at a time.
It should only be used in a device's data_event or a function called by one. Use a send_string 0 to print what is being received in each data.event and add into your send_string 0 a description of what that event is so you know what you're looking at in diagnostics.
Again it can only be guaranteed to have the data you're expecting when used inside a data event handler or function it immediately calls for any given device you're expecting data from so don't use it anywhere else.
It only exists and is expected to contain relevant data while inside the string: or command: sections of a data event, which is only a few milliseconds.
If you want to debug strings you can use 1 of these 3 methods. (There are more ways, but I'm not teaching the whole class here.)
1) Use send_string 0 to see the strings in diagnostics or telnet:
2) Assign it to a variable and watch that (add cData to your debug variables):
3) Create an actual serial buffer and watch that instead (add cBuffer to debug list):
I usually prefer the 3rd option, since there is never any guarantee that the serial string coming in from rs232 is complete. Sometimes, usually on long strings or slow talking devices, there will be more than one string data_event that makes up a complete reply. Using the 3rd method cBuffer will keep collecting the whole string until you remove the data yourself.
For example with messages coming back that are expected to end with carriage return (ascii 13):
I use create_buffer for larger strings like XML, web page scrapes or basically anything where the strings coming back are larger.
From that tech note: