From: jj6206 on 10 Jun 2006 05:10 Hi Experts, I am using the example "PWM-Counter Output" as a guide and modified it for my application. 3 differences are made. A counter input channel(CTR 0 GATE) is used instead of an analog input channel, an additional analog output channel(AO 0) is use to output a series of triggering square pulses to an ultrasonic sensor and a pid controller that allows to input all three P, I and D parameters. My system setup: i) AO 0 is use to output a series of square pulses to trigger 'ON' the ultrasonic sensor ranging. ii) Ultrasonic sensor's output signal was connected to CTR 0 Gate to measure the distance of a ball away from the sensor( i have modified the vi to output the distance in cm). The ball distance away from the sensor can be changed by varying the duty cycle of a dc fan mounted underneath the ball. iii) CTR1 OUT is use to generate PWM signals at various duty cycle( frequency is fixed at 50Hz) . iv) The original pid vi was modified to have all P,I and D mode available( From the simple pid demo example). Upon running the VI, i try to change my setpoint value but nothing happen to my hardware. The dc fan doesn't even turn 'ON' and the sensor wasn't displaying the current displacement of the ball. I have tested the sensor with the "measure pulse width" vi which i modified and it works well. I have also tested the dc fan with the "gen continuous pulses train" vi which also work alright. I have attached my overall vi for your reference. Please kindly give me your advice. Thankyou. Gen Dig Pulse Train-Continuous.vi: http://forums.ni.com/attachments/ni/170/189305/1/Gen Dig Pulse Train-Continuous.vi World_Cup.vi: http://forums.ni.com/attachments/ni/170/189305/2/World_Cup.vi Meas Pulse Width.vi: http://forums.ni.com/attachments/ni/170/189305/3/Meas Pulse Width.vi
From: Otis [DE] on 13 Jun 2006 12:40 Hi, The main thing that I would change would be the analog output section of your code. I see that you have a 'Calibration' button that if pressed should go to the T/F case and output a signal. However, since the Boolean is outside the loop, any changes to it will not update the case structure. Also, you will want to do something called non-regeneration with your analog output. By default when you do a continuous operation it will load the data in the memory and keep cycling thru that data. Since you want to change things you need to make sure that the data is not cycled thru. Attached is an example that shows you how to quickly update your analog output data. In your case you may want to simply have the Simulate Signal Express VI in the case structure and for the True case generate your signal, and for the False case generate your a DC value. Regards, Cont_Gen_Voltage_Wfm-Int_Clk-Non_Regeneration-Rapid_Update.vi: http://forums.ni.com/attachments/ni/170/189673/1/Cont_Gen_Voltage_Wfm-Int_Clk-Non_Regeneration-Rapid_Update.vi
|
Pages: 1 Prev: dtmf example Next: controlling eurotherm 2404 using El Bisync protocol |