ADAC Click Board
ADAC Click Board
The ADAC Click Board™ is an 8-channel 12-bit ADC, DAC and GPIO. ADAC Click Board™ communicates with the target microcontroller over the I2C interface, with additional functionality provided by the RST pin on the MikroBUS line.
The ADAC Click Board™ is designed to run on either a 3.3V or 5V power supply.
Software Support
Code examples for the ADAC Click Board™, written for MikroElektronika hardware and compilers are available on Libstock.
Example Description
The following code snippet demonstrates the use of the ADAC Click Board™ 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);
ADAC Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.