Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

CWgraph!!!!!!!!???????

I am working with a project to draw a graph capturing output from an embedded system. when i am trying to draw a sine wave it is ok. but when i use the same code to capture square wave i get something like triangles. filling the region where i am supposed to see a square. any help would be greatly appreciated.
thanks
0 Kudos
Message 1 of 10
(9,087 Views)
Hello partha,
Have you set up a watch on your data or tried printing it to a textbox or console (Debug.Print in VB)? If your data does not resemble a square wave, then the CWgraph plot will not as well. Please check your data, it may be an issue with your waveform generator or how you have your data acquisition configured (maybe you are not sampling fast enough, what is the frequency of your sinewave, square wave, and DAQ sample rate?). If you want to see a nice clean square wave, then you probably want to sample 10 to 100 times faster than the frequency of your square wave.

Jeremiah Cox
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 10
(9,089 Views)
Hi,
 
Here is what I've done to go around this problem:
 
I'm watching the input value for a data change before sending it to the graph. When I see one, I add a new point to the graph with a timestamp just prior to the data change and the old value. I'm sending it 1 second before the data change, but what I'm trending is a boolean input from an I/O controler. You mignt need a shorter delay, perhaps a few milliseconds would be better. After that, I send the new value I've got from the input with his own timestamp to the graph. That way, the plotted data has one point at the begining of his horizontal line and another at the end. No more triangles!
 
I hope this can help.
 
Have a nice day,
 
Eric Brousseau
Software developer,
AIA Automation Inc.
0 Kudos
Message 3 of 10
(8,902 Views)

Hi Eric_B !

                I am also facing the same problem.i mean i have a CWgraph and i want to plot the square wave according to the value getting fromt he card.how do i do that?.can u give me the example code in vb.

               please help me..its urget.

              i hope u will reply soon..

Thanx

Vijay

         

0 Kudos
Message 4 of 10
(8,309 Views)

Hi Jeremiah Cox!

                I am also facing the same problem.i mean i have a CWgraph and i want to plot the square wave according to the value getting fromt he card(PCI-6221).how do i do that?.can u give me the example code in vb.

               please help me..its urget.

              i hope u will reply soon..

Thanx

Vijay

0 Kudos
Message 5 of 10
(8,306 Views)
Hello Vijay,

There is some VB6 example code that ships with Measurement Studio that should help you. 

Their default installation directory is:
C:\Documents and Settings\All Users\Documents\National Instruments\MStudioVS6\VB

Under that directory there are a number of examples that show how to use a graph located here:
Samples\UI\Graph

If you are using NI-DAQmx to aquire your data, that also ships with some VB6 examples.  Their default installation directory is:
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\Visual Basic 6.0

Please let me know if you have any questions about these examples.


Kristen
National Instruments
0 Kudos
Message 6 of 10
(8,266 Views)
Hi !
                But i don't get any example for getting square wave.there is one example code through which we can generate square wave.
i want to get.i don't want to generate.
 
for example there is one analog input channel through which i am getting 0V and 10V altenatively  with that i want to show square wave.
could u plz give an example code.
     its urget
hope reply soon...
Thanx.
Vijay
          
  
0 Kudos
Message 7 of 10
(8,256 Views)
Vijay,

The graph will plot whatever data you tell it to whether it is a sin wave, square wave, or anything. 

There are also some other DAQ examples that use the CWDAQ controls that come with Measurement Studio which are installed here:
C:\Documents and Settings\All Users\Documents\National Instruments\MStudioVS6\VB\Samples\DAQ\Analog Input

Kristen
National Instruments
0 Kudos
Message 8 of 10
(8,233 Views)
Hi !
          Thank you Very much for your reply..
                              I want to measure the ON time and OFF time of PWM signal which is connected to digital pin.
         How do i do that?.
        Can u give me an example code in vb. what are all the function to be used.
i found one function called "DAQmxCreateCIPulseWidthChan"  but after creating this task how to get the puls width on time and off time.
what is the next function to get that.
 for example
 
1.Creating the task
2.
                   DAQmxErrChk DAQmxCreateCIPulseWidthChan(taskHandle,"Dev1/ctr1","PWM",1,500,DAQmx_Val_Seconds,DAQmx_Val_Rising,"")
3.?
 
after this..what is the next function to get the pw of that signal. and also i want on time and off time.
i am using PCI 6221 card.
 
but i don't want the counter value.
there is one example code but it is not working.....always it gives 0
but when i measure in oscilloscope i am getting the pwm signal.
 
plz...reply soon...its very urgent...
 
 
 
 
Thanx vijay
 
 
 
0 Kudos
Message 9 of 10
(8,211 Views)
Hi vijay,
 
You can use counters to measure pulse width, frequency, and other time measurements of digital pulses. The NI-DAQmx Visual Basic 6.0 type library is based on the NI-DAQmx C API. Therefore, in addition to the installed Visual Basic 6.0 examples, you can also refer to the NI-DAQmx C API examples when creating a new NI-DAQmx application in Visual Basic 6.0.
 
This should get you going on measuring pulse width. C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Measure Period or Pulse Width should contain great information
 
Also, if you're creating a pulse train, you should already know the pulse frequency and duty cycle in which you can calculate the on and off time of a PWM. If you set up your pulse train to output at 50kHz with a duty cycle of 25% you'll know that the ON time is 5u seconds and the OFF time would be 15u seconds.
PBear
NI RF
0 Kudos
Message 10 of 10
(8,179 Views)