|
| 1 | + |
| 2 | + |
| 3 | +--- |
| 4 | + |
| 5 | +# ADC Click |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +- **CIC Prefix** : ADC |
| 10 | +- **Author** : Jovan Stajkovic |
| 11 | +- **Verison** : 1.0.0 |
| 12 | +- **Date** : Feb 2019. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +### Software Support |
| 17 | + |
| 18 | +We provide a library for the ADC Click on our [LibStock](https://libstock.mikroe.com/projects/view/199/adc-click-example) |
| 19 | +page, as well as a demo application (example), developed using MikroElektronika |
| 20 | +[compilers](http://shop.mikroe.com/compilers). The demo can run on all the main |
| 21 | +MikroElektronika [development boards](http://shop.mikroe.com/development-boards). |
| 22 | + |
| 23 | +**Library Description** |
| 24 | + |
| 25 | +The library covers all the necessary functions that enables the usage of the ADC click board. |
| 26 | +It initializes and defines the SPI driver and drivers that offer a choice for reading digital |
| 27 | +data from all four channels seperatly or all together. |
| 28 | + |
| 29 | +Key functions : |
| 30 | + |
| 31 | +- ``` uint16_t adc_getAdcAllChan( uint16_t *valChan0, uint16_t *valChan1, uint16_t *valChan2, uint16_t *valChan3 ); ``` - Function reads data from all four channels. |
| 32 | +- ``` uint16_t adc_getAdcCh0(); ``` - Function reads data from 0th channel. |
| 33 | +- ``` uint16_t adc_getADC( uint8_t channel ); ``` - uint16_t adc_getADC( uint8_t channel ); |
| 34 | + |
| 35 | +**Examples Description** |
| 36 | + |
| 37 | +The application is composed of three sections : |
| 38 | + |
| 39 | +- System Initialization - Initializes SPI module, LOG structure, sets CS pin as output. |
| 40 | +- Application Initialization - Initalizes SPI driver and makes an initial log. |
| 41 | +- Application Task - (code snippet) This is an example that shows the capabilities of the ADC click |
| 42 | + by taking measurements from all four channel simultaneously. |
| 43 | + |
| 44 | + |
| 45 | +```.c |
| 46 | + |
| 47 | +void applicationTask() |
| 48 | +{ |
| 49 | + adc_getAdcAllChan( &valChan0, &valChan1, &valChan2, &valChan3 ); |
| 50 | + Delay_ms( 100 ); |
| 51 | + |
| 52 | + IntToStr( valChan0, txt ); |
| 53 | + Ltrim( txt ); |
| 54 | + mikrobus_logWrite( " Channel 0 : ", _LOG_TEXT ); |
| 55 | + mikrobus_logWrite( txt, _LOG_LINE ); |
| 56 | + |
| 57 | + IntToStr( valChan1, txt ); |
| 58 | + Ltrim( txt ); |
| 59 | + mikrobus_logWrite( " Channel 1 : ", _LOG_TEXT ); |
| 60 | + mikrobus_logWrite( txt, _LOG_LINE ); |
| 61 | + |
| 62 | + IntToStr( valChan2, txt ); |
| 63 | + Ltrim( txt ); |
| 64 | + mikrobus_logWrite( " Channel 2 : ", _LOG_TEXT ); |
| 65 | + mikrobus_logWrite( txt, _LOG_LINE ); |
| 66 | + |
| 67 | + IntToStr( valChan3, txt ); |
| 68 | + Ltrim( txt ); |
| 69 | + mikrobus_logWrite( " Channel 3 : ", _LOG_TEXT ); |
| 70 | + mikrobus_logWrite( txt, _LOG_LINE ); |
| 71 | + |
| 72 | + mikrobus_logWrite( "------------------", _LOG_LINE ); |
| 73 | + Delay_ms( 1000 ); |
| 74 | + |
| 75 | +} |
| 76 | + |
| 77 | +``` |
| 78 | + |
| 79 | +The full application code, and ready to use projects can be found on our |
| 80 | +[LibStock](https://libstock.mikroe.com/projects/view/199/adc-click-example) page. |
| 81 | + |
| 82 | +Other mikroE Libraries used in the example: |
| 83 | + |
| 84 | +- SPI |
| 85 | +- Conversions |
| 86 | +- UART |
| 87 | + |
| 88 | +**Additional notes and informations** |
| 89 | + |
| 90 | +Depending on the development board you are using, you may need |
| 91 | +[USB UART click](http://shop.mikroe.com/usb-uart-click), |
| 92 | +[USB UART 2 Click](http://shop.mikroe.com/usb-uart-2-click) or |
| 93 | +[RS232 Click](http://shop.mikroe.com/rs232-click) to connect to your PC, for |
| 94 | +development systems with no UART to USB interface available on the board. The |
| 95 | +terminal available in all Mikroelektronika |
| 96 | +[compilers](http://shop.mikroe.com/compilers), or any other terminal application |
| 97 | +of your choice, can be used to read the message. |
| 98 | + |
| 99 | +--- |
| 100 | +--- |
0 commit comments