From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

chndel

Can someone tell me why the command ChnDel(1061) does not work while ChnDel(1060) works fine. All numbers below 1061 seem to work and all above 1060 seem to fail. By the way, the command ChnDelete() also works with higher channelnumbers but as far as I understood it is less performant than ChnDel().
0 Kudos
Message 1 of 2
(3,115 Views)
Hi d.s.,

I think I know why you're encountering this issue. The channel number 1060 is the last automatically allocated channel with the default DIAdem Desktop.DDD (initialization) file. Unless you tell DIAdem differently, it will allocate at start-up 60 static channels with 8192 rows and 1000 dynamic channels that can have whatever size they need to when they are first used. So in a sense, by default the channel number 1061 does not exist.

Now, this is much more important for DIAdem 8.1 than DIAdem 9.0, where the memory management has been reworked to be completely automatic. But even in DIAdem 9.0 these initial 1060 channels are allocated by default for backwards compatability reasons.

In order to answer your questions more exactly, I would need to
know which DIAdem version you are using, what the status of the channels were prior to the delete comand, and exactly which error message is occuring with the ChnDel() command.

The main difference between ChnDel() and ChnDelete() is that ChnDelete() requires a string paramter which describes 1 or more channel numbers, e.g. "1-" or "1,4,5-10". ChnDel() on the other hand can take either a single number argument or a single channel name argument that then results in an automatic search for that channel name to turn it into the corresponding channel number (first match).

A second difference between ChnDel() and ChnDelete() is what happens when the argument passed does not correspond with an existing channel. ChnDelete() will not throw an error, while ChnDel() will. If you want to use ChnDel() but don't want an error, you can always turn off the error checking briefly, for example:

On Error Resume Next
Call ChnDel(1061)
ErrNum = Err.Number
ErrMsg = Err.Description
On Error
Goto 0
'MsgBox "Error Number = " & ErrNum & vbCRLF & ErrMsg

Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,115 Views)