Analog and digital inputs of an ECU

How do the analog and digital inputs of an ECU work?

Reading time: 4 minute

The input for an ECU is a switching element that can be influenced by the user, who changes the voltage level in the circuit by activating some buttons.

Buttons, switches represent the way in which the user controls the operation of the electronic module (ECU). An ECU must have a block dedicated to taking over and interpreting the signals obtained from the buttons.

Input state, Pull up, Pull down

Any entry can have at least two states (active and inactive). An input is in the inactive state, if the corresponding button is in the released position "0 if applicable". Any other position of the button will cause the input circuit to enter an activation state.

Depending on the configuration of the input circuit they can be circuits with "Pull up" or "Pull down". An input circuit with Pull up will have the logic value 1 in the idle state. An input circuit with Pull down will have a logical value of 0 in the idle state.

Examples of "Pull up" and "Pull down" entries

Logical levels of digital inputs

Digital inputs are circuits that have a bolean operation (they can have the value 0 logic "FALSE" or 1 logic "TRUE"). By pressing the button, the voltage level in the input circuit will change from 0 to 1 or from 1 to 0, and when the button is released, the circuit will return to its initial state. The state of the digital input circuit is analyzed by uC on a pin configured as a digital input.

The state of the digital input is determined only when the voltage level in the input circuit is in the corresponding area. The voltages that delimit the state of a digital input are called logical levels.

When actuating the switch in the two cases (presented above), the value of the voltage present on the digital input can be 5V or 0V. These values ​​meet the logical level conditions of the input, the input state being determined.

If the switch contact is defective then the value of the voltage present on the digital input can be between the logic levels, the state of the input being undetermined.

Analog input, ADC (analog to digital converter)

An analog input is used when the exact value of the voltage in the input circuit needs to be read. The state of the analog input is analyzed by uC on an analog input pin (ADC). The voltage value in the analog input will be converted to a digital value on a set number of bits, number that determines the resolution of the acquisition.

What is an ADC and how does it work?

ADC is a functional block in integrated circuits whose function is to convert a DC voltage into a digital value that can be stored.

An ADC block is characterized by the number of bits on which it converts (resolution) and the reference voltages. The reference voltages are usually GND and VDD.

A limited number of bits on which the storage is done involves a quantization of the values ​​that can be stored. 8 values ​​can be written on 256 bits voltage between GND and VDD. 12 values ​​can be written on 4096 bits.

We can consider a digital input as an input that converts and stores 1bit. Thus it can store 2 voltage values, 0 or 1, where we will know that we have 0V or 5V if we have the references GND = 0V and VDD = 5V.

Digital voltage value is obtained by successive comparisons reducing the reference range and comparing the signal with half the current reference voltage.

Example of operation of an ADC

For a 4-bit conversion, 4 successive comparisons are made to determine the value of each bit. If the value of the circuit voltage is greater than half the current range then the value of the corresponding bit will be 1 and if the value of the voltage is lower, the corresponding bit will have the value 0.

The digital value of a voltage can be calculated as follows:

Digital value = ((Vmeasured * (no. Of possible values ​​/ Vref)) - 1

Calculation example:

  1. ADC, 8-bit resolution, reference voltage 0V - 5V;
    8bits => 256 possible digital values ​​(0 - 255);
    5V / 256 = 0.0195V = 19.5mV / digit;
    => 2V = 101 digital value, => 3V = 153 digital value.
  2. ADC, 12 bit resolution, reference voltage 0V - 5V.
    12bits => 4096 possible digital values ​​(0 - 4095);
    5V / 4096 = 0.0012V = 1.2mV / digit;
    => 2V = 1637 digital value, => 3V = 2457 digital value.

Analog input circuits are used to serve more complex switches. Usually the switch is a potentiometer, at the actuation of which the voltage in the circuit varies between the reference values. An example is the sensor that reads the fuel level.

These circuits are also used for inputs that can read more fixed voltage values. An example is the window button on the car door.

In this example, the switch has 3 positions. In the released position, in the circuit we will have 5V, driven down we will have 0V, and operated up we will have 2.5V. The analog input will generate different digital values ​​for all 3 situations, thus determining the status of the button.

Digital and analog multiplexing

The signals taken from the input circuit must be read on a corresponding uC pin. There are situations in which the number of uC pins available for inputs is limited and then the use of multiplexers (MUX) is chosen.

The multiplexer is an integrated circuit that has the role of successively puts the signals from several inputs on a single uC pin. To select which input will be read at a time, the MUX has 1 or more selection pins that are controlled by uC.

A multiplexer / demultiplexer circuit often used in automotive is CD74HC4051-EP manufactured by Texas Instruments.

The number of selection pins (no. Of address bits) determines the maximum number of multiplexer inputs. Ex: 1pin => 2intrari, 2pini => 4intrari, 3pini => 8intrari samd

Multiplexing can be digital or analog. Digital multiplexing involves setting the multiplexer output to 1 logic or 0 logic depending on the status of the selected input. Analog multiplexing involves repeating the voltage on the selected input at the output.

Bibliography:

https://sittinfo.blogspot.com/
https://www.ti.com/

 1,566 total hits, 3 hits today

Add a comment

Your email address will not be published.

The maximum upload file size: 2 MB. you can upload: image, audio, video, document, spreadsheet, Interactive, text, archive, queues, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here