Skip to content

Instantly share code, notes, and snippets.

@2N2222A
Created September 26, 2014 07:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2N2222A/5fcf2e630493f63316eb to your computer and use it in GitHub Desktop.
Save 2N2222A/5fcf2e630493f63316eb to your computer and use it in GitHub Desktop.
HDSP-0960 Display test code
/*
HDSP-0960 display test code by JS106351
This code sends multiplexed BCD signals to HP/Avago Numeric Displays. The HDSP-0960 is similar in functionality to the TIL311
but does not display Hexadecimal numbers, only numeric. This code takes the time since the last uC reset [millis()] parses and
separates the number into digits and is then written to the display. Feel free to use the code as you like and if you have any suggestions
on improving it please share it with us. Thanks.
*/
byte BCD[16][4] ={{0,0,0,0},{1,0,0,0},{0,1,0,0},{1,1,0,0},
{0,0,1,0},{1,0,1,0},{0,1,1,0},{1,1,1,0},{0,0,0,1},{1,0,0,1},
{0,1,0,1},{1,1,0,1},{0,0,1,1},{1,0,1,1},{0,1,1,1},{1,1,1,1}};
int inputs1[4] = { 9, 10, 11, 12};
void setup(){
for (int n=0; n < 4; n++){
pinMode(inputs1[n], OUTPUT);
}
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
}
void loop(){
/*
int i;
float f;
f = 3.6;
i = (int) f; // now i is 3 only used for casting floats into integers.
*/
int x=millis()/100;
int ones = (x % 10);
int tens = ((x / 10) % 10);
int hundreds = ((x / 100) %10);
int thousands = ((x / 1000) %10 );
digitalWrite(3, LOW);
for(int c = 0; c < 4; c++){
digitalWrite(inputs1[c], BCD[thousands][c]);
}
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
for(int c = 0; c < 4; c++){
digitalWrite(inputs1[c], BCD[hundreds][c]);
}
digitalWrite(4, HIGH);
digitalWrite(7, LOW);
for(int c = 0; c < 4; c++){
digitalWrite(inputs1[c], BCD[tens][c]);
}
digitalWrite(7, HIGH);
//delay(20);
digitalWrite(8, LOW);
for(int c = 0; c < 4; c++){
digitalWrite(inputs1[c], BCD[ones][c]);
}
digitalWrite(8, HIGH);
delay(100);
}
@admiralbeeyotch
Copy link

Is there any way we could get a circuit to see how to wire it up? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment