Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for roboDyn 7seg display (Mod-LED-Display-8D-74HC595) #1

Open
OPI-0 opened this issue Oct 6, 2017 · 14 comments
Open

Support for roboDyn 7seg display (Mod-LED-Display-8D-74HC595) #1

OPI-0 opened this issue Oct 6, 2017 · 14 comments
Assignees

Comments

@OPI-0
Copy link

OPI-0 commented Oct 6, 2017

Hi!,

Great library!,

Small issue here, I have bought the display below:
[http://robotdyn.com/catalog/segment/8_digit_led_display_tube_7_segments_74hc595/]

Now it seems that x and y have been switched?
is this easy to modify?

@pmiguelpinto90
Copy link
Owner

pmiguelpinto90 commented Oct 7, 2017

Hi, thank you!
What do you mean by x and y?
What's the expected behavior and the current behavior?

@OPI-0
Copy link
Author

OPI-0 commented Oct 7, 2017

Hi!

When i write the 0 character to the display, it shows on 6 of the eight characters in the middle of the digit...
I am currently trying to get the schematics of the display module.

@pmiguelpinto90
Copy link
Owner

If you only create a ShiftDisplay object, without calling any function, are all leds turned off?
And if you call display.setDot(7, true), what leds are turned on?

@OPI-0
Copy link
Author

OPI-0 commented Oct 8, 2017

ShiftDisplay without a call to any function shows all leds off.
The display.setDot(7, true) also does not show anything..

However if i call display.setDot(0, true); , segment A of the 3th digit light up (digits 0-7)

#include <ShiftDisplay.h>

ShiftDisplay display(COMMON_CATHODE, 7);  // 8 digits

void setup() {
  display.setDot(0, true);
}

void loop() {
display.show();
}

If i change to COMMON_ANODE, all segments and dots from all digits light up....
Thank you for your support!!

@OPI-0
Copy link
Author

OPI-0 commented Oct 8, 2017

Did some more testing, and the code below works, it shows 0-9 and the dot on each of the 8 positions starting on the left side of the display. Found the code here had to make some modifications to get it working hope this helps. (and can be included in the library)

Thx!

const int clockpin = 7; //SCK
const int latchpin = 6; //RCK 
const int datapin = 5;  //DIO
const int num_of_digits = 8;

/* Segment bit location(7=MSB, 0=LSB):
 * 
 *    |--0--|
 *   5|     |1
 *    |--6--|
 *   4|     |2
 *    |--3--| **7
 */

// Array with possible values(0 = segment ON, 1 = segment off)
byte value[] ={ B11000000, // 0
                B11111001, // 1
                B10100100, // 2
                B10110000, // 3
                B10011001, // 4
                B10010010, // 5
                B10000010, // 6
                B11111000, // 7
                B10000000, // 8
                B10010000, // 9
                B11111111};// display nothing

byte digit[] ={ B00010000, // left segment
                B00100000,
                B01000000,
                B10000000, 
                B00000001,
                B00000010,
                B00000100,
                B00001000,};// right segment

void showDigit(int segmentnum, int number, bool showdecimalpoint)
{
  digitalWrite(latchpin,LOW);
  byte value_temp = value[number];
  value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp;
  shiftOut(datapin,clockpin,MSBFIRST,value_temp);
  shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); 
  digitalWrite(latchpin,HIGH);
}

int counter = 0;
void demoDelay()
{
  // *** Delay for demo purposes only ***
  counter++;
  if(counter <= num_of_digits)
  {
    delay(200);
  }
  else
  {
    delay(1);
    if(counter >= (num_of_digits*200))
    {
      counter = 0;
    }
  }
  // ************************************
}
                
void setup() {
  pinMode(clockpin, OUTPUT);
  pinMode(latchpin, OUTPUT);
  pinMode(datapin, OUTPUT);
}

void loop() {;
  for(int i = 0; i < num_of_digits; i++)
  {
    showDigit(i, i, true);
    demoDelay();
  }
}

@pmiguelpinto90
Copy link
Owner

pmiguelpinto90 commented Oct 8, 2017

In the library file src/CharacterEncoding.h, change INDEXES array (line 60) to:

B00001000,
B00000100,
B00000010,
B00000001,
B10000000,
B01000000,
B00100000,
B00010000

and in src/ShiftDisplay.cpp, switch lines 85 and 88:

shiftOut(_dataPin, _clockPin, LSBFIRST, _buffer[i]);
shiftOut(_dataPin, _clockPin, LSBFIRST, out);

With ShiftDisplay display(COMMON_ANODE, 8); works ok?

@OPI-0
Copy link
Author

OPI-0 commented Oct 9, 2017

WOW!!
Seems it s fixed!!
All demo's run, will do some more testing later on and keep you posted!

Really many many thanks for your help here!

@OPI-0 OPI-0 closed this as completed Oct 9, 2017
@OPI-0 OPI-0 reopened this Oct 9, 2017
@OPI-0
Copy link
Author

OPI-0 commented Oct 9, 2017

Sorry closed by accident

@pmiguelpinto90
Copy link
Owner

You're welcome!
I will update with these options when I have time.

@OPI-0
Copy link
Author

OPI-0 commented Oct 9, 2017

Thanks again for your great support!,
You really created a very nice and complete library!! glad it works on the display now!!

@OPI-0
Copy link
Author

OPI-0 commented Oct 13, 2017

Solved

@bloodcolin
Copy link

Hi MiguelPynto,

Your comment:
"In the library file src/CharacterEncoding.h, change INDEXES array (line 60) to:

B00001000,
B00000100,
B00000010,
B00000001,
B10000000,
B01000000,
B00100000,
B00010000
and in src/ShiftDisplay.cpp, switch lines 85 and 88:

shiftOut(_dataPin, _clockPin, LSBFIRST, _buffer[i]);
shiftOut(_dataPin, _clockPin, LSBFIRST, out);
With ShiftDisplay display(COMMON_ANODE, 8); works ok?"

No longer works with the display that OPI-0 and now I have.
I can only find the first correction in your code for the index array changes.

The two shiftOut corrections (lines 85 and 88) no longer exist in your ShiftDisplay.cpp code.
Am I missing something? When I make the index array changes you recommend and attempt the weather example all I get is 8.8.8.8.8.8.8.8. sequentially flashing on the display.

@paullbart
Copy link

paullbart commented Mar 14, 2019

anyone still having this issue, make sure you set swapShiftRegistors to true when you declare the object. This will force the display into multiplex mode. No need to change any of the code.

e.g

ShiftDisplay readOut(12,11,10,COMMON_CATHODE,4,true); // latch, clock, Data

@tswfi
Copy link

tswfi commented Apr 17, 2019

I still had problems with the RobotDyn 6 digit display (would not show values consistently right).

Made a PR which adds SPI support (which has better timings than bitbanging) and has an example for driving a 6 digit RobotDyn 595 multiplexed display #9

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

No branches or pull requests

5 participants