MP Type | I2C |
OS Type | Multi-Thread Mbed , etc |
Calculation accuracy | floating-point calculation |
Characteristic Conversion | linear conversion |
Filter | Non |
Diagnostics | SP Max/Min , CP write error , MP ACK |
Software Specifications
In this section, we will use the OSS-EC I2C component ( TI HDC1080 ) as an example.
Intended use scenarios
After “Power ON Reset”, the program moves to “measurement” and acquires temperature and humidity from the temperature and humidity sensor via I2C communication.
When “measurement” is selected, the heater is turned on by “Mode change” when the temperature is low. However, when the voltage is low, “Mode change” turns the heater OFF.
If the temperature and humidity are outside the upper and lower limits of the “measurement”, it is judged as NG.If nonzero on failure (nack) in I2C communication is repeated iCom_retry_num times of consecutive retries, it is judged NG.
If NG is determined, “Software Reset” is performed.
summary
The software architecture of the OSS-EC is configured to pair with the hardware architecture of HDC1080, as shown in ( Fig. 1).
The state of an HDC1080 is changed by a command from the application as shown in (Fig.2).
The interface between the application and PCMP is the argument structure cmd and the return value structure res, as shown in (Fig.3).
Command sequence ( fig.4 )
Data table
File
Blue label characters are data related to application.




Data table
#define Label | Value | Data contents |
iPCMP_cyc | 1000U | PCMP Function call cycle 1000[ms] |
iError_times | 3U | PCMP Error times 3times |
iCom_retry_num | 3U | I2C communication retry 3times |
iTemp_low | 5.0F | Judgment temperature value 5.0℃for turning on the heater |
iHDC1080_dat_cnf_pwrst | (iMODE+iTRES+iHRES) | HDC1080 configuration register setting value( state : Power ON Reset ) |
iHDC1080_dat_cnf_nonheat | (iMODE+iTRES+iHRES) | HDC1080 configuration register setting value( state : Measurement non-heat ) |
HDC1080_dat_cnf_heat | (iHEAT+iMODE+iTRES+iHRES) | HDC1080 configuration register setting value( state : Measurement heat ) |
iHDC1080_dat_cnf_swrst | (iRST+iMODE+iTRES+iHRES) | HDC1080 configuration register setting value( state : Software Reset ) |
iRST | (iBit15*1) | 0:Normal 1:software reset |
iHEAT | (iBit13*1) | 0:Heater disable 1:Heater enable |
iMODE | (iBit12*1) | 0:Temperature or Humidity is acquired 1:Temperature and Humidity are acquired in sequence, Temperature first |
iTRES | (iBit10*0) | Temperature 0:14bit 1:11bit |
iHRES | (iBit09*0)+(iBit08*0) | Humidity 00:14bit 01:11bit 10:8bit |
iEndian | iBig | Endian select |
iI2C_SDA | D14 | SDA Pin |
iI2C_SCL | D15 | SCL Pin |
iI2C_frequency | 400000 | Frequency 400kHz |
File ( Mbed C++)
main.cpp | application source code file |
pcmp.cpp | I2C Component source code file |
pcmp.h | I2C Component header file |
oss-ec.h | OSS-EC header file |
ic.h | IC Number header file |
ic_setting.cpp | IC setting data file |
layer_if.h | Layer interface header file |
prc.cpp | Process function source code file |
prc.h | Process function header file |
user_setting.h | user setting header file |
hdc1080/hdc1080.cpp | HDC1080 data file |
hdc1080/hdc1080.h | HDC1080 header file |