Closed tistructor closed 2 years ago
Thanks for raising this issue.
I don't have a M5450 to test but I will update my library to send an extra clock pulse.
Your segments are hooked up in the reverse order,. To fix you can change the following line:
PROGMEM const driver driverTable[] = {
{ "M5450", 35, false, false, true, false, false }, // this line has changed
{ "M5451", 35, false, true, true, false, false },
{ "MM5452", 32, false, true, true, false, true },
{ "MM5453", 33, false, true, true, false, false },
{ "AY0438", 32, true, false, false, true, false },
{ "BT-M512RD-DR1", 35, false, true, true, false, true }
};
Hi, I tried to change parameter 4 with both false and true but the result on the display does not change, I read the minutes instead of the hours and vice versa. The order of the display is : My Display --- Library 4 --- 2 3 --- 1 2 --- 4 1 --- 3
Look at the photo (15:02)
I tried to put true (row 682) inside the display () function and the numbers come out as in the photo, if I put false the order of the segments is wrong, and nothing is read.
I found a bug :
// Copy driver data into the struct in main memory
_device.name = (char*) pgm_read_word(&(pDriverTable[i].name));
_device.segments = (uint8_t) pgm_read_word(&(pDriverTable[i].segments));
_device.pulseLoad = (boolean) pgm_read_word(&(pDriverTable[i].pulseLoad));
_device.segmentsOrderInc = (boolean) pgm_read_word(&(pDriverTable[i].segmentsOrderInc));
_device.initialBit = (boolean) pgm_read_word(&(pDriverTable[i].initialBit));
_device.cascadable = (boolean) pgm_read_word(&(pDriverTable[i].cascadable));
where the variables are boolean or uint8_t pgm_read_byte and non pgm_read_word are needed.
// Copy driver data into the struct in main memory
_device.name = (char*) pgm_read_word(&(pDriverTable[i].name));
_device.segments = (uint8_t) pgm_read_byte(&(pDriverTable[i].segments));
_device.pulseLoad = (boolean) pgm_read_byte(&(pDriverTable[i].pulseLoad));
_device.segmentsOrderInc = (boolean) pgm_read_byte(&(pDriverTable[i].segmentsOrderInc));
_device.initialBit = (boolean) pgm_read_byte(&(pDriverTable[i].initialBit));
_device.cascadable = (boolean) pgm_read_byte(&(pDriverTable[i].cascadable));
for now I have to complete my method again. Perhaps a variable in "struct driver" is needed which indicates the correct sequence of displays. For example, for my "3412" tab compared to the default value of "1234" and add some code.
My bad, try this to define the order of the digits! :) Let me know if it works.
display.setWiring(RIGHT_TO_LEFT)
does not work. Only the two central LEDs are correct but the 4 displays have incorrect characters.
It's an old card and I think for routing convenience they set the links in this mode.
I just noticed your screen definition is wrong. This might work...
screen.begin("M5450", "8.8|8.8.");
The screen definition tells the software the segments are attached to the driver IC and has to match the wiring. Your screen has 2 outputs for the colon character and I don't think my library can support this wiring :(
screen.begin("M5450", "8.8.8.8.|"); It works this way but I always have to use the part of code that I put on the display ().
Thanks
This is a small quick test to check how it works like a watch:
/*
*/
#include <SevenSegment.h>
#include <RTClib.h>
RTC_Millis rtc;
const int pinClock = 7;// clock
const int pinData = 6;// data
const int pinP1 = 8;// P1
const int pinP2 = 9;// P2
SevenSegment screen(pinClock, pinData);
void setup() {
Serial.begin(9600);
//Set display driver M5450 LX1204
screen.begin("M5450", "8.8.8.8.|");
screen.setAlignment(RIGHT);
// screen.setWiring(RIGHT_TO_LEFT);
//Turn all known segments off
screen.clear();
delay(1000);
screen.on();
delay(100);
screen.clear();
rtc.begin(DateTime(F(__DATE__), F(__TIME__)));
}
uint16_t ore;
uint16_t minuti;
uint16_t secondi;
uint16_t ora7Seg;
uint16_t ora7SegPrec;
uint16_t secondiPrec;
void loop() {
DateTime now = rtc.now();
// Serial.print(now.hour(), DEC);
// Serial.print(':');
// Serial.print(now.minute(), DEC);
// Serial.print(':');
// Serial.print(now.second(), DEC);
// Serial.println();
ore = now.hour();
minuti = now.minute();
secondi = now.second();
ora7Seg = ore * 100 + minuti;
if (ora7Seg != ora7SegPrec) {
screen.printNumber(ora7Seg);
ora7SegPrec = ora7Seg;
}
if (secondi != secondiPrec) {
screen.setSegment(32, !screen.getSegment(32));
screen.setSegment(33, !screen.getSegment(33));
screen.display();
secondiPrec = secondi;
}
}
Looks like you got it working! 👏🏽👏🏽👏🏽😊
I was using a card with "8.8.8.8.::" with your library and I encountered a problem with the example of basic.ino. The initial 5 flashes did not occur, it seemed that the screen.clear () function did not work.
I took a look at the functions of the library, in particular the display () and I realized that with the M5450 driver only 35 clocks are sent including the initial bit, instead it is necessary to send 36 clocks according to the data sheet. I also put 35 bits of data for the M5450 driver and the example now works properly.
https://user-images.githubusercontent.com/24445373/176171851-9be1eb44-f310-4b6a-9443-553636829a14.mp4
Basic.ino modified. The modification to the display () is also reported because my shield is not connected as you suggested but there are 7-segment displays in different order.