LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert long hex string to individual decimal values..??

Solved!
Go to solution

@Gerdw..

 

Once again thank you for replying me very quickly..

 

I am leaving Start & End bytes in while calculating parameters..You may check it in SubVI..

 

To be frank, I am not familiar with TermChar...Hoping that you will make correction in my mistakes & also enlighten me for  learning knowledge in the my journey of LabView...

 

Here I am not receiving 595 bytes in read byte returns...What changes i needed to do..

0 Kudos
Message 11 of 39
(965 Views)
Solution
Accepted by topic author Tusharvp4

Hi Tusharvp,

 


@Tusharvp4 wrote:

I am leaving Start & End bytes in while calculating parameters..You may check it in SubVI..


You did not provide any subVIs…

 


@Tusharvp4 wrote:

To be frank, I am not familiar with TermChar...Hoping that you will make correction in my mistakes & also enlighten me for  learning knowledge in the my journey of LabView...


The TerminationChar is used by VISARead to end the current reading: you get exactly one message per VISARead (except for errors like timeout). This way you can easily sync data reading and easy the data parsing as you know you have one full message!

 


@Tusharvp4 wrote:

Here I am not receiving 595 bytes in read byte returns...What changes i needed to do..


I don't know. You failed in providing code and even did not explain this "595" number…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 39
(947 Views)

I have given all details..Just read our conversion..

 

I wrote my labview program from example of continuous read & write serial program...

 

Here i am facing problems of receiving returns bytes...I am not getting all bytes in same manners...Sometimes its coming false & incorrect order bytes 

0 Kudos
Message 13 of 39
(941 Views)

Hi Tusharvp,

 


@Tusharvp4 wrote:

Here i am facing problems of receiving returns bytes...I am not getting all bytes in same manners...Sometimes its coming false & incorrect order bytes 


As you have not given all details (missing [complete] manual, missing subVIs, missing example data) you need to debug on your own!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 39
(929 Views)

SubVis in program to after "string to byte array conversion"...There, you can understand protocol calculation..

 

 

Download All
0 Kudos
Message 15 of 39
(922 Views)

Hi Tushar,

 


@Tusharvp4 wrote:

SubVis in program to after "string to byte array conversion"...There, you can understand protocol calculation..


I repeat: YOU DID NOT ATTACH ANY SUBVI SO FAR!

 

And please don't request even more help by sending personal messages as this only disturbs! Ask you questions in this thread and provide the information you were asked for…

 

The numbers in your images look quite ok, atleast there are a lot of "254"/"253" message start/end markers.

But keep in mind: when asked for data then you should not send images of data. No one will attempt the type all the number from your image when you can provide such data easily by setting them as default values in your controls/indicators!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 39
(892 Views)
Solution
Accepted by topic author Tusharvp4

@Tusharvp4 wrote:

To be frank, I am not familiar with TermChar...Hoping that you will make correction in my mistakes & also enlighten me for  learning knowledge in the my journey of LabView...


Just stop everything you are doing and go watch this: VIWeek 2020/Proper way to communicate over serial

 

In summary, you need to use the protocol to properly read the data.  I give examples in that presentation.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 17 of 39
(882 Views)

@crossrulz..
Thank you for well explanation..It gave me much knowledge regards about serial read..
I made few changes accordingly it..
I am running my instrument with three speed…1s ,0.5s ,0.25s
I am getting full bytes in returns count at 1s , 0.5s speed..
But data are being lost at data 0.25s…

0 Kudos
Message 18 of 39
(826 Views)

So where is the 595 bytes coming from?  All I have seen from your protocol says you should be receiving 18 values at 7 bytes per value, which is 126 bytes.

 

Furthermore, how do you know you actually starting reading at the start of the data stream?  You could be starting from the middle of the data.  YOU NEED TO FOLLOW THE PROTOCOL TO MAKE SURE YOU HAVE A COMPLETE MESSAGE.  This includes reading until you find the start byte, checking the command value, reading the data, and verifying the end byte.  If any of those steps fail, you are not synchronized with the data packet and try again.  This becomes increasingly important at the faster data rates.

 

Also, your conversion VI can be simplified A LOT.  I did a Reshape Array to change your 1D array into a 2D array with each row being the 7 bytes.  I could then autoindex on the 2D array.  From there, I replaced a lot of math with a couple of Join Numbers and your case structure with a Power Of 10 function.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 19 of 39
(791 Views)

@crossrulz

 

Here..I am attached protocol..You will understand it better now..

 

I have a problem only in 0.25 second speed measurement in above VI..

0 Kudos
Message 20 of 39
(769 Views)