LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

unable to display hex array in textbox of .uri

Solved!
Go to solution

i have to send hex frame on RS-232 , i have sucessfully send/recieve char string from my uri but the issue is that textbox only displays characters so by GetCtrlVal or SetCtrlVal i can only get and set characters but unfortunately i am unable to do same with Hex formate data,for example i want to send hex array of 20 0xAA , 0xAB , 0x10 , 0x00, 0xAE , 0xFF ...... , SSO WHEN I ASSIGN such array to textbox i can see different shapes but not my hex data, i have used other tools to varify that my data is correct but unfortunatly Lab Windows is unable to help me with this, converting whole array of 20 to string and then displaying is also another option but i am stll unable to do so.

please help me, looking forward for your reply,

regards

Ahsan

0 Kudos
Message 1 of 8
(5,755 Views)

There are at least two options:

 

- The simplest probably is a numeric control using display format hexadecimal and showing the radix

- You can use a text box control; this requires suitable formatting as described here

0 Kudos
Message 2 of 8
(5,751 Views)

Another alternative is to use a table instead of a textbox: numeric cells in table can be formatted to output/accept hex values and SetTableCellRangeVals function can help in reading / writing the whole message in a single pass.



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?
Message 3 of 8
(5,737 Views)

1) i have tried to use SetCtrlVal function with Table control the same why i use it with TextBox but i get Library fuction error ( returne value = -58 ) the control does not have a value.

2) Secondly i have another question regarding Timer Control , respected Sir  i am using timer controls in my application but i have noticed an issue, timer control are not absolute , when my application is running and i use task manager or i minimize / maximise my .uri i have noticed the timer lag. i am sending a frame from one serial port and recieving from the other , also keep in mind that i am using a powerful computer with windows 7 installed but i want to have timer to be absolute and never change so that i dont loose frames ,,,

please sir answer my both questions

regards

ahsan

0 Kudos
Message 4 of 8
(5,720 Views)

sir using numeric control is not an option for me as i have to display a complete frame i.e an array so numeric control can be used for displaying single entity not entire array.

0 Kudos
Message 5 of 8
(5,711 Views)

You could use 20 numeric controls Smiley Wink

Or, if you have a newer version of CVI, you can also use a control array, see, e.g., here

0 Kudos
Message 6 of 8
(5,709 Views)
Solution
Accepted by topic author smartprogrammer

1) SetCtrlVal is not the correct way of addressing table controls. Values must be inserted into table cells, not into the table itself. The appropriate command is SetTableCellVal or SetTableCellRangeVals if you can organize your data into a numeric array. I suggest you take a look at tablecells.prj example to understand how to manipulate the table. The example is located into <samples>\userint folder; you can locate it with the example finder (help >> Find examples... menu item)

 

2) UI timers are handled by the user interface thread: they can be affected by all and every event in that thread. What you are observing is normal behaviour for standard UI timer events; the worst case you heve not observed till now is that if you click and drag a window UI timers are freezed all the time the mouse button is pressed! An easy alternative to UI timers are asynchronous timers which are handled in a separate thread. See the documentation I have linked and the examples you can find with the example finder



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?
Message 7 of 8
(5,705 Views)

I seem to understand that you are quite new to CVI.

If this is true, you should at least take some time to read Getting Started document in <cvidir>\bin folder. You can download it from NI site here (CVI 2013)



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 8 of 8
(5,703 Views)