# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Mei,

I'm puzzled.  Wish you could "drop by" and show this to me.  The Figure you put in your Post seems to "show the right thing", namely a 5-second sample of a 1 Hz Triangle Wave + a 1-second "stair-step function" (which should take 5 seconds, and seems to do so on the graph).  You say that the output wave frequency is 5 Hz -- how did you determine this?  If you get 5 "peaks" in 5 seconds, that would be (5 peaks)/(5 seconds) = 1 peak/sec = 1 Hz.  When you looked at the signal with an oscilloscope, if you sent the sweep rate to 1 sec/box, did you see Triangles and Steps that were 1 box wide?  If so, this is 1 Hz, not 5 Hz.  Otherwise, your code looks OK, and I would expect it to run as "I would expect it to run" (sorry about that strange sentence).

I'm currently at NIWeek, and away from my lab, so I can't try out your (or my) code with a real NI Multifunction Device and a real oscilloscope.  I'll also be away the following week, but I hope you get this figured out beforehand.  Sorry to have to "abandon" you at this time.

Bob Schor

Message 21 of 38
(382 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Hi Bob,

Many thanks. I measured the period of the wave, it is 200ms which is equal to 5 HZ (so I think its frequency is 5 HZ), and I used a time count function in the program to record the whole time, which shows around 1s for 5 periods on the figure. Now, I try a NI board  to test the upload program (only replace the ULxl vi by DAQmx vi) as johntrich1971 says it is the driver's reason. And  Error 200479 always occurs (it runs well with the ULxl vi), so I cannot tell you whether it is the driver reasons before I solve this problem. Do you need any more information about my problem?

Thanks,

Mei

Message 22 of 38
(377 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

No.  I don't know the ULx hardware, but it is not too surprising that DAQmx, made for NI devices, doesn't work with this third-party hardware.  As I explained, I'm "away" from my own hardware (I might be able to do a test this Friday), but I agree that there seems to be a strange "factor of 5" in the way your device functions compared to what I expect from DAQmx.

Wait a minute -- the code you posted was DAQmx code, but your device doesn't seem to be a DAQmx device!  Something strange is going on here.  Now I'm worried about the very first DAQmx function -- how do you define the DAQmx Task?

I've got to run -- I'm giving a talk here in a few hours and need to make a few small changes.  Here are a few last-minute questions:

• Is this code part of a LabVIEW Project?
• Did you create an Analog Output Task for this device in MAX?
• Did you create an Analog Output Task for this device in the Project (if there is one)?
• How does the Device show up in MAX?  What other devices show up in MAX?  [A screen shot of the left-hand pane in MAX with Devices and Interfaces expanded and the blank white space below the listing eliminated would be helpful.]

Bob Schor

Message 23 of 38
(362 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

I recreated the changes that I had made. You're getting the Error -200479 because you were automatically starting the task and then starting the task. I annotated my changes in the attached vi. If you make those changes it should work.

Message 24 of 38
(359 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Hi johntrich,

Thanks. But is it possible for to save an early version (e.g 2014) or post an image? I cannot open your vi, it is too new.

Thanks,

Mei

Message 25 of 38
(353 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Hi Bob,

I run the code with ULxl.vi for the measurement computing board, for convenience, I changed the ULxl.vi to the DAQmx vi when uploading the code here. And now I try the uploaded code with a NI board, but there is an error to stop me get the result. I only can make it run with one channel,  hope later johntrich1971  can upload an early version to solve the error 200479.

For the questions:

1. NO. This is all the code for this project at present, because I am stuck here for a long time.

2.Yes, I created an Analog Output Task for this device in MAX.

3. I think yes?  I put a 'creat channel' vi at the beginning of this project.

4. Hope my screenshot is right..

Thanks,

Mei

Message 26 of 38
(340 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Hi johntrich,

Are there two changes in your version? I got the error 200290 after correcting the code with your instruction. I used a NI card this time.

Thanks,

Mei

Message 27 of 38
(327 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Yes, I marked both of the changes in my version. The one that is causing the error is the TRUE that you are giving for autostart (or, more precisely, the fact that you are starting the task after this TRUE). I changed the TRUE to FALSE but could have just as easily gotten rid of the explicit start.

Message 28 of 38
(324 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Mei,

The screenshot is "right", but I only need the information in the left-hand pane, without all the whitespace at the bottom.  When I open your picture on my laptop, everything is too tiny for me to see anything in the Devices and Interfaces entry.  Can you capture only the left panel where the data are present (i.e. without the large blank space at the bottom)?

Bob Schor

Message 29 of 38
(321 Views)

## Re: Why is the generated wave frenquency diffrerent from the set frequency in the program?

Hi Johntrich,

Thanks. Then I do not miss any changes you made, but mine is still working well with Error-200290. It seems something wrong the 'wait until done' vi, do you get this error?

Thanks,

Mei

Message 30 of 38
(315 Views)