Programming Help - Multiplexing

Hi all!

I have an issue with part of my program and i can't figure out where the problem lies.

I have multiplexed 4 seven segment displays as a prototype for when my 7 seg nixie tubes come and its purpose is to display prices in a shop window. I have successfully got all 4 of the individual displays to operate from 0-9. however... When the number 2 comes into play the bottom right led will light up as if it is trailing through the sequence of code.

It is running through an arduino Uno.

I will attach a picture with the project displaying the numbers 1234 and you will be able to see what is happening.
I will also upload the program.

PS im still fairly noobish with this and really would appreciate any help you guys can throw my way!

Multiplex_1.ino (2.47 KB)

Which muliplexing IC you are using?? analog or digital

Check this part of your code

byte sevenSegment[10][7] =
{
  //a b c d e f g
  { 0,1,1,1,1,1,1,},  // = 0
  { 0,0,0,1,0,0,1 },  // = 1
  { 1,0,1,1,1,1,0 },  // = 2
  { 1,0,1,1,0,1,1 },  // = 3
  { 1,1,0,1,0,0,1 },  // = 4
  { 1,1,1,0,0,1,1 },  // = 5
  { 1,1,1,0,1,1,1 },  // = 6
  { 0,0,1,1,0,0,1 },  // = 7
  { 1,1,1,1,1,1,1 },  // = 8
  { 1,1,1,1,0,1,1 },  // = 9
};
void segmentWrite(byte digit)
{
  byte pin = 2;
  for (byte i=0; i<7; ++i)
  {
    digitalWrite(pin, sevenSegment[digit][i]);
      ++pin;
  }
}

If you check your code you Keep reading 1234 in main loop . You not reading other values. thats reason it keep displaying 1234

/*    Arduino pin    7 segment
        2              a
        3              b
        4              c
        5              d
        6              e
        7              f
        8              g
        9              dp(dot pin)
        10             digit 0
        11             digit 1
        12             digit 2
        13             digit 3
*/
byte digit0 = 10;
byte digit1 = 11;
byte digit2 = 12;
byte digit3 = 13;
byte dotPin = 9;
byte digit11=1;
byte sevenSegmentPins[] = {2,3,4,5,6,7,8};
byte sevenSegment[10][7] =
{
  //a b c d e f g
  { 0,1,1,1,1,1,1,},  // = 0
  { 0,0,0,1,0,0,1 },  // = 1
  { 1,0,1,1,1,1,0 },  // = 2
  { 1,0,1,1,0,1,1 },  // = 3
  { 1,1,0,1,0,0,1 },  // = 4
  { 1,1,1,0,0,1,1 },  // = 5
  { 1,1,1,0,1,1,1 },  // = 6
  { 0,0,1,1,0,0,1 },  // = 7
  { 1,1,1,1,1,1,1 },  // = 8
  { 1,1,1,1,0,1,1 },  // = 9
};
void setup()
{
  Serial.begin(9600);
   pinMode(dotPin, OUTPUT); //pin 9
   pinMode(digit0, OUTPUT); //pin 10
   pinMode(digit1, OUTPUT); //pin 11
   pinMode(digit2, OUTPUT); //pin 12
   pinMode(digit3, OUTPUT); //pin 13
  for(int i=0; i<7; i++)
  {
    pinMode(sevenSegmentPins[i], OUTPUT);
  }
  digitalWrite(dotPin, HIGH);
  digitalWrite(digit0, HIGH);
  digitalWrite(digit1, HIGH);
  digitalWrite(digit2, HIGH);
  digitalWrite(digit3, HIGH);
}
void segmentWrite(byte digit)
{
  byte pin = 2;
  for (byte i=0; i<7; ++i)
  {
    digitalWrite(pin, sevenSegment[digit][i]);
    ++pin;
  }
   
}
void loop()
{
  
  digitalWrite(digit1, LOW);  //disable digit
  digitalWrite(digit2, LOW);  //disable digit
 digitalWrite(digit3, LOW);  //disable digit
 digitalWrite(digit0, HIGH); //enable digit0
  
   for (int i=0;i<7;i++)
  {
   Serial.print("Segment write:");
    Serial.println(sevenSegment[digit11][i]); 
    delay(5);
  }
  digit11= digit11+1;
  if(digit11>=7)
  {
    digit11=1;
  }
delay(1000);
   Serial.println(".....................");
}

try this code once

I'm trying to make it display 1234 but the additional LED is illuminated making the 2 look like a backwards 6.

And i thought that was the easiest way to be able to edit the program easily by putting the binary values for each number of the display and then using segmentWrite("number") which uses the binary values to illuminate the LED's in each display forming the numbers.

cheers.

hammo92:
I'm trying to make it display 1234 but the additional LED is illuminated making the 2 look like a backwards 6.

Your description is not very clear. Do you mean that instead of 1234 it is showing 1634 (pretend my 6 is backways). Does it show 6 instead of 2 in every digit position, or only in one of them - if so, which one?

...R

Hi Robin, Yes sorry for my bad explanation haha, in every position it is showing the backwards 6 when I tell it to display the number 2

Cheers

hammo92:
Hi Robin, Yes sorry for my bad explanation haha, in every position it is showing the backwards 6 when I tell it to display the number 2

Cheers

That sounds like your definition for the character 2 is incorrect.

Another possibility is that the unwanted ON section is a residue of the previously displayed character.

...R

holy crap i feel like the biggest idiot... the dot point was swapped with the G pin.... SMH

Thanks for your time! and sorry for wasting it.

Cheers,

hammo92:
holy crap i feel like the biggest idiot...

An easy mistake to make - don't worry.

And, for the future you should now know what symptoms point to that sort of problem.

...R