Open OPI-0 opened 6 years ago
Hi, thank you! What do you mean by x and y? What's the expected behavior and the current behavior?
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.
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?
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!!
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();
}
}
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?
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!
Sorry closed by accident
You're welcome! I will update with these options when I have time.
Thanks again for your great support!, You really created a very nice and complete library!! glad it works on the display now!!
Solved
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.
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
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
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?