Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Characteristic Locus
Inheritance object > Tca9548a
Implements II2cCommunications IByteCommunications
Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.ICs.IOExpanders
Assembly Tca9548a.dll

Syntax

public class Tca9548a : II2cCommunications, IByteCommunications

Constructors

Tca9548a(II2cBus, bool, bool, bool)

Create a Tca9548a i2c multiplexer.

Declaration
public Tca9548a(II2cBus i2cBus, bool a0, bool a1, bool a2)

Parameters

Type Name Description
II2cBus i2cBus

The I2cBus the device is attached to

bool a0

The logic high/low state of pin A0

bool a1

The logic high/low state of pin A1

bool a2

The logic high/low state of pin A2

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Tca9548a(II2cBus, byte)

Create a Tca9548a i2c multiplexer

Declaration
public Tca9548a(II2cBus bus, byte address = 112)

Parameters

Type Name Description
II2cBus bus

The II2cBus the device is attached to

byte address

The address of the device on the specified bus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Exceptions

Type Condition
ArgumentOutOfRangeException

The device address was invalid

ArgumentNullException

The bus was null

Properties

Address

The address of this device on the Bus

Declaration
public byte Address { get; }

Property Value

Type Description
byte

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus

The II2cBus this device is connected to.

Declaration
public II2cBus Bus { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus0

The II2cBus connected to SD0/SC0

Declaration
public II2cBus Bus0 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus1

The II2cBus connected to SD1/SC1

Declaration
public II2cBus Bus1 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus2

The II2cBus connected to SD2/SC2

Declaration
public II2cBus Bus2 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus3

The II2cBus connected to SD3/SC3

Declaration
public II2cBus Bus3 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus4

The II2cBus connected to SD4/SC4

Declaration
public II2cBus Bus4 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus5

The II2cBus connected to SD5/SC5

Declaration
public II2cBus Bus5 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus6

The II2cBus connected to SD6/SC6

Declaration
public II2cBus Bus6 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Bus7

The II2cBus connected to SD7/SC7

Declaration
public II2cBus Bus7 { get; }

Property Value

Type Description
II2cBus

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Methods

Exchange(Span<byte>, Span<byte>, DuplexType)

Write data to followed by read data from the peripheral.

Declaration
public void Exchange(Span<byte> writeBuffer, Span<byte> readBuffer, DuplexType duplex)

Parameters

Type Name Description
Span<byte> writeBuffer

Data to write

Span<byte> readBuffer

Buffer where read data will be written. Number of bytes read is determined by buffer size.

DuplexType duplex

Whether the communication will happen in a half-duplex or full-duplex fashion.

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Read(Span<byte>)

Reads data from the peripheral

Declaration
public void Read(Span<byte> readBuffer)

Parameters

Type Name Description
Span<byte> readBuffer

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Exceptions

Type Condition
NotImplementedException

ReadBytes(ushort)

Read bytes from the I2cBus

Declaration
public byte[] ReadBytes(ushort numberOfBytes)

Parameters

Type Name Description
ushort numberOfBytes

Returns

Type Description
byte[]

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

ReadRegister(byte)

Read a register from the peripheral

Declaration
public byte ReadRegister(byte address)

Parameters

Type Name Description
byte address

Address of the register to read.

Returns

Type Description
byte

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

ReadRegister(byte, Span<byte>)

Reads data from the peripheral starting at the specified address

Declaration
public void ReadRegister(byte address, Span<byte> readBuffer)

Parameters

Type Name Description
byte address
Span<byte> readBuffer

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

ReadRegisterAsUShort(byte, ByteOrder)

Read an unsigned short from a register

Declaration
public ushort ReadRegisterAsUShort(byte address, ByteOrder order)

Parameters

Type Name Description
byte address

Register address of the low byte (the high byte will follow).

ByteOrder order

Order of the bytes in the register (little endian is the default).

Returns

Type Description
ushort

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Write(byte)

Write a single byte to the peripheral.

Declaration
public void Write(byte value)

Parameters

Type Name Description
byte value

Value to be written (8-bits)

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

Write(Span<byte>)

Write an array of bytes to the peripheral

Declaration
public void Write(Span<byte> data)

Parameters

Type Name Description
Span<byte> data

Values to be written

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

WriteRegister(byte, byte)

Write data to a register in the peripheral

Declaration
public void WriteRegister(byte address, byte value)

Parameters

Type Name Description
byte address

Address of the register to write to

byte value

Data to write into the register

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

WriteRegister(byte, Span<byte>, ByteOrder)

Write data to a register in the peripheral

Declaration
public void WriteRegister(byte address, Span<byte> writeBuffer, ByteOrder order = ByteOrder.LittleEndian)

Parameters

Type Name Description
byte address

Address of the register to write to

Span<byte> writeBuffer

A buffer of byte values to be written

ByteOrder order

Indicate if the data should be written as big or little endian

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

WriteRegister(byte, ushort, ByteOrder)

Write an unsigned short to the peripheral.

Declaration
public void WriteRegister(byte address, ushort value, ByteOrder order = ByteOrder.LittleEndian)

Parameters

Type Name Description
byte address

Address to write the first byte to

ushort value

Value to be written (16-bits)

ByteOrder order

Indicate if the data should be written as big or little endian

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

WriteRegister(byte, uint, ByteOrder)

Write an unsigned integer to the peripheral

Declaration
public void WriteRegister(byte address, uint value, ByteOrder order = ByteOrder.LittleEndian)

Parameters

Type Name Description
byte address

Address to write the first byte to

uint value

Value to be written

ByteOrder order

Indicate if the data should be written as big or little endian

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here

WriteRegister(byte, ulong, ByteOrder)

Write an unsigned long to the peripheral.

Declaration
public void WriteRegister(byte address, ulong value, ByteOrder order = ByteOrder.LittleEndian)

Parameters

Type Name Description
byte address

Address to write the first byte to

ulong value

Value to be written

ByteOrder order

Indicate if the data should be written as big or little endian

Remarks

Tca9548a
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Tca9548a

[Explanation of the peripheral]

Code Example

IDigitalOutputPort bus0Port0;
IDigitalOutputPort bus1Port0;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    var i2cBus = Device.CreateI2cBus(I2cBusSpeed.Standard);
    var tca9548a = new Tca9548a(i2cBus, 0x70);
    var mcp0 = new Mcp23008(tca9548a.Bus0);
    var mcp1 = new Mcp23008(tca9548a.Bus1);

    bus0Port0 = mcp0.CreateDigitalOutputPort(mcp0.Pins.GP0);
    bus1Port0 = mcp1.CreateDigitalOutputPort(mcp1.Pins.GP0);

    return base.Initialize();
}

public override async Task Run()
{
    while (true)
    {
        bus0Port0.State = true;
        bus1Port0.State = false;

        await Task.Delay(1000);

        bus0Port0.State = false;
        bus1Port0.State = true;

        await Task.Delay(1000);
    }
}

Sample project(s) available on GitHub

Wiring Example

To wire a Tca9548a to your Meadow board, connect the following:

Tca9548a Meadow Pin
GND GND
SCL D08 (SCL)
SDA D07 (SDA)
VCC 3V3

It should look like the following diagram:

ToDo: Fritzing diagram here