(working) Use this code for calibrating the Load cells.
Fork of ADISense1000_Example_FW by
doc/examples.md@2:2f9f9f7f0243, 2018-07-19 (annotated)
- Committer:
- RGurav
- Date:
- Thu Jul 19 13:25:33 2018 +0000
- Revision:
- 2:2f9f9f7f0243
- Parent:
- 0:76fed7dd9235
(Working); Code to read values from bridge load cell
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
seanwilson10 | 0:76fed7dd9235 | 1 | Examples |
seanwilson10 | 0:76fed7dd9235 | 2 | ======== |
seanwilson10 | 0:76fed7dd9235 | 3 | |
seanwilson10 | 0:76fed7dd9235 | 4 | [TOC] |
seanwilson10 | 0:76fed7dd9235 | 5 | |
seanwilson10 | 0:76fed7dd9235 | 6 | # Overview {#overview} |
seanwilson10 | 0:76fed7dd9235 | 7 | |
seanwilson10 | 0:76fed7dd9235 | 8 | # Getting Started {#getting_started} |
seanwilson10 | 0:76fed7dd9235 | 9 | |
seanwilson10 | 0:76fed7dd9235 | 10 | ## ST Nucleo F411RE / Mbed OS {#stnucleo_mbed} |
seanwilson10 | 0:76fed7dd9235 | 11 | |
seanwilson10 | 0:76fed7dd9235 | 12 | ### Hardware Setup |
seanwilson10 | 0:76fed7dd9235 | 13 | |
seanwilson10 | 0:76fed7dd9235 | 14 | The following examples assume that the ADI Sense 1000 module is connected to the |
seanwilson10 | 0:76fed7dd9235 | 15 | ST Nucleo FR11RE as follows: |
seanwilson10 | 0:76fed7dd9235 | 16 | |
seanwilson10 | 0:76fed7dd9235 | 17 | ADI Sense 1000 | ST Nucleo FR11RE |
seanwilson10 | 0:76fed7dd9235 | 18 | --------------- | ------------- |
seanwilson10 | 0:76fed7dd9235 | 19 | SPI\_SLAVE\_CS | D10 |
seanwilson10 | 0:76fed7dd9235 | 20 | SPI\_SLAVE\_MOSI | D11 |
seanwilson10 | 0:76fed7dd9235 | 21 | SPI\_SLAVE\_MISO | D12 |
seanwilson10 | 0:76fed7dd9235 | 22 | RESET | D6 |
seanwilson10 | 0:76fed7dd9235 | 23 | ERROR | D3 |
seanwilson10 | 0:76fed7dd9235 | 24 | ALERT | D4 |
seanwilson10 | 0:76fed7dd9235 | 25 | DRDY | D5 |
seanwilson10 | 0:76fed7dd9235 | 26 | |
seanwilson10 | 0:76fed7dd9235 | 27 | ### Software Setup |
seanwilson10 | 0:76fed7dd9235 | 28 | |
seanwilson10 | 0:76fed7dd9235 | 29 | ### Building an example |
seanwilson10 | 0:76fed7dd9235 | 30 | |
seanwilson10 | 0:76fed7dd9235 | 31 | #### Using mbed online tools |
seanwilson10 | 0:76fed7dd9235 | 32 | An mbed online account is required. For more information, |
seanwilson10 | 0:76fed7dd9235 | 33 | see (https://developer.mbed.org/account/signup/). |
seanwilson10 | 0:76fed7dd9235 | 34 | |
seanwilson10 | 0:76fed7dd9235 | 35 | Once logged into mbed, visit the following URL to locate the ADI Sense Host Library repository: |
seanwilson10 | 0:76fed7dd9235 | 36 | (https://os.mbed.com/teams/AnalogDevices/code/AdiSense1000) |
seanwilson10 | 0:76fed7dd9235 | 37 | |
seanwilson10 | 0:76fed7dd9235 | 38 | Select the "Import into Compiler" option to add this library to your project. |
seanwilson10 | 0:76fed7dd9235 | 39 | |
seanwilson10 | 0:76fed7dd9235 | 40 | Navigate to one of the examples (e.g. AdiSense1000/examples/sensors/) and click |
seanwilson10 | 0:76fed7dd9235 | 41 | to open the source file named 'main.cpp'. Then click on compile at the top of |
seanwilson10 | 0:76fed7dd9235 | 42 | the page to build the binary image. This will download the binary to your PC. |
seanwilson10 | 0:76fed7dd9235 | 43 | |
seanwilson10 | 0:76fed7dd9235 | 44 | #### Using mbed-cli (command line interface) tools |
seanwilson10 | 0:76fed7dd9235 | 45 | Follow the instructions at (https://github.com/ARMmbed/mbed-cli) to download and |
seanwilson10 | 0:76fed7dd9235 | 46 | install the mbed-cli. |
seanwilson10 | 0:76fed7dd9235 | 47 | |
seanwilson10 | 0:76fed7dd9235 | 48 | In a command-line terminal window, navigate to the directory containing one of |
seanwilson10 | 0:76fed7dd9235 | 49 | the examples included in the ADI Sense Host Library software package, set up the |
seanwilson10 | 0:76fed7dd9235 | 50 | mbed-os environment, and build the code: |
seanwilson10 | 0:76fed7dd9235 | 51 | |
seanwilson10 | 0:76fed7dd9235 | 52 | cd <path_to_library>/examples/sensors/ |
seanwilson10 | 0:76fed7dd9235 | 53 | mbed deploy |
seanwilson10 | 0:76fed7dd9235 | 54 | mbed new . |
seanwilson10 | 0:76fed7dd9235 | 55 | mbed compile -m nucleo_f411re -t GCC_ARM |
seanwilson10 | 0:76fed7dd9235 | 56 | |
seanwilson10 | 0:76fed7dd9235 | 57 | The resulting binary image will be created as: |
seanwilson10 | 0:76fed7dd9235 | 58 | |
seanwilson10 | 0:76fed7dd9235 | 59 | <path_to_library>/examples/sensors/BUILD/nucleo_f411re/GCC_ARM/sensors.bin |
seanwilson10 | 0:76fed7dd9235 | 60 | |
seanwilson10 | 0:76fed7dd9235 | 61 | ### Running an example |
seanwilson10 | 0:76fed7dd9235 | 62 | Assuming the Nucleo board is plugged in to your PC via a micro-USB cable, copy |
seanwilson10 | 0:76fed7dd9235 | 63 | the binary image (built in the previous step) to the "NODE_F411RE" USB storage |
seanwilson10 | 0:76fed7dd9235 | 64 | device. The programming LED on the F411RE should flash for a few seconds while |
seanwilson10 | 0:76fed7dd9235 | 65 | the program is being loaded, and the device should then automatically reboot |
seanwilson10 | 0:76fed7dd9235 | 66 | and start running the example. |
seanwilson10 | 0:76fed7dd9235 | 67 | |
seanwilson10 | 0:76fed7dd9235 | 68 | Output messages from the example are transmitted on UART6 (pins PA\_11, PA\_12) |
seanwilson10 | 0:76fed7dd9235 | 69 | by default. This pins may be routed via the micro-USB cable COM/serial |
seanwilson10 | 0:76fed7dd9235 | 70 | by connecting PA\_11 and PA\_12 to the RX and TX pins on CN3 of the F411RE board. |
seanwilson10 | 0:76fed7dd9235 | 71 | Alternatively, it is possible to specify a different UART by modifying the |
seanwilson10 | 0:76fed7dd9235 | 72 | following file and rebuilding the example: |
seanwilson10 | 0:76fed7dd9235 | 73 | |
seanwilson10 | 0:76fed7dd9235 | 74 | <path_to_library>/host/src/mbed/adi_sense_log.cpp |
seanwilson10 | 0:76fed7dd9235 | 75 | |
seanwilson10 | 0:76fed7dd9235 | 76 | # API Usage Examples {#api_examples} |
seanwilson10 | 0:76fed7dd9235 | 77 | The following examples are intended to demonstrate the correct usage of the [ADI Sense API](@ref ADI_Sense_Api) in a variety of scenarios and configurations. |
seanwilson10 | 0:76fed7dd9235 | 78 | |
seanwilson10 | 0:76fed7dd9235 | 79 | ## Sensors {#api_examples_sensors} |
seanwilson10 | 0:76fed7dd9235 | 80 | The "sensors" example demonstrates configurations that may be used to enable a |
seanwilson10 | 0:76fed7dd9235 | 81 | selection of analog and digital sensors which may be connected to the ADI Sense |
seanwilson10 | 0:76fed7dd9235 | 82 | 1000 module and used in various modes of operation. Different configurations |
seanwilson10 | 0:76fed7dd9235 | 83 | may be selected by modifying the value of 'pSelectedConfig' in main.cpp. The |
seanwilson10 | 0:76fed7dd9235 | 84 | example application code will show how the selected configuration is loaded to |
seanwilson10 | 0:76fed7dd9235 | 85 | the ADI Sense 1000 device and applied before measurement cycles are started. |
seanwilson10 | 0:76fed7dd9235 | 86 | |
seanwilson10 | 0:76fed7dd9235 | 87 | ## User-Defined Look-Up Table Data {#api_examples_user_lut_data} |
seanwilson10 | 0:76fed7dd9235 | 88 | The "user_lut_data" example aims to show how a user may specify sensor |
seanwilson10 | 0:76fed7dd9235 | 89 | correction data to linearise the raw results from a custom sensor (a |
seanwilson10 | 0:76fed7dd9235 | 90 | thermocouple and bridge sensor in this case). The data is encapsulated in a |
seanwilson10 | 0:76fed7dd9235 | 91 | series of individual tables and corresponding descriptors |
seanwilson10 | 0:76fed7dd9235 | 92 | (see 'sample\_lut\_data.c') which are assembled into a single monolithic Look-Up |
seanwilson10 | 0:76fed7dd9235 | 93 | Table (LUT) data structure. That LUT data structure is loaded onto the ADI |
seanwilson10 | 0:76fed7dd9235 | 94 | Sense 1000 module and applied as part of the module configuration before any |
seanwilson10 | 0:76fed7dd9235 | 95 | measurement cycles are started. |
seanwilson10 | 0:76fed7dd9235 | 96 | |
seanwilson10 | 0:76fed7dd9235 | 97 | ## Save/Restore Configuration {#api_examples_save_restore} |
seanwilson10 | 0:76fed7dd9235 | 98 | The "save_restore_config" example demonstrates how configuration settings may be |
seanwilson10 | 0:76fed7dd9235 | 99 | saved to non-volatile memory on the ADI Sense module. Saved settings are loaded |
seanwilson10 | 0:76fed7dd9235 | 100 | automatically when the module is subsequently powered on, and may also be |
seanwilson10 | 0:76fed7dd9235 | 101 | loaded (restored) at any time by the user if required. Note that settings must |
seanwilson10 | 0:76fed7dd9235 | 102 | always be applied explicitly with @ref adi_sense_ApplyConfigUpdates before they |
seanwilson10 | 0:76fed7dd9235 | 103 | take effect. |
seanwilson10 | 0:76fed7dd9235 | 104 | |
seanwilson10 | 0:76fed7dd9235 | 105 | ## Diagnostics {#api_examples_diagnostics} |
seanwilson10 | 0:76fed7dd9235 | 106 | The "diagnostics" example demonstrates how some of the various diagnostic |
seanwilson10 | 0:76fed7dd9235 | 107 | functions of the ADI Sense module can be utilised to detect error conditions |
seanwilson10 | 0:76fed7dd9235 | 108 | such as disconnected or mis-wired sensors. |
seanwilson10 | 0:76fed7dd9235 | 109 |