ADAC click
ADAC click
ADAC click is an 8-channel 12-bit ADC, DAC and GPIO. It carries the AD5593R configurable ADC/DAC. The click is designed to run on either 3.3V or 5V power supply. ADAC click communicates with the target microcontroller over I2C interface, with additional functionality provided by the RST pin on the mikroBUS™ line.
How it works
Every channel can be set individually as ADC, DAC, or GPIO. The 12-bit conversion values are readable through I2C.
For resetting the IC, use the Reset pin (RST).
AD5593R IC features
The AD5593R has eight input/output (I/O) pins, which can be independently configured as digital-to-analog converter (DAC) outputs, analog-to-digital converter (ADC) inputs, digital outputs, or digital inputs. When an I/O pin is configured as an analog output, it is driven by a 12-bit DAC. The output range of the DAC is 0 V to VREF or 0 V to 2×V REF.
When an I/O pin is configured as an analog input, it is connected to a 12-bit ADC via an analog multiplexer. The input range of the ADC is 0 V to VREF or 0 V to 2 × VREF. The I/O pins can also be configured to be general-purpose, digital input or output (GPIO) pins.
Specifications
Type | ADC |
Applications | control and monitoring, measurement, etc. |
On-board modules | AD5593R 8-Channel, 12-Bit, Configurable ADC/DAC |
Key Features | 8 12-bit DAC channels, 8 12-bit ADC channels |
Interface | GPIO,I2C |
Peripherals include | Screw terminals |
Input Voltage | 3.3V or 5V |
Compatibility | mikroBUS |
Click board size | M (42.9 x 25.4 mm) |
Key features
- AD5593R configurable ADC/DAC
- 8 12-bit DAC channels
- 8 12-bit ADC channels
- 8 general-purpose I/O pins
- I2C interface
- 3.3V or 5V power supply
Pinout diagram
This table shows how the pinout on ADAC click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Additional pins
Name | I/O | Description |
---|---|---|
IO0 | Multipurpouse IO pin(ADC,DAC,GPIO)channel0 | |
IO1 | Multipurpouse IO pin(ADC,DAC,GPIO)channel1 | |
IO2 | Multipurpouse IO pin(ADC,DAC,GPIO)channel2 | |
IO3 | Multipurpouse IO pin(ADC,DAC,GPIO)channel3 | |
IO4 | Multipurpouse IO pin(ADC,DAC,GPIO)channel4 | |
IO5 | Multipurpouse IO pin(ADC,DAC,GPIO)channel5 | |
IO6 | Multipurpouse IO pin(ADC,DAC,GPIO)channel6 | |
IO7 | Multipurpouse IO pin(ADC,DAC,GPIO)channel7 | |
VREF | OPTIONAL | Used as input for connecting external VREF or output 2.5V from internal |
GND | OPTIONAL | Used for external connection to GND if VREF input is used |
Jumpers and settings
Designator | Name | Default Position | Default Option | Description |
---|---|---|---|---|
ADD SEL | Address bit | 0 | 3V3 | I2C slave address selection, set LSB of slave address 0010001x left pos, 0010000x right pos, (x=R/W) |
VCC SEL | Power supply | 3V3 | Supply Voltage Selection 3V3/5V, left position 3v3, right position 5v | |
LOG SEL | Interface power supply | 3V3 | Logic Level Voltage Selection 3V3/5V, left position 3v3, right position 5v |
Programming
Code examples for ADAC click, written for MikroElektronika hardware and compilers are available on Libstock.
Code snippet
The following code snippet demonstrates the use of ADAC click library functions. It will first set a pin as an analog output, showing DAC function, and will then set a different pin as an analog input, showing ADC operation.
01 UART1_Write_Text ("rnrnStarting DAC Operation..."); 02 Delay_ms (1000); 03 //Sets the IO3 pin as DAC 04 ADAC_setConfiguration (_ADAC_DAC_CONFIG, _ADAC_NULL, _ADAC_IO3); 05 //Rises the DAC output on IO3 from 0 to VREF 06 for (i = 0; i < 0xFFF; i+=4) 07 { 08 ADAC_writeDAC (_ADAC_DAC_WRITE | _ADAC_PB_PIN3, i/0x100, i%0x100); 09 Delay_ms (10); 10 } 11 UART1_Write_Text ("rnDAC Operation finishedrn"); 12 Delay_ms (1000); 13 14 15 UART1_Write_Text ("rnStarting ADC Operation..."); 16 Delay_ms (1000); 17 //Sets the IO4 pin as ADC 18 ADAC_setConfiguration (_ADAC_ADC_CONFIG, _ADAC_NULL, _ADAC_IO4); 19 //Sets the ADC sequence repetition to enabled, and adds IO4 to sequence 20 ADAC_setConfiguration (_ADAC_ADC_SEQUENCE, _ADAC_SEQUENCE_ON, _ADAC_IO4); 21 //Reads the ADC input, and writes it to UART1 22 for (i = 0; i < 8; i++) 23 { 24 ADCValue = ADAC_readADC ( _ADAC_ADC_READ, &channel ); 25 ShortToStr (channel, uartText); 26 UART1_Write_Text ("rnRead value from channel"); 27 UART1_Write_Text (uartText); 28 29 30 IntToStr (ADCValue, uartText); 31 UART1_Write_Text (": "); 32 UART1_Write_Text (uartText); 33 Delay_ms (2000); 34 } 35 36 UART1_Write_Text ("rnADC Operation finished"); 37 Delay_ms (1000);