Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the frequency of a finite/continuous pulse train in the program?

Hello!...

I am trying to modify the Finite pulse train vi example to change the frequency with respect of a ratio (1:2) of the data of a spreadsheet file as they are read one by one.

My aim is to get the pulse train to clock a stepper motor controller, in such way that the speed of the motor increases when the data of the spreadsheet increases and vice-versa.

I think that if I want to get the clock to change its speed, I must change the frequency and if I want it to increase/decrease like the data in the spreadsheet, I must tell the frequency that the data is increasing or decreasing in value.

Obviously the program must do it while it is running

Can anyone see wh
ere I have gone wrong and/or give any suggestions?

I have attached my vi and the spreadsheet file.

Thanks

Tiano
Download All
0 Kudos
Message 1 of 2
(3,251 Views)
Tiano,

Try to build the pieces of the program separately. Get a VI running that reads the spreadsheet and reports the data in it sequentially in an indicator (forget about the pulse generation at this time). This indicator will be wired to the frequency input of the pulse generator VI.

You have read the data and have a transposed array. Now you must learn to use the Index Array function in a For Loop to extract the data sequentially. You will wire the increment output [i] of the For Loop into Index Array to shift from one data point to the next.

You have a For Loop with no constant wired to [N] to tell it how many times to run. If you use Array Size to extract the number of entries in the spreadsheet data, this can be the constan
t that tells the For Loop how many times to run.

You are using the Tab Control in a way I have never seen before (I don't think it will work this way either. Tab Control is for presenting and hiding controls, indicators, labels, etc. on the front panel, before running the VI. They are not used to control the program functionality itself. Typically you would use a Boolean to choose between 2 options for a Case Structure.

You can also change the path constant which selects the spreadsheet file into a control. This would allow you to browse for any file you want and eleiminate the need for the Case Structure altogether.

Mike
0 Kudos
Message 2 of 2
(3,251 Views)