LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Developing for PC and PDA, Bluetooth and Serial communication - how would you solve this?

Aloha!
 
We built a portable nanoparticle instrument at our university, and equipped it with both Bluetooth and USB connectivity - however, the USB just looks like a serial port for all practical purposes. We defined a communication protocol and I just implemented LabView programs for PC and Pocket PC to communicate with the instrument. The PC version can either use the Bluetooth or the USB connection, the PocketPC program can only use Bluetooth (since our PocketPCs don't have USB connectivity).
 
Naturally (?) I would like to keep things as simple as possible and not write different programs for PC-serial / PC-Bluetooth / Pocket PC. I would like to explain how I tried to solve this, and because I'm not 100% happy with my solution, my question is: "is there a better way to do this?" - and perhaps someone of NI could comment on the LV for PDA compiler issues.
 
My solution builds on a large number of common subVIs, which are not PC/PDA specific, which do all calculations etc. I also have two common subVIs called "read" and "write" which take the 3 inputs
- Bluetooth refnum
- COM port name
- boolean "use Bluetooth if true, serial if false"
 
When I use these read/write VIs on the PC, I use the boolean as case-structure-selector and use either BT or serial to read/write. On the PDA, this doesn't work, because LV for PDA does not support serial communication. So I put the serial communication part into a conditional disable structure, which disables nearly all of the serial stuff for the PDA target - the actual communication part. This still isn't good enough, because the subVIs have VISA port name selectors as inputs (and duplicate outputs). LV for PDA crashes if I use these VIs. So I changed my VISA port name selectors to normal strings, and now everything works.
 
If everything works, why am I unhappy? I am unhappy for a number of reasons. The top reason is that LV for PDA has no meaningful error messages (could somebody from NI ask the LV for PDA developers why this is the way it is??). When I used this subVI which had a VISA port control in it, I didn't get an error message that I wasn't allowed to use it. Instead, the VI compiled, and ran on the PDA for a few seconds until it produced an error message about not being able to lock a memory chunk. I got a similar error message when I used the "not a refnum constant" - before using the boolean selector to decide whether to use Bluetooth or serial communication, I used to check whether the Bluetooth refnum was "not a refnum", and if yes, I would use the serial communication. The "not a refnum" constant doesn't appear to be supported in LV for PDA, and again it fails to give a meaningful error message.
 
I could go on - the whole thing seems a bit of a kludge to me. So I'm wondering whether there are any really good ways of dealing with this multiple execution target / multiple communication protocol thing? Does anyone here have a better idea?
 
best regards
  Martin
0 Kudos
Message 1 of 4
(3,998 Views)

Hi Martin

I'm not sure how to solve your problem but there is one correction I have to make.  The PDA modual does not support VISA, it does support serial communication.

You have to use the VI's in the Intrument I/O Serial Compatibility Tool Pallete.

These VI will also work on your PC if you want to go that route.

Good Luck

Eric

0 Kudos
Message 2 of 4
(3,989 Views)
Hi Eric,
 
thanks for the tip. I checked it out quickly, and the PDA module indeed supports serial communication. It doesn't really remove the kludge though - or at least I couldn't see how because the serial VIs for the PDA are nowhere to be found on PC-labview. Perhaps they are still supported, but they seem to have been officially replaced by the VISA VIs on the PC. So using the "old" serial VIs on the PC isn't something I want to do - or is it?
 
cheers
  Martin
0 Kudos
Message 3 of 4
(3,969 Views)
The only thing I don't like about the serial compatibility VI's is they don't have any direct error handling.  Other than that they work on the PDA or the PC.  If you develop the serial communication to work on the PDA it will definitely work on your PCas long as you know which comm port to select.
 
Good Luck
Eric
0 Kudos
Message 4 of 4
(3,955 Views)