This was an electric typewriting machine.
While disassembling an old electric typewriter which was sleeping since years in a corner, I’ve found this LCD.
The strange LCD screen found.
Counting the number of elements it is clear that it war able to display 16 caracters. Moreover, externally it is very similar to LCD driven by the classical Hitachi HDD44780 . Therefore I tempted my chance and connected it as if a standard LCD module (see this post). I was pretty surprised when the first "Hello word » program worked.
The LCD displayed just « Hello wo » :-(
After several trials and experiments, I understood. This LCD has indeed 2 rows, each of 8 characters but the rows are physically mounted one after the other horizontally!
The usual LCD library found in Arduino cannot manage this situation. I therefore adjusted the library but I preferred to spin it off completely. Initializers and other functions have been simplified, globally only a few changes have been done. The display of characters has been adjusted so that now it operates like a one row LCD of 16 characters. You can find it here. Also the examples accompanying the old LCD library have been rewritten.
The code
Essentially the greatest change is the following lines in the constructor:
void LCD1S::begin(uint8_t cols, uint8_t dotsize) { _curpos = 0; _cols = cols/2 - ((cols+1)%2); // recall that display is split in two // sets of cols/2 columns each // we assume that cols>0 is always true // adjustment is made in case of odd number of columns // (even if I've never heard of any LCD with odd number // of columns) ...
and the function which positions the cursor in which the address location of columns has been adjusted to the correct offset:
void LCD1S::setCursor(uint8_t col) { // int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; // second part of display (columns 8 to 15) // are at address 0x40 // so if we want to access column 8 we should // write to address col+0x40-_cols _curpos = col; command(LCD_SETDDRAMADDR | (col > 7)?col+0x40-_cols:col); }
I don’t know if these displays are very common or not. If someone is interested I can publish the full sources of the library on GitHub. At this point, as usual, enjoy!
No comments :
Post a Comment