Re: LabVIEW as an in-process COM-server

2004-05-21 Thread RolfK
rberger wrote:

> I would like to know if LabVIEW is an in-process COM server—an
> ActiveX DLL—that implements the IDTExtensibility2 interface.  I
> am trying to add a COM add-in for a current Microsoft product.

LabVIEW is not an in-process COM server. LabVIEW is started as a 
separate process either as development system or as runtime executable 
and the Active X interface is out of process to the other application 
invoking LabVIEW's Active X interface.

LabVIEW is also not embeddable into other applications through Active X.

Rolf Kalbermatter



Re: Beep in labview.

2004-05-07 Thread rolfk
This may sound stupid, but do you have speakers connected to your PC?
And if you have, did you make sure the Volume Control Panel is
configured to not Mute the loudspeaker nor the waveform device?

Rolf Kalbermatter



Re: How can I get an unsigned char string with nulls from a dll into LabVIEW 6i?

2004-05-04 Thread rolfk
Well I would certainly go for the unsigned 8 bit array parameter
method. That is the best one and contrary to your claim does not
require any changes to the DLL. For the rest it is a good
recommendation and the most direct approach to do, what the OP has to
do.

Rolf Kalbermatter



Re: Need Help: How to design USB Driver for USBN9603

2004-04-24 Thread rolfk
Well, I don't see how you could get at the information necessary to
talk with this device from the link you provide. Doesn't National
Semiconductors have a Software Reference driver with SDK you can
purchase for this device? You definitely need Software driver specific
informations, such as the manufacturer and product ID, but also some
more informations about the endpoints and possible stream formats.

Yes it seems rather difficult to me. Not a single weekend project for
sure.

Rolf Kalbermatter



Re: VI loads slowly if VISA serial control is on the front panel

2004-04-24 Thread rolfk
Measurement & Automation Explorer does not change the VISA
Configuration from itself. It is meant that those settings are only
changed when M&A is open and the user requires a rescan or removes or
disables devices explicitedly. It is always tricky to do full
autodetection and automatic configuration adaption without sometimes
loosing carefully edited configuration items.

As to the delay I have seen that too, but assumed that it was a
standard VISA 3.0/LabVIEW 7.0 problem. It's interesting information
that this may have to do with (default or stale) information in the
visaconf.ini file to non existing resources.

Rolf Kalbermatter



Re: Necessary to make strange tweaks to my array data pointers when

2004-04-24 Thread rolfk
Well, watch out about adapt to type! It will pass the structures as
they are used in LabVIEW. This can have a number of pitfalls.

1) LabVIEW uses it's own format for strings and arrays, called
handles. It is a pointer to a pointer to an array with one int32 per
dimension in front telling the size of each dimension. No other
environments do use this type of format by default, although if you
know it you can always account for it on the C/C++ or even Delphi
side. But passing structures which contain strings or arrays by adapt
to type will usually not work unless the DLL is specifically aware of
the LabVIEW types.

2) Byte alignment can be an issue too. LabVIEW packs structures as
much as possible on Windows. Windows 32bit API does nowadays often use
long word alignment for longs, floats and doubles. Delphi might want
to do that as well by default. Your Delphi documentation should be
able to tell you such details (I would hope). You can adjust on the
LabVIEW side for this if necessary by adding explicit dummy filler
values into the cluster.

Unless you have a flatten or typecast function in your wire the byte
order should be always the same as the CPU on which it is running. The
Flatten (and Unflatten) or Typecast function do always do a byte and
word swap for according data types when you convert from or to larger
sizes than 8 bit values. So when you do Typecast your int32 to a
string or byte array the order of the bytes is reversed on the other
side. Basically if you build a cluster in LabVIEW and Typecast it to a
string to pass to a DLL, what you should do (only under Windows and
Linux!!) to the Cluster wire before wiring it to the Typecast function
is putting a Swap Byte and Swap Word function in the wire. This will
take care of byteswapping any values in the cluster correctly to
compensate for the byteswapping the Typecast will do. Of course since
about LabVIEW 6.0 you can also alternatively select the CLN parameter
to adapt to type and then you don't need to byteswap and typecast at
all.
But watch out: If the cluster is not flat (e.g. contains strings or
arrays, you can see that the Typecast will refuse to connect properly
to that wire as Typecast can only convert flat data types) you can't
really pass such a cluster easily to a DLL nor by Flattening it nor by
using Adapt to Type. When Flattened the enntire cluster will be put in
one single buffer, with the strings embedded into it, which is
definitely not what any DLL ever would expect. When using Adapt to
Type, the embedded arrays (and strings are really byte arrays too)
will not be passed to the DLL in a way which a DLL can understand by
default.

Last but not least, LabVIEWs Boolean is really a 8bit integer with the
LSB indicating the state. WinAPI and probably Delphi too, use a 32 bit
integer to represent Booleans. You can easily adjust for that by
including a n int32 with value 0 or 1 on the LabVIEW side.

Rolf Kalbermatter



Re: 7-segments like digital indicator

2004-04-24 Thread rolfk
Well, not sure what you expect. I find that font reasonably well.
But you could always create your own font using some freeware or
shareware font editor. As long as you only need numerics you can get
away with 11 to 13 font characters (0-9,.)

Rolf Kalbermatter



Re: how to transfer 2d array between LV Call Lib Func Node and a DLL?

2004-04-24 Thread rolfk
Depends what you understand under a 2D array. In C a two dimensional
array will sometimes be a pointer to an array of pointers to the array
of data. This is not how LabVIEW can pass 2D arrays. LabVIEW 2D arrays
are really just a pointer to a single array with row * column
elements.

Rolf Kalbermatter



Re: call IMAQ DLL from c++

2004-04-24 Thread rolfk
I think you will need to look into the IMAQ Vision for Measurement
Studio package.

Rolf Kalbermatter



Re: Question about slow rs232 equipment

2004-04-24 Thread rolfk
A PIC for instance does not have a FIFO for its standard serial port
module. You get a byte in a register and if you are not fast enough
before the next byte is ready things might go wrong. Of course writing
the PIC formware in such a way that it can always deal with the
maximum input rate (for instance 9600 baud => ~1ms per byte) is the
real art here.
Also you can consider handshaking too, although the PIC module does
not have this automatically.

Rolf Kalbermatter



Re: Necessary to make strange tweaks to my array data pointers when calling dlls

2004-04-24 Thread rolfk
>You pointed out that depending on which calling
>convention you use, either the function or the calling
>code pops parameters off the stack.  Which convention
>does which, and does one method inherently involve
> less overhead than the other?

With cdecl the caller is responsible to adjust the stack pointer
whereas with stdcall the function itself adjusts the stack pointer.
stdcall is supposed to be a tiny wee bit faster but I'm sure you won't
be able to measure the few nanoseconds. I'm not exactly sure on what
claims this is actually based, but have decided that worrying about
this form of optimalization is simple bullshit as long as you don't
program in assembly.

What you explain with the byte order I'm not sure what you mean. It
all seems wrong to me. Of course if you convert an int32 to a boolean
array the first bit will be visually on the left side as arrays are
typically interpreted in the same direction as we read text but that
is only a visual representation. In memory an int32 consists in
LabVIEW of 32 bits in the native format. So unless you tell us what
Delphi type you try to create (and hopefully my rusty Pascal knowledge
is good enough to understand it) I can not really tell you what you
should rather do to get that type.

Rolf Kalbermatter



Re: Win32 call--Possible to use a pointer to a pointer?

2004-04-20 Thread rolfk
I guess when saying Code Interface Node above, you really mean the
Call Library Node. Because if you had a CIN you had some C code to
write and in there you could do whatever you wanted.
As I have pointed out at other places here you could use a little
LabVIEW voodoo to get at this information. Basically you would need to
copy as many bytes as the buffer should contain from that pointer to a
byte array.

You can do that with a Call Library Node configured to call a
documented LabVIEW manager function.

Library: LabVIEW
Function: MoveBlock
Calling Convention: C decl
Return value: void
1. Param: src, uInt32 by value
2. Param: dest, array of uInt8, initialized to length of the structure
3. Param: len, int32, length of the structure

Rolf Kalbermatter



Re: Feature request and how-to info for EXE icons

2004-04-20 Thread rolfk
This is not so bizarre. LabVIEW icons are internally really Macintosh
resources and there is some translation necessary to get them into
Windows format. Also by being able to convert the icon alone you are
still not there. Putting them into the target executable is a little
tricky at best.

Rolf K



Re: TI PCI-2040

2004-04-18 Thread rolfk
Programming hardware is NOT the task of an application, and LabVIEW is
an application running in user space. Trying to do that right away
will cause a General Protection Fault error on any reasonably modern
OS. You can of course try to access Port IO addresses through the Port
IO VIs, but PCI bus addresses are not anymore fixed and need access to
privileged OS services to resolve properly. Otherwise if you start to
use fixed addresses for this using Port IO access, it will most
probably only work on a particular computer and may even fail next
time you restart your computer or resume from standby with a different
PCMCIA or whatever card inserted.
These are all things only a device driver can do properly and so if
you want to access hardware behind a PCI bridge, you really have to
develop a device driver for this hardware to work under any Windows NT
type, Linux or OS X system. The PCI bridge on the system board is not
really programmed by you anyhow but by the OS which provides you with
services to make use of the hardware.
Fortunately developing a device driver only requires advanced C
knowledge nowadays, it used to require also profound assembly language
knowledge only a few years ago.

Rolf K



Re: Feature request and how-to info for EXE icons

2004-04-18 Thread rolfk
I took a look at this. The actual functions doing the icon work in the
application builder seem to be called by reference from
vi.lib\platform\icon.llb\Read Icons From ICO File.vi and Write Icons
To Application.vi.
One problem is that even though the read VI does read all types of
icon formats, the write does only overwrite existing icon formats in
the resource fork of the executable and that contains currently only
those four images.
So I would believe by adding the other resource types you would like
to the applibs/lvapp.lib file (which really is an executable to
startup the LabVIEW runtime engine and is used to create the actual
exectuable file) you could get the Application Builder to replace
those resources with the ones from your icon file.
There is a problem though and it is not very simple. If your icon file
does not contain certain icon types the old ones will stay in and
might be picked up. Removing them or adding new icon types not in the
original file requiures to resize the entire executable and fixup
quite some offsets in the resource table for this. There are some Win
API functions which are supposed to help with that, but I'm not really
familiar with them.

Rolf K



Re: i'm reading value from memory addresses one at a time. How can I store my values in an array?

2004-04-18 Thread rolfk
The bad way: Using a shift register and a build array function node
append them to the array.

The good way: wiring the value to the loop boundary and enabling
autoindexing. Autoindexing is enabled by default on a For Loop, but
needs to be enabled on a While Loop.

Rolf K



Re: How to update front panel immediately with any control change in LabVIEW7.0?

2004-04-15 Thread rolfk
I solve this problem by combining the event structure with a classical
state machine. The classical state machine is a case inside a loop
with either an enum or string shift register defining the actual
state. In the idle case of that structure is the actual event
structure  which handles the UI.
Whenever I need to trigger a specific action which could happen from
multiple locations I actually place the handling code in a specific
case in the outside state machine and just wire from the actual event
case the according state out to the shift register.
This architecture allows for a very flexible and extende state machine
programming with the event structure doing all the UI event handling
and the state machine doing the more involved actions or series of
actions.

Rolf K



Re: How do I determine the number of plots on a waveform graph?

2004-04-15 Thread rolfk
Usually by reading the graph terminal or a local of it and determining
the first or second dimension (not sure which at the moment) size of
the resulting 2 dimensional array. If it is a 1 dimensional array you
have either only one plot or an array of clusters each representing
one plot. But as these data types are determined by compile time,
there shouldn't be a problem with this causing ambiguity.

Rolf K



Re: CIN memory problem

2004-04-15 Thread rolfk
out:
>   return err;

free(RxData_tot); // free memory
free(colore); // free memory
free(scan); // free memory

Your function never reaches the memory free functions as it returns
before that with the err code. Removing that return altogether seems
like a very good idea to me.

By the way it is not a very good idea to return anything else than
noErr from CINRun(). This will immediately abort the entire
application. It would be better to just return the error in an extra
error variable and deal with the error in traditional ways through
error clusters for instance.



Re: Application Memory Full - how do I stop this?

2004-04-15 Thread rolfk
Shift registers accumulating data with Build Array or Append String
functions inside!

Bad calculation of For loop count with autoindexing output on foor
loop boundery.

Or simply an autoindexing output on a while loop. The CPU may be slow
but 32 MB is fast depleted in a loop when you create an array of
double precision values.

PS: You should have also a math coprocessor 387 installed or things
get a little difficult in LabVIEW.

Rolf K



Re: MOTION - S-curves

2004-04-15 Thread rolfk
On another similar thread I saw a comment from NI support that there
is currently no formula for the time-distance graph available for the
S curve parameters. The advice was to use Motion assistent to look for
these parameters in the according graph.

Rolf K