Hi, I'm fairly new to arduino, and I've hit my first problem.
I'm trying to control 4 seven segment displays using HEF4511 decoders. I've connected all the data bits up as common connections between all of the decoders, and the latch enables seperately to their own pin.
My understanding on how to display different numbers on each display is:
Set the LE of the wanted decoder LOW > Set the data bits to the correct binary value > Set the LE of the wanted decoder HIGH so it holds its value > Repeat for the next one etc
My problem, is that when the program is running, occassionally one of the seven segments will change back to 0. Now the only way that the seven segment could be changed to 0, is if the LE was LOW, and the data bits were all LOW, which as you can see below, is not in the program anywhere.
Here is a video to try and make it clearer:
The code is below:
/*
*/
void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
pinMode(16, OUTPUT);
digitalWrite(16, HIGH); //Lamp Test
}
void loop() {
digitalWrite(8, LOW); //7 Segment 1
delay(1000);
digitalWrite(12, HIGH); //Binary LSB
digitalWrite(13, LOW);
digitalWrite(14, LOW);
digitalWrite(15, LOW); //Binary MSB
delay(1000);
digitalWrite(8, HIGH); //7 Segment 1
delay(1000);
digitalWrite(9, LOW); //7 Segment 2
delay(1000);
digitalWrite(12, LOW); //Binary LSB
digitalWrite(13, HIGH);
digitalWrite(14, LOW);
digitalWrite(15, LOW); //Binary MSB
delay(1000);
digitalWrite(9, HIGH); //7 Segment 2
delay(1000);
}
(I have set the delays a lot longer than they would normally be to try and make it clearer for the video)
Here is a link to the decoder datasheet: HEF4511BP Datasheet(PDF) - NXP Semiconductors
Any ideas or suggestions would be greatly appreciated.