TIL309 (Texas Instruments)


Připojení k Arduinu

Pin TIL309Název pinu TIL309Pin Arduino
1QBD3
2QCD4
3QDD5
4QAD2
5LSD8
6C
7D
8GNDGND
9NC
10B
11BID7
12DP
13LT
14QDPD6
15A
16Vcc5V

Zdrojový kód pro Arduino

#define LATCH_INPUT_A     2
#define LATCH_INPUT_B     3
#define LATCH_INPUT_C     4
#define LATCH_INPUT_D     5
#define LATCH_INPUT_DP    6
#define BLANK_INPUT       7
#define LATCH_STROBE_PIN  8

void setup ()
{
  pinMode (BLANK_INPUT, OUTPUT);
  pinMode (LATCH_STROBE_PIN, OUTPUT);
  pinMode (LATCH_INPUT_A, OUTPUT);
  pinMode (LATCH_INPUT_B, OUTPUT);
  pinMode (LATCH_INPUT_C, OUTPUT);
  pinMode (LATCH_INPUT_D, OUTPUT);
  pinMode (LATCH_INPUT_DP, OUTPUT);
  digitalWrite (BLANK_INPUT, HIGH);
  digitalWrite (LATCH_STROBE_PIN, LOW);
}

void loop ()
{
  static byte i = 0;
  display (i++);
  if (i > 15) {
    digitalWrite(LATCH_INPUT_DP, !digitalRead(LATCH_INPUT_DP));
    i = 0;
  }
  delay (300);
}

void display (uint8_t value)
{
  digitalWrite (BLANK_INPUT, LOW);
  digitalWrite (LATCH_INPUT_A, bitRead (value, 0));
  digitalWrite (LATCH_INPUT_B, bitRead (value, 1));
  digitalWrite (LATCH_INPUT_C, bitRead (value, 2));
  digitalWrite (LATCH_INPUT_D, bitRead (value, 3));
  digitalWrite (BLANK_INPUT, HIGH);
}

Demo video


Leave a Reply