Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write voltage and frequecy to PCI-6731?

Hi Every boddy!
I am new to NI-DAQmx and i want to write 0v to 5v to PCI-6731 card.please help me.
i am using Visual Basic 6.0
what is the procedure for that? and not only voltage frequecy also.
my intention is to test the EGR controller using NI PCI-cards.
please help me its urgent......
0 Kudos
Message 1 of 15
(10,792 Views)
Hi NI_DAQ,

To get you started, I assumed that you have installed NI-DAQmx. There are examples for Visual Basic 6.0 if you have installed the support for it. The examples can be found by following the instructions in this article. The example which will be of interest to you is in Analog Out » Generate Voltage » Cont Gen Volt Wfm-Int Clk. Both the amplitude and the frequency of the output signal can changed in this example.

Some other links which may help you get started using DAQmx can be found at Getting Started with DAQmx.
Let me know if this helps.

Regards,
Kent
Applications Engineer
0 Kudos
Message 2 of 15
(10,771 Views)
Hi..
Thanx for ur reply.i saw the example code.it is very useful.i have some more quries.i want to write voltage and frequecy Continuously.it means one after another in different channel with one task. is it possible.
for testing purpose can i use Measurement & Automation?
if it is how to test my application.can u provide me steps or procedure.
for example in my vb application i am writing 4.5V to "Dev1/ao2". how to make sure that i am writing 4.5V to that particular channel from Measurement & Automation?
please help me its urgent.
0 Kudos
Message 3 of 15
(10,769 Views)
HI NI_DAQ,

You can create multiple analog output channels in a task using the DAQmxCreateAOVoltageChan function. This will require modifying the example since the current VB example is set for only one analog output channel. You can use the NI-DAQmx C Reference help to find the functions you need. It can be found in Start » Programs » National Instruments » NI-DAQ » NI-DAQmx C Reference help.

Another thing that may help you is to use the NI-DAQmx C examples can convert it using the same article I showed you before. Hopefully this will help you get started.

The only way for you to see your output would be to read it back externally since the PCI-6731 is only an analog output module. This can be done using an external device or connecting to another card which can do analog input.

Regards,
Kent
Applications Engineer

0 Kudos
Message 4 of 15
(10,752 Views)
Hi !
I got your point.i have one more query.
for ex i am creating one task using "DAQmxCreateTask "function and writing analog voltage to that using "DAQmxCreateAOVoltageChan()".
my question is i want to stop that task.
u can say that using DAQmxStopTask() and DAQmxClearTask() u can stop the task.
yes it is possible.

suppose i am running the task and i did not close that task in my application and i closed my application.when i try to write value to that particular task and particular channel i am getting errot saying that

"The specified resource is reserved. The operation could not be completed as specified"
i know that particular task is still using that particular channel.
i want to release that channel how to do that
please help me...
0 Kudos
Message 5 of 15
(10,745 Views)
Hi NI_DAQ,

You are correct in saying that you must stop and clear the task. If the program aborts before those functions can be called, there are a few things which can be done. A clear task can be run with that device name to free up the resources or the device can be reset. Below is a screenshot which shows how the device can be reset in Measurement and Automation Explorer (MAX).



Let me know if this helps.

Regards,
Kent
Applications Engineer


Message Edited by tnek on 04-11-2008 01:33 PM
0 Kudos
Message 6 of 15
(10,728 Views)
Hi.. Thankx for ur reply... there is one more query that i have is. i want to get installed device's channel name? for example i have virtualy configured NI PCI 6221(68-pin) card using Measurement and Automation explorer where i can have 6221 card virtually. my question is how to get channel name. for example 6221 has 16 analog output channel from "Dev1/ai0" to "Dev/ai15".my application i want ot listdown all channel's by default. if i have 3 or 5 or more devices... all device's channles should get listed by default. it means my application should detect which device is installed and should get its channel name.... can u give me example of vb code? please...its urget....
0 Kudos
Message 7 of 15
(10,634 Views)
Hi NI_DAQ,

You can query the MAX device database in VB using a system property function: DAQmxGetSysDevNames() [1]. This will return an array of the device names installed on the system and you can learn which devices are on the system.

The channel names themselves are always fixed -- ai0 is always the first analog input channel on any device that has analog input channels. To get the list of channels available on a device, use the command DAQmxGetDevAIPhysicalChans() [2]. This returns the channel names for the analog input channels on the device.

My recommendation for you is to get a list of the devices that are installed in the system, match them against names you know would have the functionality you need, and then select that device name. From there, get the list of channels available on that device and then build your task.

[1] NI-DAQmx C Reference Help, List of System Properties

NI-DAQmx C Reference Help » NI-DAQmx C Properties » List of System Properties » Device Names

[2] NI-DAQmx C Reference Help, List of Device Properties
NI-DAQmx C Reference Help » NI-DAQmx C Properties » List of Device Properites » Analog Input


Message Edited by Joe F. on 04-23-2008 04:53 PM
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 8 of 15
(10,626 Views)
Hi Thanx for ur reply... as now i don't have any device installed in my pc.can get that devicename and its channel from my vb code whichever configured virtually in Measurement and automation software ? i can see in measurement and automation software what i have configured virtually.(See 1.jpg) from my vb code using function "DAQmxGetSysDevNames()" can i get "NI PCI 62221" and its channel name using function "DAQmxGetDevAIPhysicalChans()" i.e device's channel like "Dev2/ai0" etc... upto "Dev/ai15"? can u please provide me an example vb code? please its urgent... Thanx...
0 Kudos
Message 9 of 15
(10,619 Views)
Hi NI_DAQ,

Yes, those two functions will return valid channel and device names for simulated devices. The documentation on those two calls is fairly straightforward in the Help file, so I will leave the coding as an exercise for you 🙂


Message Edited by Joe F. on 04-24-2008 05:34 PM
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 10 of 15
(10,612 Views)