 Gopaluni
		
			Gopaluni
		
		
		
		
		
		
		
		
	
			03-13-2008 05:50 PM
03-14-2008 03:22 PM
Hi Gopaluni,
The solution that seems the easiest to implement would require hardware that supports change detection. Change detection allows you to detect changes on multiple lines for rising and falling edges. You can see some more details here.
It seems perfectly logical that you would run into trouble with your analog input when you have high rotational speeds, as your 6052E has a maximum (aggregate) sampling rate of 333 kS/s. One signal alone produces 131,072 edges (65,536 * 2). A and B together produce 262,144 ticks in one single revolution, which is close to what you will get out of the card!
A better way to approach helping you is to have you detail what your plans are for the analog signal. Do you really need a sample for every tick, or would you be OK doing what you’ve already mentioned with using signal A as a sample clock? In other words, what is the desired end result of all your analog data? What sampling rates are you hoping to achieve on these signals?
03-18-2008 12:36 PM
 Kevin_Price
		
			Kevin_Price
		
		
		
		
		
		
		
		
	
			03-18-2008 01:12 PM
Maybe I'm oversimplifying, but I'm getting the impression that you've gotten pretty far down the path toward a solution by taking a number of distinct reasonable steps. And now you're kind of stuck. Let's back up a bit and see if a *different* set of reasonable steps might work.
1. The way NI's boards handle PWM measurement, you won't be able to sample a PWM value at a constant rate. If you measure PWM of a TTL pulse train using a counter, you'll be buffering values at whatever instants the TTL signal makes digital transitions. Consecutive pairs of these "semiperiod" measurements will let you figure out your PWM %, provided you're careful to keep track of which one represents on time and which one represents off time. If your PWM is an analog signal, then you can sample it at a constant rate but you won't update your calculated PWM value very often.
2. It isn't clear to me why you *need* to capture data on the encoder transitions. Since you have encoder position resolution that is 10x the needed measurement resolution, I'd think you could just use a constant rate shared sample clock to capture your analog voltage and encoder position. The main catch is that you'll need to sample fast enough while moving slow enough to capture points at (nearly) every 0.00137 deg of position.
3. Finally, if you need to correlate these points to PWM, you'll need to sync the tasks so that they have the same t=0 point. I would configure the encoder task to use the AI sample clock as its own sample clock. Then I would configure the AI task to use a digital start trigger. I would finally configure the PWM counter task to use the same trigger signal as an "arm start" trigger. (This is special terminology for counter input tasks). With this method, high speed rotation will simply produce less position resolution, but your tasks won't produce errors.
-Kevin P.
P.S. If you were starting from scratch, I'd 2nd the suggestion from Mark to consider an M-series board with change detection. A single board could capture encoder, PWM, and analog with the approach I just described. Plus the change detection would allow you to experiment with capturing on encoder edges as well. Note however that capturing with change detection means that you don't have any known time information in your measurement, and it'll be difficult to correlate to the PWM.
03-19-2008 05:06 PM
 Kevin_Price
		
			Kevin_Price
		
		
		
		
		
		
		
		
	
			03-20-2008 09:33 AM
 AlphaLimaIndia
		
			AlphaLimaIndia
		
		
		
		
		
		
		
		
	
			04-17-2008 02:24 AM
Sorry to hijack this tread, but I have a similar question, which can't be met with the solutions suggested previously. I am quite stuck and need to resolve this quickly. Buying hardware is not a big issue now, buying consultation time is a bit harder so I hope I can get help this way. I don't have a budget for a PXI rack, must fit expenses to reasonably priced PCI-cards/USB units.
Situation:
I need to measure and display the operation of a 4x rotational encoder with A & B pulses operated by PWM-signal. At the moment I have 2 x 6601 units and some older low-cost DAq-card for PCI. The information required is:
- Rotational speed (rpm) at each encoder transition. (maximum 4x changes at 1khz)
- PWM at each encoder transition (frequency varies between 50Hz to 40kHz)
Optional:
- analog voltage at about 5kS/s (brake cylinder position indication +10...-10V from a laser)
So I basicly have to show a graph where X-scale shows transitions in A and B, for a maximum amount of maybe 1000,and the same amout of PWM-levels, all triggered so that a single PWM-value corresponds to a single speed value. If at all possible, the same graph should show analog voltage, which should be sampled at a minimum of 5000kS/s. And all of these should be syncronized so that you can really tell the point where. See attached picture for explanation. I took the speed input I already have to Excel and added the PWM and analog signal with Windows Paint.
Measurements:
1. Rotation speed at each transition of A and B. The way I see it, I just count semiperiod durations with 6601 into an array and count the rotational speed from this. Simple as that, and have already implemented this
2. PWM: I am lost on how to sample the PWM only when transition occurs or somehow else syncronize them with the A and B pulses. I have different systems to measure, one gives me a PWM freq of 50Hz, so with 800 transitions of A and B you get only about 50 PWM pulses, and an other system with PWM f=40kHz gives me 40 000 pulses at 800 transitions.
I tried to just extend the shorter array (PWM or speed, depending on PWM freq) to match the longer, but it wont do, the designers want to see PWM by encoder transition, as the processor calculates a new PWM value every time a pulse occurs so these should be shown together and in sync.
3. analog measurements: I have no idea on how to get 800 transitions/pwm-levels and 5000 analog results into a single graph and so that it really is syncronized so that the designer can really be sure on if the brake activation happens at the right encoder transition. If this is not possible then I have to find another way (maybe just show analog form of A and B signals).
Thanks in advance if anyone can help me!
 Kevin_Price
		
			Kevin_Price
		
		
		
		
		
		
		
		
	
			04-18-2008 10:31 AM
 AlphaLimaIndia
		
			AlphaLimaIndia
		
		
		
		
		
		
		
		
	
			04-22-2008 01:26 AM - edited 04-22-2008 01:29 AM
Sorry about my incomplete first post concerning my application. English is not my first language.
Application:
I am measuring an linear drive unit, where a PWM-controlled DC-motor (though a H-bridge) drives a screw up and down. Feedback from the drive is done by X4 A B encoder. The processor calculates and adjusts the PWM-level every time an interrupt is generated from A or B lines. The system uses a sort of PID-algorithm, where the relevant parameters are rotation speed (calculated from the time difference between last interrupt and the newest) and position in relation to the target position. The A and B signals are generated with a led that shines through disc that rotates with the screw and has 7 grooves cut into it, so that each rotation creates 14 state changes/signal/rotation.
Measurements: The designers want to validation their design by measuring the PWM-level after each interrupt (change of state at A or B lines) and show them at a same scale. They also want to see some analog measurements in the same graph just to make sure that some peripherals work as specified. My problems in another format: 1. How to sync PWM measurements with linear encoder state changes from 2 channels so that I can create a graph with individual state changes as X-axis with 2 plots on the Y-axis: rotational speed plot and PWM-plot? so of my application drives for 20 encoder state changes(position changes), I would get the following information:
Position Rotational speed (rmp) PWM %
1 3000 100
2 3400 90
3 2300 70
4 2360 65%
....
19 1900 30%
20 0 0%
I really cant figure out how to measure them so that I can reliably sync or resample both signals. pwm freq ranges from 40kHz to 50Hz between different configurations so that in one measurement I get 200 PWM-cycles for 60 encoder state changes and another gives me 30 000 PWM cycles for the same lenght of movement. The designers are not content with me just resizing the shorter array to display both rmp and PWM in the same graph, the measurements MUST be synced to the encoder state changes.
2. I also should be able to measure analog measuremets at about 100-200kS/s and display this in the same graph as the above, but I am pretty sure this cant be done, as Labview does not include a way to show different X-axis plots in the same graph (encoder/pwm measurements will have X-axis length of 1-1000 measuments while analog measurements will have >100k measurements in the X-axis.
Is it possible to sync and display different X-axis lenghts in the same graph?
At the moment I have:
1 pcs E-series DAQ
1 pcs M series 6221 daq
2 pcs 6601 counter.
 Kevin_Price
		
			Kevin_Price
		
		
		
		
		
		
		
		
	
			04-22-2008 07:46 AM