4. Description of the Programming Example Code
This section describes the example code and how to use the ZMOD4510 Outdoor Air Quality Gas Sensor Module. In the example, the
ZMOD4510 is initialized and configured for operation, and then it displays measured air quality index (AQI) values. The example is intended to
work on a Windows®(trademark of Microsoft, Inc.) computer in combination with the IDT gas sensor EVK. However, the example can be
adjusted to operate on other platforms such as ARM®(trademark of ARM, Ltd.) and Linux®(trademark of Linus Torvalds).
To run the example using the EVK without further configuration, run ZMOD45xx_example.exe, which is included in the kit software.
4.1
main
Files
The main.c / main.h files contain the main program flow.
The ZMOD4510 Outdoor Air Quality (OAQ) algorithms are configured by setting the parameters according to the ZMOD4510 libraries, then the
target-specific initialization are performed. The ZMOD4510 is configured by reading the Final Module Test parameters from the sensor’s
nonvolatile memory (NVM) and initializing it to run at its operation temperature.
An endless loop continuously checks the status of the ZMOD4510 and reads its data. The raw data is subsequently processed, and the OAQ
algorithm for Air Quality Index (AQI) is calculated. The values are shown in a command line window. To stop the loop, press any key, which
releases the hardware and stops the program.
4.2 Program Flow to Operate the Sensor
For more information, refer to the example code.
Table 1. Program Flow
Note: In the following table, lines that are shaded blue can be run in an endless loop with polling or interrupt usage.