Go Down

Topic: Control 8 x 7 Segment display. (Read 4 times) previous topic - next topic

JoeN

#5
Jan 07, 2013, 06:45 pm Last Edit: Jan 07, 2013, 06:47 pm by JoeN Reason: 1
I am not sure why you are telling your shift register chain to latch before you have all the data out there.  I think by latching it every time with the delay you get the other letters displaying but only for an imperceptable amount of time and then O for a full second.  Without the delay you get all the letters showing for the same imperceptable amount of time but at  a 1/5 duty cycle which is why it works.  Try this, hopefully it works better:

Code: [Select]

void loop()
{
 digitalWrite(latch,LOW);
 shiftOut(data,clock,MSBFIRST,1);
 shiftOut(data,clock,MSBFIRST,B10001001);
 shiftOut(data,clock,MSBFIRST,2);
 shiftOut(data,clock,MSBFIRST,B10001000);
 shiftOut(data,clock,MSBFIRST,4);
 shiftOut(data,clock,MSBFIRST,B11000111);
 shiftOut(data,clock,MSBFIRST,8);
 shiftOut(data,clock,MSBFIRST,B11000111);
 shiftOut(data,clock,MSBFIRST,16);
 shiftOut(data,clock,MSBFIRST,B11000000);
 digitalWrite(latch,HIGH);
 
 delay(1000);
}

I have only come here seeking knowledge. Things they would not teach me of in college.

Nightwolf83

Hi JoeN,

thanks for the quick answer.

When i use your code only the last Segment is activ ("O" will be shown).


JoeN


Hi JoeN,

thanks for the quick answer.

When i use your code only the last Segment is activ ("O" will be shown).


Wow, sorry to lead you down the wrong path.  Gotta give that a think, not sure why it would behave that way.  Anyone else have a good idea here?
I have only come here seeking knowledge. Things they would not teach me of in college.

Boffin1

I dont get the

Code: [Select]
  shiftOut(data,clock,MSBFIRST,1);
  shiftOut(data,clock,MSBFIRST,B10001001);


I usually take the latch low, then pump through all the Bbytes and take the latch high again.

The bytes will be latched into the right registers...
With my mobile phone I can call people and talk to them -  how smart can you get ?

Nightwolf83


Thanks for your help Boffin1.

when i use this code
Code: [Select]

  digitalWrite(latch,LOW);
  shiftOut(data,clock,MSBFIRST,B10101010);
  shiftOut(data,clock,MSBFIRST,B11111001);
  digitalWrite(latch,HIGH);


every second Segment shows "1" this is correct but i want to control every single segment for example the first "1" the second "2" ....

I tried also this code

Code: [Select]

  digitalWrite(latch,LOW);
 
  shiftOut(data,clock,MSBFIRST,B10101010);
  shiftOut(data,clock,MSBFIRST,B11111001);
   shiftOut(data,clock,MSBFIRST,B01010101);
  shiftOut(data,clock,MSBFIRST,B10010000);
 
  digitalWrite(latch,HIGH);


Now i see the the other segments I think this is also correct, because i overwrite the first Bytes. I don't know how can i control every single Segment.




Go Up