LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String indicator displying is not proper

Solved!
Go to solution

Hello all

I am working PCAN interface , where i need to read the CAN signal and display the response HEX value on the String indicator ,now i am able to read it but the data i want to display one after another with time .

 

the data i am expecting is 80000000, but i am receiving as 80 0 0 0 0 0 0  .

could you please tell me what i am doing wrong .

Download All
0 Kudos
Message 1 of 9
(1,296 Views)

You should be more precise in specifying values. One may wonder whether you are expecting 80000000 represented as ASCII (8 bytes '8', '0', '0', '0', '0', '0', '0', '0', each byte being a character) or as hex (4 bytes 0x80, 0x00,  0x00, 0x00). I guess the latter.

From the picture of the output, first read, you are receiving 8 bytes (0x80, then 0x00 7 times). In the second read, something goes wrong (?) and you receive 9 bytes, with the 0x80 doubled. Third and subsequent reads: 0x00, 0x80, then 0x00 7 times.

No idea why this happens, since I know nothing about the device you are using.

EDIT: also remember to show the display format of string controls/indicators.

EDIT2: if you want to display '00' instead of '0' for a null byte, you should input 2 as width instead of 1 to the formatting function.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 2 of 9
(1,286 Views)

Anil@8899 wrote:

Hello all

I am working PCAN interface , where i need to read the CAN signal and display the response HEX value on the String indicator ,now i am able to read it but the data i want to display one after another with time .

 

the data i am expecting is 80000000, but i am receiving as 80 0 0 0 0 0 0  .

could you please tell me what i am doing wrong .


Your For-Loop is wrong. Try doing it like this instead:

 

Dobrinov_0-1633423486609.png

 

"Good judgment comes from experience; experience comes from bad judgment." Frederick Brooks
Message 3 of 9
(1,251 Views)

Hi Dobrinov,

 


@Dobrinov wrote:
Your For-Loop is wrong. Try doing it like this instead:

 

Dobrinov_0-1633423486609.png


What's the point of a FOR loop at all in this example?

Why not go without a loop?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(1,226 Views)

@GerdW wrote:

Hi Dobrinov,

 


@Dobrinov wrote:
Your For-Loop is wrong. Try doing it like this instead:

 

Dobrinov_0-1633423486609.png


What's the point of a FOR loop at all in this example?

Why not go without a loop?


I modified the loop he already had in place - much easier for him to figure out what to change to make it work. That and I'm lazy, so less effort for me.

"Good judgment comes from experience; experience comes from bad judgment." Frederick Brooks
0 Kudos
Message 5 of 9
(1,220 Views)

Thanks for your reply ,

 

I modified as per your comment , but i wanted to display the response continuously , because to keep the track of previous response .plesae guide me ...

 

 

thanks ..

 

0 Kudos
Message 6 of 9
(1,162 Views)
Solution
Accepted by topic author Anil@8899

Anil@8899 wrote:

Thanks for your reply ,

 

I modified as per your comment , but i wanted to display the response continuously , because to keep the track of previous response .plesae guide me ...

 

 

thanks ..

 


If I even understand your request correctly then try this:

 

Dobrinov_0-1633500316010.png

 

"Good judgment comes from experience; experience comes from bad judgment." Frederick Brooks
Message 7 of 9
(1,154 Views)

Hello Dobrinov,

 

Thank you very much for your time and support .

it is working properly .

0 Kudos
Message 8 of 9
(1,145 Views)

Hi Anil,

 


Anil@8899 wrote:

it is working properly .


I don't think so…

  • There's a small while loop at the left border set to iterate just once: why do you need a loop then?
  • The inner while loop with your CANRead code is set to iterate forever: how will you stop your VI gracefully?
  • There is an outer while loop with a stop button: why do you need this loop when the code within the loop will NEVER return?

You surely need to improve your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(1,141 Views)