LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

low duty circle

Hallo all,
I'm trying to a signal generator to produce square wave with adjustable duty cycle, but I find the lower limit of the duty cylce is 0.5, which cannot meet the needs of my experiment. I'd like to know how to further reduce the duty cycle using this function, whether there is a better alternative offered by labview.
 
win2s 
 
0 Kudos
Message 1 of 9
(2,813 Views)

I design a vi program to measure analog signal and at the same time produce square wave with adjustable duty cycle. The signal generator part is modified from a file recommended in the post

http://forums.ni.com/ni/board/message?board.id=170&message.id=256464

However the code doesn't go smoothly after two pulses are generated. Could anyone adept at this field give me any clue on this issue?

Best regards,

 

0 Kudos
Message 2 of 9
(2,799 Views)
One thing you could do is for duty cycles less than 50% add 50 to the percentage you want and invert the output signal. For example, if you want a 25% duty cycle, add 50 to 25 and set the duty cycle to 75% - on 75% of the time off 25% of the time. Now invert the signal and you get one that is off 75% of the time on 25% of the time.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 9
(2,790 Views)
If there is a software solution, that's great, but if I got stuck or couldn't get the duty cycle low enough due to hardware limitations, I would breadboard a circuit. My digital circuit skills are a little rusty, but a search found some circuits for generating low duty cycles from clock signals.
0 Kudos
Message 4 of 9
(2,780 Views)
Hallo mikeporter,

thanks for your tips. Sorry for my bad understanding in math. Can you explain me more on this trick?

thanks a lot in advance,

win2
0 Kudos
Message 5 of 9
(2,768 Views)
Actually, I realized that I explained it wrong previously, instead of adding 50 you want to subtract the desired duty cycle from 100 to get the setting for the generator and then invert the output - sorry for the confusion - too early in the morning...

The definition of duty cycle is the percentage of the period that the signal is in the high state, so a 50% duty cycle is low for half the period and high for half the period. In the same way, a 75% duty cycle is low for 25% of the time and high for 75% of the time. Now if you invert the signal (make the lows high and the highs low) you have a signal that is low for 75% of the time and high for 25% of the time - or a 25% duty cycle. So 100-25 = 75 the setting for the generator.

Likewise say you want a 10% duty cycle. 100-10 = 90 as a setting for the generator. Invert this output and you get a 10% duty cycle output.

By the way to invert a square wave signal that varies from 0 to 1: subtract 1 and take the absolute value of the result. (0-1 = -1, abs(-1) = 1; 1-1 = 0, abs(0) = 0)

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 9
(2,761 Views)
If you want finer resolution on your duty cycle you may want to modify the way you generate your arrays. Look at this demo. It will produce duty cycles of any fraction 0 < d < 1 which can be expressed by the ratio of two I32 integers.

Fully initializing your array outside the loop and using replace array element inside is more memory efficient if you will be using large arrays.

Lynn
0 Kudos
Message 7 of 9
(2,756 Views)
Thank you johnsold for the demo vi with finer duty cycle. So far I have not integreted this new method into my vi file. I'm just curious why my version doesn't work out since all the initialization for the array is outside the loop in my case. Could you give me some clues on my problem?
 
Thanks again
 
 

Message Edited by win2suse on 07-13-2007 03:50 AM

0 Kudos
Message 8 of 9
(2,733 Views)
Actually your program can give fine resolution also. The attached file is the result of extracting the array generator from your program.

The things about it which may be of concern, depending on your final application:

1. The array size increases twice each iteration of the for loop. This requires memory allocations which may slow the program considerably if the array gets large. My earlier version precalculates the size and allocates the memory for the array once.

2. The duration or period of each cycle can vary depending on what the user enters for high and low ticks. If the period is to remain constant from cycle to cycle, the fixed period and duty cycle entry mode is less prone to errors. If you want variable length cycles or you trust your user to never make an addition or subtraction error, your method is OK.

Neither method handles the Initial Low Time very well. Yours always requires the voltage to be zero while mine uses the Low Voltage Level of the last cycle and subtacts the time from it. Similarly, neither method forces a return to zero (or any other predefined level) at the end of the test. Both leave it at the last value written (Low Voltage Level of last cycle). This may not be a concern for your system, but in general is something to think about.

Lynn
0 Kudos
Message 9 of 9
(2,719 Views)