nanoFramework.Iot.Device.Mbi5027
1.0.277-preview.110
Prefix Reserved
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Mbi5027 --version 1.0.277-preview.110
NuGet\Install-Package nanoFramework.Iot.Device.Mbi5027 -Version 1.0.277-preview.110
<PackageReference Include="nanoFramework.Iot.Device.Mbi5027" Version="1.0.277-preview.110" />
paket add nanoFramework.Iot.Device.Mbi5027 --version 1.0.277-preview.110
#r "nuget: nanoFramework.Iot.Device.Mbi5027, 1.0.277-preview.110"
// Install nanoFramework.Iot.Device.Mbi5027 as a Cake Addin #addin nuget:?package=nanoFramework.Iot.Device.Mbi5027&version=1.0.277-preview.110&prerelease // Install nanoFramework.Iot.Device.Mbi5027 as a Cake Tool #tool nuget:?package=nanoFramework.Iot.Device.Mbi5027&version=1.0.277-preview.110&prerelease
MBI5027 -- 16-bit shift register with error detection
MBI5027 is a 16-bit shift register. Per the datasheet, the MBI5027 is a "16-bit Constant Current LED Sink Driver with Open/Short Circuit Detection". The Mbi5027
binding is based on and is compatible with the more general ShiftRegister
binding. The Mbi5027
binding adds error detection functionality. Either binding can be used to control the MBI5027.
The MBI5027 is similar to the commonly used SN74HC595 shift register, with some key differences.
- The MBI5027 has 16 inputs (and can control 16 LEDs) while the SN74HC595 has 8 outputs.
- The MBI5027 is a current sink, which means you connect the cathode (ground), not anode (power) legs, to its pins. The current comes towards the sink, not away from it. The SN74HC595 is a current source and requires the opposite wiring due to the opposite direction of current.
- The MBI5027 provides a configurable constant current, which means that resistors are not needed per input. A single resistor is used, connected to R-EXT, to configure the current.
- The MBI5027 provides the ability to detect errors, per input.
- The SN74HC595 provides a storage register clear capability, which the MBI5027 lacks.
- The MBI5027 and SN74HC595 can be controlled by the same API for their basic operations; they are protocol compatible.
Note: The MBI5168 is an 8-bit constant current sink without error detection, making it a more direct comparison to the SN74HC595.
The MBI5027 sample demonstrates how to use the shift register. The generic shift register sample is more extensive and is compatible with the MBI5027.
Documentation
- You can find the datasheet here
- Purchase: Not widely available. aliexpress.com/ was used to purchase the unit used to write this binding.
Usage
The following example code demonstrates how to use the MBI5027 with its most basic functions.
Mbi5027 sr = new(Mbi5027PinMapping.Minimal);
// Light up three of first four LEDs
sr.ShiftBit(1);
sr.ShiftBit(1);
sr.ShiftBit(0);
sr.ShiftBit(1);
sr.Latch();
// Display for 1s
Thread.Sleep(1000);
// Clear register
sr.ShiftClear();
// Write to all 16 registers with two byte values
// The `false` parameter avoids latching the storage register after the first call to `ShiftByte`
sr.ShiftByte(0b_1101_1010, false);
sr.ShiftByte(0b_1010_1101);
If you want to use SPI, see the ShiftRegister
binding, which includes more information on SPI.
The following image demonstrate a binary clock counting example.
Example circuit
The following breadboard circuit demonstrates the correct wiring pattern, including error detection.
It is easy to mis-wire the MBI5027. The following image captures the most basic aspects for correct configuration.
The following are key aspects to ensure are correct:
- Pin 24 (VDD) must be wired to 5v for error correction to work correctly.
- Pin 23 (R-EXT) must be connected to ground with a resistor, which configures the constant current.
- Loads must connect to the MBI5027 with their cathode legs. In this example, the LED is connected to the ground rail via its anode leg and to a MBI5027 input pin via its cathode leg.
Error detection
The MBI5027 provides the ability to detect errors, per output. This is very useful for remote deployments, to determine if repairs are required (for a traffic sign, for example). The MBI5027 requires transitioning to an error detection mode to detect errors and then back to normal mode for normal operation.
The following example code demonstrates how to detect output errors with the MBI5027.
var sr = new Mbi5027(Mbi5027PinMapping.Complete);
// switch to error detection mode
sr.EnableDetectionMode();
// read error states, per output
var index = sr.BitLength - 1;
foreach (var value in sr.ReadOutputErrorStatus())
{
Debug.WriteLine($"Bit {index--}: {value}");
}
// switch back to normal mode
sr.EnableNormalMode();
Per the datasheet, data can be shifted into the storage register while reading the output error status and before re-entering normal mode.
When all 16 outputs are in use, and no errors are detected, you will see the following output given this code. A Low
state would be shown if the output is unused, is misconfigured or other error condition. You can create this situation by disconnecting one of the input connections on the MBI5027.
Bit 15: High
Bit 14: High
Bit 13: High
Bit 12: High
Bit 11: High
Bit 10: High
Bit 9: High
Bit 8: High
Bit 7: High
Bit 6: High
Bit 5: High
Bit 4: High
Bit 3: High
Bit 2: High
Bit 1: High
Bit 0: High
Note: Error detection was found to work only with 5v power. When 3.3v power was used, error detection did not work correctly.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.12.0-preview.19)
- nanoFramework.Iot.Device.Multiplexing (>= 1.0.277-preview.99)
- nanoFramework.Iot.Device.ShiftRegister (>= 1.0.277-preview.102)
- nanoFramework.Runtime.Events (>= 1.10.0-preview.11)
- nanoFramework.System.Device.Gpio (>= 1.0.3-preview.18)
- nanoFramework.System.Device.Spi (>= 1.0.4-preview.11)
- nanoFramework.System.Threading (>= 1.0.4-preview.23)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.673 | 93 | 10/23/2024 |
1.2.635 | 103 | 8/30/2024 |
1.2.631 | 93 | 8/28/2024 |
1.2.590 | 101 | 7/17/2024 |
1.2.570 | 107 | 6/14/2024 |
1.2.560 | 101 | 5/29/2024 |
1.2.548 | 91 | 5/15/2024 |
1.2.436 | 251 | 11/10/2023 |
1.2.416 | 127 | 11/8/2023 |
1.2.329 | 165 | 5/26/2023 |
1.2.313 | 149 | 5/12/2023 |
1.2.302 | 152 | 5/10/2023 |
1.2.297 | 174 | 5/3/2023 |
1.2.273 | 241 | 3/17/2023 |
1.2.203 | 291 | 12/28/2022 |
1.2.159 | 376 | 11/14/2022 |
1.2.153 | 385 | 11/5/2022 |
1.2.141 | 406 | 10/25/2022 |
1.2.122 | 453 | 10/12/2022 |
1.2.114 | 389 | 10/8/2022 |
1.2.104 | 428 | 9/24/2022 |
1.2.95 | 449 | 9/22/2022 |
1.2.87 | 492 | 9/15/2022 |
1.2.73 | 424 | 9/8/2022 |
1.2.5 | 474 | 7/13/2022 |
1.1.141.41205 | 446 | 7/6/2022 |
1.1.116.8772 | 428 | 6/24/2022 |
1.1.113.2032 | 449 | 6/23/2022 |
1.1.58.10097 | 458 | 5/23/2022 |
1.1.27 | 469 | 4/26/2022 |
1.1.20 | 435 | 4/21/2022 |
1.1.3 | 457 | 4/15/2022 |
1.1.1 | 437 | 4/14/2022 |
1.0.300 | 455 | 3/31/2022 |
1.0.277-preview.128 | 121 | 3/26/2022 |
1.0.277-preview.126 | 123 | 3/25/2022 |
1.0.277-preview.125 | 114 | 3/25/2022 |
1.0.277-preview.113 | 119 | 3/20/2022 |
1.0.277-preview.112 | 114 | 3/19/2022 |
1.0.277-preview.110 | 115 | 3/18/2022 |
1.0.277-preview.105 | 119 | 3/15/2022 |
1.0.277-preview.103 | 122 | 3/14/2022 |
1.0.277-preview.102 | 112 | 3/11/2022 |
1.0.277-preview.99 | 128 | 3/10/2022 |
1.0.277-preview.98 | 124 | 3/8/2022 |
1.0.277-preview.85 | 124 | 2/25/2022 |
1.0.277-preview.77 | 116 | 2/18/2022 |
1.0.277-preview.60 | 135 | 2/4/2022 |
1.0.277-preview.41 | 133 | 1/28/2022 |
1.0.277-preview.32 | 135 | 1/27/2022 |
1.0.277-preview.17 | 138 | 1/24/2022 |
1.0.277-preview.13 | 129 | 1/21/2022 |
1.0.277-preview.1 | 129 | 1/11/2022 |
1.0.259 | 361 | 12/9/2021 |
1.0.221 | 162 | 10/19/2021 |
1.0.219 | 167 | 10/19/2021 |
1.0.218 | 192 | 10/18/2021 |
1.0.156 | 170 | 9/1/2021 |
1.0.155 | 162 | 8/31/2021 |
1.0.150 | 184 | 7/23/2021 |
1.0.148 | 169 | 7/22/2021 |
1.0.125 | 198 | 7/5/2021 |
1.0.119 | 234 | 6/28/2021 |
1.0.112 | 206 | 6/16/2021 |
1.0.79 | 180 | 5/26/2021 |