iic
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
xiic_low_level_tempsensor_example.c File Reference

Overview

Shows low-level IIC temperature-sensor reads.

This file contains a polled mode design example which uses the Xilinx IIC device and low-level driver to execise the temperature sensor on the ML300 board. This example only performs read operations (receive) from the IIC temperature sensor of the platform.

The XIic_Recv() API is used to receive the data.

7-bit addressing is used to access the tempsensor.

MODIFICATION HISTORY:
Ver   Who  Date  Changes


1.00a jhl 10/09/03 Initial Release 1.00a sv 05/09/05 Minor changes to comply to Doxygen and coding guidelines 1.00a mta 03/09/06 Minor updates due to changes in the low level driver for supporting repeated start functionality. 2.00a sdm 09/22/09 Minor modifications as per coding guidelines. 3.10 gm 07/09/23 Added SDT support 3.16 tb 09/22/26 Align Doxygen comments with AMD documentation standards

 
#include "xparameters.h"
#include "xiic_l.h"

Macros

#define IIC_BASE_ADDRESS   XPAR_AXI_IIC_0_BASEADDR
 IIC base address. More...
 
#define TEMP_SENSOR_ONCHIP_ADDRESS   0x18 /* The actual address is 0x30 */
 7-bit address of the on-chip temperature sensor. More...
 
#define TEMP_SENSOR_AMBIENT_ADDRESS   0x4B /* The actual address is 0x96 */
 7-bit address of the ambient temperature sensor. More...
 

Functions

int LowLevelTempSensorExample (u32 IicBaseAddress, u8 TempSensorAddress, u8 *TemperaturePtr)
 Reads the IIC temperature sensor using the low-level driver. More...
 
int main (void)
 Runs the low-level IIC temperature sensor example. More...
 

Macro Definition Documentation

#define IIC_BASE_ADDRESS   XPAR_AXI_IIC_0_BASEADDR

IIC base address.

Referenced by main().

#define TEMP_SENSOR_AMBIENT_ADDRESS   0x4B /* The actual address is 0x96 */

7-bit address of the ambient temperature sensor.

#define TEMP_SENSOR_ONCHIP_ADDRESS   0x18 /* The actual address is 0x30 */

7-bit address of the on-chip temperature sensor.

Referenced by main().

Function Documentation

int LowLevelTempSensorExample ( u32  IicBaseAddress,
u8  TempSensorAddress,
u8 *  TemperaturePtr 
)

Reads the IIC temperature sensor using the low-level driver.

The function reads the temperature of the IIC temperature sensor on the IIC bus using the low-level driver.

Parameters
[in]IicBaseAddressThe base address of the device.
[in]TempSensorAddressThe address of the Temperature Sensor device on the IIC bus.
[out]TemperaturePtrThe databyte read from the temperature sensor.
Returns
The number of bytes read from the temperature sensor, normally one byte if successful.

References XIic_Recv(), and XIIC_STOP.

Referenced by main().

int main ( void  )

Runs the low-level IIC temperature sensor example.

The purpose of this function is to illustrate how to use the IIC level 0 driver to read the temperature.

Returns
Always 0.
Note
The main function is returning an integer to prevent compiler warnings.

References IIC_BASE_ADDRESS, LowLevelTempSensorExample(), and TEMP_SENSOR_ONCHIP_ADDRESS.