LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

TABS and SERIAL COMMUNICATION

Hello all..

i am working on a GUI, that will accept a packet of serial data and display the data on various gauges...

Its working properly when i use a single GUI window...

 

But i want to do the same with TABS in my GUI...

Like pressure tab can only show gauges with pressure... temperatur tab can only show temperature...

I first accept the serial data using event detect a char function...

But then what to do???

how to route the data to proper tab panels??

 

Regards

Salman

0 Kudos
Message 1 of 7
(3,196 Views)

I really don't understand the question... Smiley Surprised

 

Once you have read the message from the serial port, it's up to you to properly decode it and drive results to the proper indicators. If your user interface is structured with tabbed pages, you will need to use the proper panel handle (see GetPanelHandleFromTabPage function) in SetCtrlVal functions.

 

If you are not fami,liar with tab controls, you can take a look at tabpanels.prj example in samples\userint folder and to the online help. There are also several posts in the forum about them.



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 7
(3,189 Views)

Thanks for the reply...

i decoded the data properly...

Now im facing difficulties in routing data to various indicators in different tabs.....

 

can u give me a sample code for doing so??

like my main gui name is serial and 2 tabs i placed with names TAB1 and TAB2.,,

my data is in variables temp1, temp2 and presure1 and presure2...

i want to show temp1 and temp2 in indicators placed in TAB1 and presure1 and presure2 in indicators placed in TAB2..

all these temp1, temp2 and presure1 and presure2 are float values...

 

in short i want to do following things...

1. open comport

2. accept serial packet of 20 bytes..

3. decode serial packet and place values in variables temp1, temp2 and presure1 and presure2...

4. show temp1 and temp2 in indicators placed in TAB1 and presure1 and presure2 in indicators placed in TAB2..

 

 

0 Kudos
Message 3 of 7
(3,183 Views)

Take a look at the example in this page: inside PlotButton function you will find functions to retrieve the panel handles associated to the tab pages and to manipulate controls on the tabs (specifically graph some data on a graph control, but the concepl applies to every control).

There is really nothing difficult in programming woth tab control, provided you understand the basic concept that each tab page behaves as a stand-alone panel (i.e. has its own panel handle that you must use to gest/set values on control on the tab page).



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 4 of 7
(3,176 Views)
I am still unable to solve problem...
My code is as follow...

Int main(----)
{
Normal functions as in all examples
}

Void CALLBACKCVI char_detect (-----)
{
I write a routine to accept characters and decode the srial data and assign sata to various variables...
}

void CVICALLBACK display (----)
{
Here i first use
Getpanelhandlefromtabpage

And then pass my variables in which i stored serial data to indicators using setval function
}


But problem is that my indicators show nothing whn i run code and get serial data... the serial data is coming and varuabkes are getting updated but not shown in indicators...

My gui is like a big panel in which i place 2 buttons QUIT and CONFIGURE... configure is used toconfigure serial port....
And thn it got 2 tabs on which i placed indicators...

PLEASE HELP
0 Kudos
Message 5 of 7
(3,140 Views)

Nope, I can't help you this way! I'm not that kind of magician that can guess what's in your project without looking at it!

Please post some code or better a small sample project so that we can revise it and point you to the right way to address your goal.

 

What I can tell you in this moment is to add some error checking: trap the return code from both GetPanelHandleFromTabPage and from SetCtrlVal functions and if negative pass it to GetGeneralErrorString to get a description of the error. It may help you to solve your problem.



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 6 of 7
(3,125 Views)

Hello salmankhalid16,

 

When does your CVICALLBACK display get called? Have you set up any break points in that section to make sure you are entering it?

Ian M.
National Instruments
0 Kudos
Message 7 of 7
(3,104 Views)