Toolbox.NETMF.Hardware.SevenSegment


Toolbox.NETMF.Hardware.SevenSegment(ParallelPort, CommonAnode)
  • ParallelPort The parallel port for the data
  • CommonAnode Specifies if the 7-segment is common anode, default True

Methods

  • ChangeSignal(Index, Signal) Changes the byte that needs to be sent to display a character (useful to customize characters)
  • ChangeSignals(Signals) Changes all characters (also removes custom-made characters created with ChangeSignal)
  • ChangeDotSignal(Bit) Changes the bit used for the dot (by default: 4)
  • SetDigit(Digit) Sets the digit to a specific number
  • GetDigit() Returns the displayed digit
  • SetDot(State) Sets the dot on or off
  • GetDot() Returns if the dot is on or off

How to connect

Toolbox.NETMF.Hardware.SevenSegment.png

Sample code in C#

// Initializes a 7-segment display over a bitshift IC using a single IC
Ic74hc595 Mux = new Ic74hc595(SPI_Devices.SPI1, Pins.GPIO_PIN_D10);
SevenSegment Display = new SevenSegment(Mux.CreateParallelOut());

while (true)
{
    for (byte Value = 0; Value < 11; ++Value)
    {
        // Displays all values for 0,5 sec. (0-9 = 0-9, 10=blank)
        Display.SetDigit(Value);
        // Toggles the dot
        Display.SetDot(!Display.GetDot());
        // Wait for 0,5 sec
        Thread.Sleep(500);
    }
}

Sample code in VB

' Initializes a 7-segment display over a bitshift IC using a single IC
Dim Mux As Ic74hc595 = New Ic74hc595(SPI_Devices.SPI1, Pins.GPIO_PIN_D10)
Dim Display As SevenSegment = New SevenSegment(Mux.CreateParallelOut())

Do
    For Value As Byte = 0 To 10
        ' Displays all values for 0,5 sec. (0-9 = 0-9, 10=blank)
        Display.SetDigit(Value)
        ' Toggles the dot
        Display.SetDot(Not Display.GetDot())
        ' Wait for 0,5 sec
        Thread.Sleep(500)
    Next

Loop

Related documents

Last edited Jan 1, 2013 at 9:18 PM by Garrcomm, version 3