Skip to content

Instantly share code, notes, and snippets.

@shokifrend007
Last active May 22, 2022 15:06
Show Gist options
  • Save shokifrend007/f67893cd7681b479efa6c1e0750d64ef to your computer and use it in GitHub Desktop.
Save shokifrend007/f67893cd7681b479efa6c1e0750d64ef to your computer and use it in GitHub Desktop.

Documentation for BB-94HB 7 Segement 4 Digit display by Sanyo

sanyo-bb-94hb

If you find this useful, please leave a comment.

Overview

This display has two "cycles", which are just two layers with cathodes (minus pins). These are meant to be hooked up to the transformer, using the mains frequency (50/60Hz) to switch between them. In my clock, it was used with the LM8560 chip.

C/C++

Below (scroll way down past the grid) are two c/c++ programms for the arduino. These are intended to be used with 2 shift registers, daisy chained together, with their last output on pin 6. Note: NC pins are skipped. One is just a list with segments you can stack onto each other. The first value of each line is layer 1 and the other layer 2. The other programm is a complete example.

Pinout

I numbered these pins from left to right. Pin 30 is the one next to the "M". The letters are the the 7 segments of a digit (see below). NC = Not Connected

⚠️WARNING⚠️ Pins 26 and 29 are also connected to the layer common pins. If you sweep across with a wire this will cause a short!

Pin No. Layer 1 Layer 2
1 Layer 1 Layer 1
2 Layer 2 Layer 2
3 NC NC
4 NC NC
5 Dot at the top-left NC
6 NC Digit 1 b
7 Digit 1 a Digit 1 g
8 Digit 1 d Digit 1 e
9 Digit 2 e Digit 1 c
10 Digit 2 g Digit 2 b
11 NC NC
12 Digit 2 d Digit 2 c
13 Digit 2 f Digit 2 a
14 NC NC
15 Digit 3 a Digit 3 f
16 Digit 3 b Digit 3 g
17 Digit 3 c Digit 3 d
18 Digit 4 e Digit 3 e
19 Digit 4 g Digit 4 b
20 Digit 4 d Digit 4 c
21 Digit 4 f Digit 4 a
22 NC NC
23 NC NC
24 NC NC
25 NC NC
26 ⚠️WARNING⚠️ Also connected to Layer 1
27 NC NC
28 NC NC
29 ⚠️WARNING⚠️ Also connected to Layer 2
30 Double points in the middle NC

7-segment

#define dataPin 2
#define clockPin 3
#define latchPin 4
#define layer1 5
#define layer2 7
int nextLayer = 1;
char currentDisplay[4] = "0000";
word result = 0;
const word digits[] = {
// digit 1
0b0000000000000000, 0b0000000000000000, // 0 left blank
0b0000000000000000, 0b1001000000000000, // 1
0b0110000000000000, 0b1110000000000000, // 2
0b0000000000000000, 0b0000000000000000, // 3 not needed
0b0000000000000000, 0b0000000000000000, // 4 not needed
0b0000000000000000, 0b0000000000000000, // 5 not needed
0b0000000000000000, 0b0000000000000000, // 6 not needed
0b0000000000000000, 0b0000000000000000, // 7 not needed
0b0000000000000000, 0b0000000000000000, // 8 not needed
0b0000000000000000, 0b0000000000000000, // 9 not needed
// digit 2
0b0001011000000000, 0b0000111000000000, // 0
0b0000000000000000, 0b0000110000000000, // 1
0b0001110000000000, 0b0000101000000000, // 2
0b0000110000000000, 0b0000111000000000, // 3
0b0000101000000000, 0b0000110000000000, // 4
0b0000111000000000, 0b0000011000000000, // 5
0b0001111000000000, 0b0000011000000000, // 6
0b0000000000000000, 0b0000111000000000, // 7
0b0001111000000000, 0b0000111000000000, // 8
0b0000111000000000, 0b0000111000000000, // 9
// digit 3
0b0000000000000000, 0b0000000000000000, // 0 left blank
0b0000000011000000, 0b0000000000000000, // 1
0b0000000110000000, 0b0000000011100000, // 2
0b0000000111000000, 0b0000000011000000, // 3
0b0000000011000000, 0b0000000110000000, // 4
0b0000000101000000, 0b0000000111000000, // 5
0b0000000000000000, 0b0000000000000000, // 6 not needed
0b0000000000000000, 0b0000000000000000, // 7 not needed
0b0000000000000000, 0b0000000000000000, // 8 not needed
0b0000000000000000, 0b0000000000000000, // 9 not needed
// digit 4
0b0000000000101100, 0b0000000000011100, // 0
0b0000000000000000, 0b0000000000011000, // 1
0b0000000000111000, 0b0000000000010100, // 2
0b0000000000011000, 0b0000000000011100, // 3
0b0000000000010100, 0b0000000000011000, // 4
0b0000000000011100, 0b0000000000001100, // 5
0b0000000000111100, 0b0000000000001100, // 6
0b0000000000000000, 0b0000000000011100, // 7
0b0000000000111100, 0b0000000000011100, // 8
0b0000000000011100, 0b0000000000011100 // 9
};
void getDigits() {
result = 0;
for (int digit = 0; digit < 4; digit++) {
result = result | digits[digit * 20 + (currentDisplay[digit] - 48) * 2 + (nextLayer - 1)];
}
}
void displayDigits() {
if (nextLayer == 2) {
getDigits();
digitalWrite(layer1, HIGH);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, (result >> 8) & 0xFF);
shiftOut(dataPin, clockPin, MSBFIRST, (result >> 0) & 0xFF);
digitalWrite(latchPin, HIGH);
digitalWrite(layer2, LOW);
nextLayer = 1;
} else {
getDigits();
digitalWrite(layer2, HIGH);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, (result >> 8) & 0xFF);
shiftOut(dataPin, clockPin, MSBFIRST, (result >> 0) & 0xFF);
digitalWrite(latchPin, HIGH);
digitalWrite(layer1, LOW);
nextLayer = 2;
}
}
void setup() {
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
pinMode(layer1, OUTPUT);
pinMode(layer2, OUTPUT);
delay(100);
}
void loop(){
displayDigits();
delay(10);
}
const word digits[] = {
// digit 1
0b0000000000000000, 0b0000000000000000, // 0 left blank
0b0000000000000000, 0b1001000000000000, // 1
0b0110000000000000, 0b1110000000000000, // 2
0b0000000000000000, 0b0000000000000000, // 3 not needed
0b0000000000000000, 0b0000000000000000, // 4 not needed
0b0000000000000000, 0b0000000000000000, // 5 not needed
0b0000000000000000, 0b0000000000000000, // 6 not needed
0b0000000000000000, 0b0000000000000000, // 7 not needed
0b0000000000000000, 0b0000000000000000, // 8 not needed
0b0000000000000000, 0b0000000000000000, // 9 not needed
// digit 2
0b0001011000000000, 0b0000111000000000, // 0
0b0000000000000000, 0b0000110000000000, // 1
0b0001110000000000, 0b0000101000000000, // 2
0b0000110000000000, 0b0000111000000000, // 3
0b0000101000000000, 0b0000110000000000, // 4
0b0000111000000000, 0b0000011000000000, // 5
0b0001111000000000, 0b0000011000000000, // 6
0b0000000000000000, 0b0000111000000000, // 7
0b0001111000000000, 0b0000111000000000, // 8
0b0000111000000000, 0b0000111000000000, // 9
// digit 3
0b0000000000000000, 0b0000000000000000, // 0 left blank
0b0000000011000000, 0b0000000000000000, // 1
0b0000000110000000, 0b0000000011100000, // 2
0b0000000111000000, 0b0000000011000000, // 3
0b0000000011000000, 0b0000000110000000, // 4
0b0000000101000000, 0b0000000111000000, // 5
0b0000000000000000, 0b0000000000000000, // 6 not needed
0b0000000000000000, 0b0000000000000000, // 7 not needed
0b0000000000000000, 0b0000000000000000, // 8 not needed
0b0000000000000000, 0b0000000000000000, // 9 not needed
// digit 4
0b0000000000101100, 0b0000000000011100, // 0
0b0000000000000000, 0b0000000000011000, // 1
0b0000000000111000, 0b0000000000010100, // 2
0b0000000000011000, 0b0000000000011100, // 3
0b0000000000010100, 0b0000000000011000, // 4
0b0000000000011100, 0b0000000000001100, // 5
0b0000000000111100, 0b0000000000001100, // 6
0b0000000000000000, 0b0000000000011100, // 7
0b0000000000111100, 0b0000000000011100, // 8
0b0000000000011100, 0b0000000000011100 // 9
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment