LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffer reading, buffer de lecture

First in g̸̨͕̭̟̻̥͕͙̳͔̬̥̬͈̃̈́̐̐͐̈̒̌̍̀̊͆̐͆̈͑͛͒͌͗͒̓̉̎̈́̒̉͐̀̐̈́̆̃̑̂̿́̏̚̕̕̕͜͜͠͠͠a̸̧̧̡̡̡̛̛͕̝͇̭̪̫̘͇̘͈̣͕͖̜̬͎̘̯̖̻͖̠̤̩̗̣̝͕͙̝̻̰͍̰̖͇͔̱̲͚̹͚̠̟̥̗̞͚͚̭͚͔͎̞̹̝͇̱̗͌͌͆͆̒́̀̍̄̉̊̈́̐̆́͂̈́̄͑́̉͛̓̑̄͑̃̔͂̂̐̉̽͒̓̂̿̅͋̒̍̆͐̌̔̉̓͂̐̒̑̉̆̐̆͒̈̏̐̓̑͆́̀̓̚̕̚̚̚͝͝r̸̡̡̡̡̨̛͎͓͉̦̰̖͚̙̳̯͕̻̬̠̮̣̘̭͙̦͇͍̱̲̮̫̞͖͇̻̹̺͔̼͈̺̰̙͔̮̘̝̝̲̪̹̤͕̲̮͎͔͕͎̂̌̇̅̀̈́͂̉̈͒͆̉̔̓͌̎̈̑́̐͐̋͋̆́̑̐̄̈͒͗̿̔̈́̈͌́̎̔̾̾̕̕͘͘͘͝͝͝͠͝͝͝͠ͅḇ̵̡̧̛̛̭̹͚̯̱̣̖͓̺͍̻̯͍̮̥̼̳͇̼̬̗͖̙̖̻̣͈̙͓̠̼͓̘̦̦͚̰̫͖̜̫̫͔͍̫̂̈͛̓͑̌͂̋̽͗̄̀͛̃̀̏͒͛̀̌̅̈́͗͑͌̓͌͌͑́̈́́̇̇̓́̀̋͋̌͘̚͘͝͝͝ͅa̴̢̡̧̡̧̛̛̼̣̟̻͔̬̫̬̟̟͇̳̳̞̭̥̞̬̣͙̬̤̲͈̝̭̭͈͔̜̣͖̫̳͖̝̖̙̟̬̦̙̫̺͔͇̲͎̟̖͎̝͂͆̄̅̊̎̀͗͒͗̌̓͗̈́̀̄͗͋͆̋̓̈́̈́͌̉̑͐̓͒͑̈̌͑̉͑̽͒̉̂͛̋́̎̐̓͋͐͛̉̓̃͋̇̅̐̈́̀̑̂̍̀̕̕͘͝͝͝͠͝ͅͅg̶̡̨̢̡̙̻͓̤̟̯̯̭̗̠͓̝̟̮̥̮̹̖͙̯̝͖͍̯͙̪̹̹̝̯̲̪͚̦̙̹̰̳̯͙̮̮̼̝͙̣̳̞̮̓̊̈́͂̉́̏̃͐̾̋͒́͂̍̏̀̈́̒̄̒͘͘͜͝͠͝ͅͅͅę̷̢̧̻̞̭͉̮̱̳͉̦͕̠̰̬̝̖̹̞̟͍͕̳̰͉̩̘͚̩͓͉͈̗͔͕̣̳̘̭̘̮͎̂͋̉͑̇̎̄͌̑̄̂̀͒̈̌͂̊̀̈̃͘͘͜͜͠ ̷̨̧̡̝͎̣̝̱̞͈̲̬̦̟̬̭̥̮̮͚̥͉͖̺̬̟̘̼̲̻̭̟̹͙̮̪̱̫͚̦̺́͛̈́́̍̈́̄̋̎̊͋̆̑͌́̊̐́̉̇̍͊̍͊́̆̇̓̎͊̑̋͛̏̀̈́̒͛̈̿̅̉̎̒̓͘̕̚̕̕̚̚͜͜͠͝ͅo̷̡̙̞̻̩̜̘̪͚̳̙̟̤̻̫͔̰̟̼̲̘̱͍̟̠̼̯͎̭͍̙̖̺̦̟̝̳̺̳̰̣̱̹̰̮̞͊̈́͒͜ͅư̷̛͖͉̠͔͍͉͎̳̖̲̞̖̳̭̯̥̙̖̯̙̪̗̖̱̔͑̋̆̋̀̄̆̾̊͛̃͗̅͗̌̑̆̏̽̈́́̓͑̈́͒̓̊͐͗́̋̌̈́̋̈̽́̎̏̈́͌͒̊̌̈́̆̀̔̎͛͘̕̚̚̕̕͜͜͜͠͝͝ͅt̵̨̻̳̘̻͇̬̟̩̥͓͚͕̍̇̇̔̌̓̐̐̓̿̂͛̂͑̃͊̓̾̈́́͒͋̏̈́̂̐̀́̌̀͊͛̽̈̚̕͜͝

0 Kudos
Message 41 of 61
(5,070 Views)

when I create a program such as SVI-TARESETUP attached, with a single command, it is the correct output that is read into the read buffer.
When I create the same thing with another command and put them in a row, then the responses get mixed up.
I attach my last test which is a sequenced program that is supposed to ask the second condition only after the first condition is done.
The result is that the answer in the output buffer of the first loop: TARESETUP is XPa or other possible answers. While the question is supposed to arrive only afterwards. I don't know what to think. Indeed it is very strange.

Translated with www.DeepL.com/Translator (free version)

Download All
0 Kudos
Message 42 of 61
(5,063 Views)

Could it be that one command returns multiple lines?

 

That could confuse things.

 

If you only read one line of the answer, the next command will appear to return a random answer. This will only get weirder. The 2nd cycle, the first command that worked before now returns random answers as well.

0 Kudos
Message 43 of 61
(5,058 Views)

each command reads only one line. I wonder if this has anything to do with an offset in the response and memory, do you know how the number of bytes should be configured?

0 Kudos
Message 44 of 61
(5,045 Views)

@aerosimon  ha scritto:

each command reads only one line. I wonder if this has anything to do with an offset in the response and memory, do you know how the number of bytes should be configured?


You mean for the VISA Write? You simply wire a number greater than the number of bytes you expect to receive, then rely on the Termination Character you configured for the port. Obviosuly, if the answer does contain more than one Termination Character, you must read multiple times accordingly.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 45 of 61
(5,036 Views)

@aerosimon wrote:

each command reads only one line. I wonder if this has anything to do with an offset in the response and memory, do you know how the number of bytes should be configured?


Lots of scales can be programmed to output data by itself.

 

Maybe that's what's going on?

 

Historically, lots of scales could connected to a printer.

 

I'd read the manual 4 or 5 times, to see if this is plausible, and if it can be turned off. IIRC some brands need physical key pressing to turn this off (and on).

0 Kudos
Message 46 of 61
(5,036 Views)

what do you mean by "more than one termination character"? for example, 4 bytes came out of my first command. But I always put 2500 bytes to my read no matter what. Is this an error?

0 Kudos
Message 47 of 61
(5,021 Views)

I read the manual several times and did keyword searches in the text, I couldn't find anything that would match this.

0 Kudos
Message 48 of 61
(5,018 Views)

Several others suggested this before but i don't think you've tried it.

 

Send only one command and read the answer. Add a delay so you write/read every 100ms or so and not constantly.

If the answer you get is the expected one, change the command you are sending and repeat the process until you go through all commands you intend to use.

Only after all commands work as intended, should you do what you are doing now and send them in sequence.

0 Kudos
Message 49 of 61
(5,014 Views)

@aerosimon  ha scritto:

what do you mean by "more than one termination character"? for example, 4 bytes came out of my first command. But I always put 2500 bytes to my read no matter what. Is this an error?


No, it's not. I can't open your vi, so I don't see how you configured the serial port. What I mean is the following.

Let's say the termchar is the newline, the default (\n  = ASCII 10). Let the expected response be "OFF\n". You require 2500 bytes but VISA Read stops as soon as it receives the newline. Whats really important here is that 2500 (requested bytes) >= 4 (received bytes).

Should the response be "OFF\n19 Pa\n" instead, it would contain two newlines, so you would need to read twice. You would receive first "OFF\n" and then "19 Pa\n".

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 50 of 61
(5,001 Views)