Author Topic: Multiplexing a 7seg display with an ATtiny167  (Read 994 times)

0 Members and 1 Guest are viewing this topic.

Offline Random Model MakerTopic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: lu
  • This profile has been abandoned. I'm now "RedLion"
Multiplexing a 7seg display with an ATtiny167
« on: October 31, 2017, 10:34:35 pm »
Hello,

I am realising a small voltage and temperature control circuit in another project. As I am not very good at programming nor do I really like it, I prototyped the circuit with an Arduino Uno and then programmed it onto the ATtiny167 via ISP.
On the breadboard with the Arduino Uno, the circuit works perfectly well, but on the actual PCB I did, the unused segments of the display glow dimly and make it hard to read. I have tried varying the multiplexing times, but so far, that did not help and I am a bit stuck.
I cannot see why this should be a fault of the code, when it is working on the Uno just fine. Maybe some mistake in the schematic, why I could not go from the Uno directly to the Microcontroller?
The display time for each digit is 5ms. You an find a schematic and my code in the attachments.
I'd think of something clever to say, but I got nothing, so I just won't.
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: Multiplexing a 7seg display with an ATtiny167
« Reply #1 on: October 31, 2017, 10:42:46 pm »
Code: [Select]
void callupDigit1(int y) {
  //Digit 1
  digitalWrite(disp1,HIGH);
  digitalWrite(disp2,LOW);
  digitalWrite(disp3,LOW);
  digitalWrite(segDP,HIGH);
  display(y);
}

You are changing the digit drivers while the segments are still set. Turn off all drivers, change the segments, turn on the needed driver.
What you see, I call it 'ghosting' .

Code: [Select]
void callupDigit1(int y) {
  //Digit 1
  digitalWrite(disp1,LOW); //off
  digitalWrite(disp2,LOW); //off
  digitalWrite(disp3,LOW); //off
  digitalWrite(segDP,HIGH); //off (is a segment)
  display(y); //set new segments
  digitalWrite(disp1,HIGH); //now turn on digit
}

I don't know that it will solve your problem, but it will certainly be better.

If you think about what is happening in 'slow motion', it will make sense-
digit1 is displaying a number 5
now, change to digit2 by first setting the digit2 driver on
stop here. the segments are still driving a number 5, but are now on digit2
now, change the segments to a number 7
ok. looks good now

that brief time the number 5 'shifted' to digit2 will be somewhat visible
how visible may depend on how efficient the display is, among other things
« Last Edit: October 31, 2017, 11:10:06 pm by cv007 »
 

Offline Random Model MakerTopic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: lu
  • This profile has been abandoned. I'm now "RedLion"
Re: Multiplexing a 7seg display with an ATtiny167
« Reply #2 on: October 31, 2017, 11:13:12 pm »
Thank you very much, it worked wonderfully!

Was quite easy if you know how (duh).
I had tried something with turning all digits off for 1ms and then turning the concerned one on again, but that did not work.
Changing segments in between did not come to my mind.
I'd think of something clever to say, but I got nothing, so I just won't.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf