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