LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 200290 when running a pulse count and pwm program together.

Hi guys,

Running two programs seperately, one for a pulse count from a hall effect sensor and the other is a pwm for a 0-24v dc motor. the programs run fine seperately but when i put the pwm into the pulse count program i get an error 200290.can someone give me a solution as i am new to labview and my daq.once done i am going to connect through a pid controller. I have found the error on NI put no soluion is given. there is mention about buffering and sampling but i am not that well up on labview.

 

Regards Anthony

0 Kudos
Message 1 of 33
(3,650 Views)

Hi Anthony,

 

Would it be possible for you to attach your code? The error is very general, do receive a particular error message with the code? Can I confirm you're using a myDAQ?


ShalimarA | CLA
0 Kudos
Message 2 of 33
(3,606 Views)

Hi Shalimar, thank you for replying, attached is my code and the code error that appears.

 

Regards Anthony Bracken

Download All
0 Kudos
Message 3 of 33
(3,595 Views)

Hi Ali,

I forgot to confirm that it is a My DAQ that i am using .

 

Regards Anthony Bracken

0 Kudos
Message 4 of 33
(3,585 Views)

The error message, while perhaps vague, describes your problem accurately.

 

In the read task, you're reading 100 samples at 1.29kHz, which, if I've done the math correctly, takes about 77ms. This is currently the limiting factor for your loop rate: it waits until it can read all those samples.

 

In the write task, you're only generating 200 points at 100kHz, and you've told the write task to use the waveform timing. That means you're only generating 2ms worth of data on each loop iteration. Since each loop cycle requires 77ms to complete (to read all 100 samples), you get an error saying that you haven't written enough data.

 

You don't need to generate square wave samples at 100kHz since it's a square wave with a frequency of 1kHz. If you match the sample generation to the rate at which you read samples, it will work better. You could also split your code into separate while loops so that the read and write tasks can run at different speeds.

0 Kudos
Message 5 of 33
(3,574 Views)

Hi, thanks for your response.

I have matched the read and write samples and have got rid of the error but what happens now is that the motor runs at a constant speed. i need to be able to varie the motor speed as i am looking to control this system through a PID.

 

Regards Anthony Bracken

0 Kudos
Message 6 of 33
(3,555 Views)

Hi nathand,

I forgot to mention i put the PWM into a awhile loop and placed it into the exsisting while loop and create a commom stop button. the problem with this is that the pulse counter will not work, i can varie the speed of the motor but cant count the revs per min/second.

 

Regards Anthony Bracken

0 Kudos
Message 7 of 33
(3,553 Views)

Please attach your revised code.

 

By separate loops, I meant that the loops should be entirely separate. If you put the PWM into a loop inside the bigger loop, then of course you will not be able to measure the revolutions, because the outer loop will only execute once and then wait for the inner loop to end before the outer loop runs again.

0 Kudos
Message 8 of 33
(3,548 Views)

Hi nathand,

I have changed the No of samples in the simulate signal box to 1000 and left the frequecey and samples per sec the same.the samples to write are now also 1000.

When i run the program and move the slider for the motor it switches on at a certain level but remains at a constant revs per minute which is 3000.

Can you help with this as i need to be able to varie the speed before connecting to a PID.

 

Regards Anthony Bracken

0 Kudos
Message 9 of 33
(3,541 Views)

You still do not have the timing correct. You are telling the Simulate Signal block to generate 1000 samples at a rate of 100000 samples/second (note - this is completely independent of the signal frequency). In the DAQ assistant you then write out those 1000 samples over 1 second, but those samples represent 0.01 seconds of the waveform.

 

Does your myDAQ have a counter/timer output? If so, that's an easier way to generate a PWM signal.

0 Kudos
Message 10 of 33
(3,536 Views)