LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linx+Arduino Wrong frequency output of digital square wave generator

Hello

 

I am going to use linx to program a stepper motor control VI. The stepper motor driver I use is A4988 and TB6600. The stepper's rotating speed depends on the frequency of pulse input to the driver, so I use a digital square wave generator in linx to attain this request.

But now the output frequency 60Hz(which is shown in an oscilloscope) is not identical with the frequency 1Hz I input in my VI. I do not have any idea about this problem. 

square wave test.PNGswtest_1.PNG

 

 

 

 

 

 

 

 

Appreciate all of you helping me.

0 Kudos
Message 1 of 6
(1,471 Views)

Hi Luca,

May i know if the duration(ms) and channel match with your input when you run your Vi?

0 Kudos
Message 2 of 6
(1,412 Views)

Thanks for your reply~

swtest_2.PNG

As in the picture I put above, the channel is 7 and the duration is 1000ms. I tried to change the channel and frequency, but I cannot get the square as I expect.

 

 

0 Kudos
Message 3 of 6
(1,395 Views)

Is there are need for you to update the frequency all the time? 

Try to only set the frequency one time and see what happens

0 Kudos
Message 4 of 6
(1,385 Views)

Thanks, dkfire

 

   After I delete the while loop, the frequency is still about 60Hz as before. And there is a new problem. The duration I set is 40000ms, which means it might output a 40-second square wave. However, the square wave I get is more than 10 minutes. If the duration set 30000ms, the actual output time is about 1s(I record it by my smartphone's slow motion). The result is pretty inconsistent. I doubt the timer or clock in Arduino or Linx goes wrong. But I do not know how to check that.

 

Appreciate your help~

0 Kudos
Message 5 of 6
(1,381 Views)

Hi Luca, 

I helped to ask your question under Linx discussion forum, and I get a reply from a person and I think this might help you. You can go ahead and read through what's in the link

Linx+Arduino Wrong frequency output

Hope this helps

Fiona, NI

0 Kudos
Message 6 of 6
(1,369 Views)