annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

no output from string subset

20 bytes are read from VISA read:
a.png

 

and I want to take the value 00BF, so I used String Subset, with offset=25, length=4. but there is no output at substring

b.png

 

Does anyone know how to fix this? Thanks!

0 Compliments
Message 1 sur 13
5 046 Visites

Why 25and4? make it 10 and 2 it should work.

 

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
0 Compliments
Message 2 sur 13
5 039 Visites

The code should work fine.

Try using 'Highlight Execution' and see where the data is going missing.

 

String Subset

 

Edited1: Tell us about, how the string indicator (Read buffer) is configured, is it Normal or Hex.

Edited2: Also include the 'String Length' functionfor debugging purpose.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 3 sur 13
5 031 Visites
Hi,
Yes that's a problem. When I use String controller as input, the String Subset works fine.
But when using VISA read buffer as input, there is no output
0 Compliments
Message 4 sur 13
5 026 Visites

I think the problem is in the way the string is configured (check my previous edited reply).

Also, as mentioned already, debug using the String Length function.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Compliments
Message 5 sur 13
5 019 Visites

think convert to byte array is better.

 

0 Compliments
Message 6 sur 13
5 010 Visites

Hi QH_Dai,

 

why should this be better?

 

- There's no difference in taking an array subset or a string subset…

- The main problems stays: Cantata has to learn how it's data is represented! There's a difference in "normal" and "hex" string display - and so the byte offset and length differs when we want to have a certain subset…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 sur 13
4 993 Visites

Sorry, I thought you are taking HEX string, if that is normal string then 25 and 4 should work. For HEX string 10 and 2 should work.

With Regards

Miraz
Kudos is better option to thank somebody on this forum
------------------------------------------------------------------------------
Message 8 sur 13
4 987 Visites

Hi everyone,

I've got another question.

after getting the String subset, I want to convert the hex string to decimal number. I used the Hex String to Number function, but the output is 0. Does anyone know how to do this? Thanks very much!

c.png

0 Compliments
Message 9 sur 13
4 970 Visites

Hi Cantata,

 

you still don't get how your data is presented. You need to convert your string either by

- typecasting that string subset to U16…

- converting that string subset to byte array, indexing the two bytes and JOINing them to U16…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 sur 13
4 964 Visites