| Kinetis SDK Demo Applications User Guide 1.0.0-beta Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- Demos

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
I2C DAC User Guide
I2C DAC Demo

User guide on how to use the I2C DAC master and slave applications and how to copy it. More...

### I2C DAC User Guide

# Getting started

The I2C DAC project includes a master project and a slave project. These projects are designed to be programmed on two different development boards with the master sending commands to the slave.Begin by programming the master application onto the desired development board and then program the slave application onto the desired slave board.

# I2C Connections

The I2C protocol is a two-wire interface that consists of a clock line (SCL) and a data line (SDA). The master and slave SCL and SDA lines must be connected together (master SCL to slave SCL and master SDA to slave SDA) for proper demo operation. For this demo application, please make the necessary connections using the following table as a reference.Platform Pin Pin Pin

## Signal CPU Name Board Name

TWR-K64F120M SCL PTC10 A75 SDA PTC11 A60 GND GND A2FRDM-K64F120M SCL PTE24 J2-18 SDA PTE25 J2-20 GND GND J25-14

# Supported slave commands

The slave accepts four commands from the master. Any command sent to the slave that is not one of the four accepted commands is ignored. The slave prints a message to the terminal informing the user that an invalid command was received and reset the receive buffer. The supported slave commands are listed here:

- 1: This command allows the user to input three new RGB values to the simulated DAC buffer.
- 2: This command latches the simulated DAC buffer to the output.
- 3: This command should follow the General Call address only. This command forces the slave to sample the address pins and re-initialize the slave address without resetting the device.
- 4: This command puts the slave into VLPS mode.

# Slave command structure

The commands sent to the slave follow this structure:[Slave Address] [Command] [Data (Optional)]Only command #1 accepts additional data. This command accepts three 8-bit data values after the command byte. The slave stores these bytes in the simulated DAC buffer as the R-value, G-value, and B-value in that order.

# Using the master to send commands to the slave.

Upon startup, the master prints this menu to the serial terminal:Select from the following menu:

- 1: Set new RGB value *
- 2: Output RGB value *
- 3: Latch new address without resetting *
- 4: Set DAC to sleep mode *

Once the menu has been printed, enter the number of the desired command. The slave should respond accordingly.If you enter a command that is not listed on the menu, the master prints the following message to the terminal:Invalid command entered!The master will then wait for user input.