The device i'm trying to use the software with needs a pause after each CR+LF before it can process the next line of input. Without a pause only the first command gets processed, all others that come after are disregarded.
See screenshot1. I am able to send the command successfully twice because I use a pause in the cyclic sequence script.
See screenshot2. When i do not use a pause, the device does not know how to interpret the second command and only returns information for the first command.
Ideally, I have a series of registers I wish to pull off the device. The device must take in each command for a register individually, then be allowed to respond, then it will be able to accept a new command.
I hope this is clear enough and I am using the tool in the proper way.
in the attachment you can find a worker script (must be added in the script window) which sends two commands and waits 1s after each command. If you want to process the received data in the script:
- use scriptThread.dataReceivedSignal
- remove scriptThread.stopScript()
I didn't know which kind of commands/data you wanted to sent. Therefore I wanted to show you that you can send strings and byte arrays.
Using bytes has no andvantages if you want to send strings.
Best regards,
Stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Is there a pause command that can be used in a script just like the option in a cyclic sequence?
Hi,
I do not exactly understand what you mean. Can you explain it to me a lit bit more?
Best regards,
Stefan
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
The device i'm trying to use the software with needs a pause after each CR+LF before it can process the next line of input. Without a pause only the first command gets processed, all others that come after are disregarded.
See screenshot1. I am able to send the command successfully twice because I use a pause in the cyclic sequence script.
See screenshot2. When i do not use a pause, the device does not know how to interpret the second command and only returns information for the first command.
Ideally, I have a series of registers I wish to pull off the device. The device must take in each command for a register individually, then be allowed to respond, then it will be able to accept a new command.
I hope this is clear enough and I am using the tool in the proper way.
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Here is screenshot2
Hi,
in the attachment you can find a worker script (must be added in the script window) which sends two commands and waits 1s after each command. If you want to process the received data in the script:
- use scriptThread.dataReceivedSignal
- remove scriptThread.stopScript()
Best regards,
Stefan
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Thanks. I think i almost have it.
This maybe a stupid question. How do you place an carriage return in the script after "Command 1"?
"Command 1\r"
or with bytes:
var data = Array(1,2,3,4,13)//carriage return=13
scriptThread.sendDataArray(data);
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Perfect! Great tool.
I see in your post above theat you have to send CR+LF:
"Command 1\r\n"
var data = Array(1,2,3,4,13, 10)//carriage return=13; line feed=10
scriptThread.sendDataArray(data);
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
actually the \r is working great.
I think I can build my script using the following:
scriptThread.sendString(">682\r")
scriptThread.sleepFromScript(1000);
scriptThread.sendString(">672\r")
scriptThread.sleepFromScript(1000);
scriptThread.sendString(">207\r")
scriptThread.sleepFromScript(1000);
scriptThread.stopScript();
What would be the advantage to using the Array?
I didn't know which kind of commands/data you wanted to sent. Therefore I wanted to show you that you can send strings and byte arrays.
Using bytes has no andvantages if you want to send strings.
Best regards,
Stefan
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Ok thanks.
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Last edit: Anonymous 2017-09-11