Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Sat Nov 18, 2017 6:08 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Jan 04, 2007 1:23 pm 
Offline

Joined: Fri Dec 08, 2006 2:19 pm
Posts: 8
Hello,



I have an application on a G70 that has 5 tabs in a tab container. When I go to write to a checkbox from LabVIEW, the checkbox does not switch states if it is on a different tab than the one that is already displayed. This causes my LabVIEW program to hang, since it is looking for the checkbox on the Q70 to be checked before continuing on - if it doesn't see the right answer, it tries again and again...



Is there an easy way to accomplish what I am trying to do? Am I missing something about tab containers in general?



Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 1:55 pm 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
You can think of each tab as a screen. Whenever a screen is disabled the objects in the screen are disabled. When new channel data is received all enabled objects are notified. Meaning that the checkbox within the disabled tab is not notified of the change in that channels value. There are a couple of ways to handle this.



1. You could change the NIComV2 object to notify all objects of new channel data regardless of wether they are disabled or not. The problem with this is that performance could be drastically hurt, so I wouldn't take this approach.



2. Basically you need to make sure that if an object is required to recieve data at any time (disabled or not), then it needs to be enabled at all times. The only way to do this is to put the object in globals.



2a. One approach that I think would require little work is to make a copy of your NICheckBoxV2 object, move the copy into globals, and move it off to the side so that its non-visible. This way if your Tab is disabled you'll still have an object in globals that will recieved the channel data.



2b. Another alternative solution is use an NIVirtualVariableV2 in globals, and a normal CheckBoxV2 in the tab instead of an NICheckBoxV2. When the NIVirtualVariable receives an update on that channels its NewChannelData() will be called. You can put code in the NewChannelData event to update the CheckBoxV2 and take any other needed actions. The code might look something like this:



Code:
func NewChannelData()

    checkbox_1.ischecked = boolvalue

endfunc




Unfortunately I recently fixed a bug in the NIVirtualVariableV2 object that you'll need to fix also. I wouldn't normally reccomend editing a library directly, but in this case its okay. You can either make this change via a template or editing the library directly. Find the channeldata function in the NIVirtualVariableV2 object source and replace it with this code.



Code:
private func channeldata(channelnumber as integer) returns boolean

    handles NI_CHANNEL_DATA_RECEIVED

    dim data[] as byte

    dim i as integer

    dim b as byte

    dim bool as boolean

    dim u as unibyte

    dim f as float



    dontsend := true

    check error

        if channelnumber == channel then

            data = NICOM_OBJ.getlastdatareceived()

            if len(data) > 0 then

                if data[0] == datatype then

                    if datatype == _NI_STRING then

                        stringvalue = mid(data,1, -1)

                    elseif datatype == _NI_FLOAT32 then

                        frombytes(f,mid(data,1, -1), true)

                        floatvalue = f

                    elseif datatype == _NI_INT32 then

                        frombytes(i,mid(data,1, -1), true)

                        intvalue = i

                    elseif datatype == _NI_UINT16 then

                        frombytes(u,mid(data,1, -1), true)

                        intvalue = u

                    elseif datatype == _NI_UINT8 then

                        frombytes(b,mid(data,1, -1), true)

                        intvalue = b

                    elseif datatype == _NI_BOOL then

                        frombytes(bool,mid(data,1, -1), true)

                        boolvalue = bool

                    endif

                    NewChannelData()

                endif

            endif

        endif

    on error

        _clearException()

    enderr

    dontsend := false

    return false

endfunc

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 2:11 pm 
Offline

Joined: Fri Dec 08, 2006 2:19 pm
Posts: 8
Ok,



Could I use a single global instead? That is, have LabVIEW write to a global object (holds the desired tab name or number) which is then polled somehow to determine what tab should be active?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 2:54 pm 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
You can have Labview change tabs that way. Have a global object that whenever a numerical value was recieved it would select/change the active tab based on that value.



You could also put code in your application to send a numerical value to labview whenever a tab is changed so that labview can keep track of what tab is enabled.



An NIVirtualVariableV2 in globals would work for this.

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 5:58 am 
Offline

Joined: Fri Dec 08, 2006 2:19 pm
Posts: 8
Ok. Regarding virtual variables, could you clarify the description (in the documentation and when you hover over it)? It appears to be missing a word. The last sentence reads:

To assure that the data is sent over the correct channel, it is suggested that the channel is immediately before each time data is assigned to any of this objects data properties.



Is a word missing here?



Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 9:00 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
That was some confusing documentation. Here's what I've changed it to:



This object provides a simple method of sending and receiving a value of different types over the communications channel. The data is sent on a channel when a value is assigned to any of the data properties. To assure that the data is sent over the correct channel, the channel property should be updated (if different) before a value is assigned to any of this objects other properties.



Hopefully this makes more sense.

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 9:03 am 
Offline

Joined: Fri Dec 08, 2006 2:19 pm
Posts: 8
OK... thanks for everything!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group