Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQmx generate output in Visual Basic

Hello,

 

I have been using an old PC-DIO-24 card in an old Windows PC, with ISA slots, running Windows 2000.  This was to control external hardware for procedures form Audio Precision software APWin Basic, which is similar to VBA.

 

The old PC recently failed and I am trying to port over the calls from the procedures I have written in APWin Basic. I have installed a PCI-6503 card in a PCI slot in the new PC, running Windows 11 Pro.

 

I installed NI-DAQmx and I can control the PCI-6503 from the test panel so I know the hardware is working.

 

I am having difficulty understanding how to control the hardware from inside APWin Basic.

 

I can provide more details if necessary.

 

Thanks,

Geoff

0 Kudos
Message 1 of 15
(436 Views)

@GeoffPeters wrote:

Hello,

 

I have been using an old PC-DIO-24 card in an old Windows PC, with ISA slots, running Windows 2000.  This was to control external hardware for procedures form Audio Precision software APWin Basic, which is similar to VBA.

 

The old PC recently failed and I am trying to port over the calls from the procedures I have written in APWin Basic. I have installed a PCI-6503 card in a PCI slot in the new PC, running Windows 11 Pro.

 

I installed NI-DAQmx and I can control the PCI-6503 from the test panel so I know the hardware is working.

 

I am having difficulty understanding how to control the hardware from inside APWin Basic.

 

I can provide more details if necessary.

 

Thanks,

Geoff


You found a computer with native PCI slot and can run Win11 Pro? please share details, will be helpful for many.

On the other hand, assuming APWin Basic is a variant of Visual Basic, please refer to DAQmx Base Programming in C#, VB .NET, and VB 6.0 - NI

 

In short, you need to import the DAQmx C-DLL in APWin Basic and call the functions.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 15
(413 Views)

See Using NI-DAQmx in Text Based Programming Environments and Getting Started with NI-DAQmx for Text-Based Programming for help files and examples.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 3 of 15
(409 Views)

Hello santo_13,

 

The PC is a Dell 7070 Tower which I purchased as a reconditioned unit from Amazon. It does have one PCI slot and the CPU is an i7-9700K.

 

Thanks for the clues. Please see attached for the snippets of the syntax I was using previously. (APWin Basic.rtf)

 

I also see the ANSI C example but I'm unclear how to implement it in the APWin Basic procedure. The steps are clear for C but...

 

Thanks,

Geoff

Download All
0 Kudos
Message 4 of 15
(393 Views)

ZYOng...

 

Thanks for the pointers, I'll take a look at them a bit closer.

 

Geoff

0 Kudos
Message 5 of 15
(392 Views)

Microsoft CoPilot seem to be able to shed some light and examples on using DAQmx in APWin Basic, have you tried the examples from ChatGPT or other AI tools?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 6 of 15
(389 Views)

Great tip! I'll see where that leads me.

0 Kudos
Message 7 of 15
(373 Views)

santo_13,

 

Well, ChatGPT was of some help but I'm stuck.

 

I cannot find the .dll to include in my procedure. I have searched for DAQmx.dll and nidaqmx.dll. I did find some files with those prefixes but they all have other specifiers in their names.

 

I tried writing a test procedure but it looks as though without the .dll I can't move forward... or?

 

ChatGPT suggests:

DECLARE FUNCTION DAQmxCreateTask (taskName AS STRING) AS LONG
DECLARE FUNCTION DAQmxCreateChannel (taskHandle AS LONG, channelName AS STRING, nameToWrite AS STRING, terminal AS LONG) AS LONG

 

In APWin I believe the Declaration statement must be replaced with Public to make the functions global.

 

Public FUNCTION DAQmxCreateTask (taskName AS STRING) AS LONG
PublicFUNCTION DAQmxCreateChannel (taskHandle AS LONG, channelName AS STRING, nameToWrite AS STRING, terminal AS LONG) AS LONG

 

What is odd is when I try to run the procedure, The first line executes with no complaint but the procedure hangs at the second line. I tried changing the data types to ones used by APWin Basic with no success.

 

That's it at this point.

0 Kudos
Message 8 of 15
(360 Views)

I did find the wrapper: 'niDAQmxBaseWrapper.dll' .

 

I have included that but my procedure still hangs at the second line.

0 Kudos
Message 9 of 15
(357 Views)

Since APWin Basic is from AudioPrecision, have you tried reaching out to them on how to call a C-DLL in their version of language?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 10 of 15
(342 Views)