LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I display both printable an non printable ascii chars from a device and display it in a text box?

Solved!
Go to solution

Hello,

 

My UUT sends to my computer via serial port both printable and non-printable ascii characters. The question is:

1)   how do I display all those characters in a text box.

2)   how do I display all those characters in hex format and display in a text box?

Thank you.

 

Robert

 

0 Kudos
Message 1 of 3
(4,272 Views)
Solution
Accepted by topic author Robert_Mensah

Textboxes actually can receive strings with both printable and non-printable characters: non-printable characters will be represented with a little square. Consider for example this code:

 

    char    a[512], msg[512];

 

    // Create a string with embedded non-printable characters

    sprintf (a, "Hello :%c%c%c%c%c: world!", 1, 2, 3, 4, 5);

 

    // Pass the string to the textbox "as is"

    ResetTextBox (bH[1], b1_n, a);

 

    //Format a hex representation of the string and add to the textbox

    Fmt (msg, "\n%*d[zb1r16w2p0j1] ", strlen (a), a);
    SetCtrlVal (bH[1], b1_n, msg);
 

Result is as follows: the first line is the string passed "as is", the following is the hex representation.

 

 

Message Edited by Roberto Bozzolo on 02-17-2009 09:18 AM


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(4,260 Views)

Thanks for the code snippet. That helped.

 

Robert Mensah

 

0 Kudos
Message 3 of 3
(4,231 Views)