The present application claims priority of Italian Patent Application No. T02007A000189 filed Mar. 14, 2007, which is incorporated herein in its entirety by this reference. invention relates to techniques for performing function
The invention relates to techniques for performing functions of analog-to-digital conversion, i.e., the conversion of analog signals into digital (or “numeric”) signals.
Today, in the majority of microcontroller units (MCUs) a single analog-to-digital converter (ADC) is used connected to different inputs via an analog multiplexer. The user usually has the possibility of programming a register of the sampling time with a value identical for all the analog channels of the converter. This sampling time cannot be modified during the scanning of the channels subjected to conversion.
Usually, the devices connected to the various inputs of the converter have, however, impedances that are heterogeneous with respect to one another and, consequently, would require a sampling time (i.e., a duration of the action of sampling) that is different from channel to channel.
If the user wishes to convert an individual channel, which has a particular sampling time, the user himself is able to adjust the sampling time before starting the action of conversion so as to adapt the value of the sampling time according to the output impedance of the device connected to the channel.
If, instead, it is desired to convert a number of channels operating in a scan mode, it is possible to establish an identical sampling time for all the channels subjected to conversion, without taking into account the fact that different devices with different output impedances will be connected to the various channels. In this way, the user can program the register of the sampling time so as to align it with the needs of the source that, amongst the ones connected to the converter, has the highest impedance and hence requires the longest sampling time. This gives rise to a sampling that is adapted to the worst case.
In any event, there does not exist the possibility of varying, during operation (or “run time”), the sampling time according to the channel to be converted, in particular when the various channels require different sampling times.
To mitigate this drawback, it is possible to consider converting the inputs operating by sets that have the same impedance. Clearly, this solution reduces the degree of flexibility of the scanning function.
Thus, there exists a need for solutions that will enable adaptation, in particular operating during run time and/or distinctly for each individual channel, the sampling time of the channels of a multichannel analog-to-digital converter according to the channel to be converted, the aim being to achieve a greater efficiency in the selection of the sampling time and to minimize the times required for the conversion of analog inputs with different impedances when the user wishes to convert a certain set of analog channels, operating in a scan mode. The solution described herein is aimed at meeting said need.
That object is achieved by a circuit for programming the sampling time in an analog-to-digital converter comprising a plurality of channels, including at least one memory register comprising memory locations respectively coupleable to the channels of the converter, said memory locations configured for storing a signal identifying a sampling-time value selected for the respective channel of the converter, and a converter module coupled to said at least one memory register for converting said signal identifying the sampling-time value into a corresponding signal for driving the respective channel of the converter with a sampling time corresponding to the sampling time selected for the respective channel of the converter.
The claims form an integral part of the technical disclosure of the invention provided herein.
In particular, in the preferred embodiment, the circuit described herein enables programming of a sampling time for each individual channel so that, when a conversion of a sequence of channels is activated, the sampling time of each individual channel is automatically calculated by the circuit in a hardware manner.
The invention will now be described, purely by way of non-limiting example, with reference to the annexed plate of drawings, in which:
The ensuing description refers to the possible application of the circuit described herein for programming the sampling time in a 16-channel multichannel analog-to-digital converter (
In the diagram of
The thirty-two bits of the register 10 can be viewed as organized in sixteen pairs of bits, i.e., sixteen memory locations (SAMPLE SEL0, . . . , SAMPLE SEL31), each of which is to store a pair of bits that enables identification (according to the logic values assumed by the two bits of the pair, i.e., 00, 01, 10, 11) of four different values of the sampling time for a respective channel from among the sixteen channels CH0, . . . , CH15 of the ADC.
In the example described herein, it is assumed that the ADC is to operate according to a scan mode, i.e., activating, one after the other in cyclic and orderly sequence (the order of scanning can be possibly programmable), the sixteen channels CH0, . . . , CH15 of the ADC.
When the channel 0 (which, with reference to the timing charts of
In this regard, it will be appreciated that, in MUX_samplesel, 16 groups of 4 bits each are illustrated, i.e., 64 bits in all. In the example illustrated herein, the inputs of the MUX_samplesel are in fact sixteen (each made up of two bits) because, in this example, the channels of the ADC are precisely sixteen, and associated to each of them are two bits of the register 10, which in turn enable selection from among four different sampling times through MUX_sampletime (the four bits are the value of chsel corresponding to the pair selected).
The four bits on the inputs of the MUX_samplesel indicate the value of chsel that selects the desired pair of bits of the register 10.
In the example illustrated herein, where each pair of values stored in the positions of the register 10 enables identification of four different values of the sampling time, the choice of the sampling time Sampletime occurs between four possible choices Sampletime1, Sampletime2, Sampletime3 and Sampletime4, brought to the input of the multiplexer 14.
Said values can be fixed in hardware form or else rendered in turn programmable.
Proceeding in the scanning of the input channels of the ADC, the position Samplesel_reg of the register 10 enables choice of the sampling time for the channel CH0 and so forth up to the channel CH15.
Since operation of the register 10 is synchronized with the performance of the scan cycle of the ADC, it is timed with a clock signal clk, whilst the ADC (as well as the circuit as a whole designated by 16 in
The diagram of
When the analog-to-digital conversion starts operating in scan mode, a signal start is asserted (see once again the ensemble of the diagrams of
In particular, the input of the flip-flop 18 is driven by a signal single_init_set coming from the output of an OR logic gate 20, which receives at input the signal start together with an activation signal set_eoc.
If, for the channel selected, the output Sampletime of the multiplexer 14 of
Specifically, the signal Sampletime is brought to one of the inputs of a comparator (with inverting output) 22, which receives, on its other input, the string of symbols “0000000”.
The output of the OR gate 20 and the output of the comparator 22 are combined to one another in an AND gate 24, the output of which is used for driving two other flip-flops 26 and 28 (cadenced by the signal clk), which generate, on their outputs, a signal sampleon and a signal start_sampling, respectively.
The signal sampleon is brought to an inverting input of a further AND gate 30, the other input of which receives the signal single_init coming from the output of the flip-flop 18.
The reference numbers 32 and 34 designate another two flip-flops (both cadenced with the signal clk_mux), which receive at the input, respectively, the output of the AND gate 30 and the signal start_sampling at output from the flip-flop 28.
The output signal of the flip-flop 32 represents the signal adc_soc used for driving the sampling function of the ADC.
The output signal of the flip-flop 34 (designated by adc_start_sampling) is used, on the one hand, as feedback signal to the flip-flop 28 and, on the other hand, for driving a counter 36 (e.g., a 7-bit counter), cadenced with the clock signal adc_clk.
The counter 36 supplies at output a signal Sampletime-1, which is compared, in a comparator 38, with the reference signal Sampletime. The output signal of the comparator 38 is brought to a further flip-flop 40 (also cadenced with the clock signal adc_clk). The output of the flip-flop 40, constituted by a signal adc_and_sampling, is used as feedback signal to the flip-flop 26.
If, for the channel selected, the output Sampletime of the module 14 of
In this way, the action of conversion (i.e., the interval or sampling time or interval of the ADC), represented by the signal adc_soc, starts on the first rising edge of the signal clk_mux (which, as already mentioned, constitutes the negated version of the signal adc-clk obtained via division by six of the main clock signal clk).
In particular, when the signal adc_soc is set, the flip-flop 18 that generates the signal single_init is reset and thus, at the subsequent rising edge of the signal clk_mux, the signal adc_soc is reset. In this way, the circuit sets its output adc_soc at a high level for a cycle of adc_clk so as to start the analog-to-digital conversion of the first channel.
The signal clk_mux is used for generating signals to the ADC on the falling edge of the signal adc_clk to prevent violations of the internal circuit of the ADC.
As may be noted in
If the signal adc_clk is asynchronous with respect to the main clock clk, a re-synchronization stage is used for the signals that traverse the two clock domains, without thereby altering the general structure of the circuit.
In the scan mode, after conversion of the first channel has been made, the ADC generates an end-of-conversion signal (possibly re-synchronized with the main clock signal clk and handled by the circuit so as to obtain the pulse signal set_eoc).
This signal starts conversion of the second channel of the sequence of the scan mode and has the same effect described previously on the signal start. The flip-flop 18 that generates the signal single_init is set and, if for the second channel subjected to conversion the output Sampletime of the module 14 of
It will be appreciated that the signal sample_on constitutes a sort of masking of the signal adc_soc, which drives the ADC for the purpose of delaying cycles of sampletime, the start of the conversion of the ADC increasing the sampling time of the converter itself (see once again
In the case of
After the signal start_sampling is set, at the subsequent rising edge of the signal clk_mux, the flip-flop 34 that generates the signal adc_start_sampling is asserted so as to start the counter 36 cadenced by the signal adc_clk, resetting at the same time the flip-flop 28, which generates the signal start_sampling (usually, a handshake is envisaged between the two clock domains).
The output of the comparator 38 goes to a high logic level when the output of the counter is equal to the value Sampletime_1, which indicates that the sampling is finished, determining, at the same time, setting of the flip-flop 40 that generates the signal adc_end_sampling.
The output of the flip-flop 40 resets the flip-flop 26 that generates the signal sampleon so as to de-mask the input of the flip-flop 32 that generates the signal adc_soc thus generating at the end the signal adc_soc on the rising edge of the signal clk_mux.
When the signal adc_soc is set, the flip-flop 18 that generates the signal single_init is reset and hence, at the subsequent rising edge of the signal clk_mux, the signal adc_soc is reset. In this way, the circuit 16 generates at output a high value for the signal adc_soc for one cycle of the signal adc_clk so as to start the analog-to-digital conversion of the second channel.
This procedure is repeated for all the channels in the sequence in scan mode.
It will be appreciated that the circuit solution represented herein in
It will likewise be appreciated that the solution described herein can be extended and generalized in so far as the bit field stored in the register 10 and used for programming the sampling time can be implemented in different ways.
For example, it is possible to use a single bit per channel (so as to distinguish simply between “low” impedance and “high” impedance, i.e., between “short” sampling time and “long” sampling time), two bits per channel (as previously described in the example) , n bits according to a linear law, (for example, 1, 2, 3, 4, 5, . . . ), or else n bits according to a non-linear law (for example an exponential law: 1, 2, 4, 8, 16, . . . ).
The solution described herein enables then dynamic adjustment, according to the channel to be converted, of the scanning time so as to obtain a greater efficiency and minimize the time occupied in the conversion of a number of analog inputs when a user wishes to convert a group of analog channels operating in scan mode.
Of course, without prejudice to the principle of the invention, the details of construction and the embodiments may vary, even to a major extent, with respect to what is described and illustrated herein purely by way of non-limiting example, without thereby departing from the scope of the present invention, as defined by the annexed claims.
Number | Date | Country | Kind |
---|---|---|---|
TO2007A000189 | Mar 2007 | IT | national |