|
|
View previous topic :: View next topic |
Author |
Message |
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
20x2 LCD unknown type [SOLVED] |
Posted: Sat Nov 14, 2015 8:19 am |
|
|
I have this problem for 3 years ago when i buy 16 pieces of display for my tobacco room. Now my project is already finished and still i don't know what type is. I had the original datasheet but was corrupted and after that no chance to find a good one.
To understand the problem, the connection is ok, the LCD initialize and "work" but don't work how i wish. Normal characters are displayed good, also numbers, but not any other character like (~ !,#,$,&,*,).
To put the *C for example has need to fill the GG ROM in the first 8 location but still like that can write just 7, the last position will follow me in any line, thats annoying. Below i put some data of display with good connection but not originally.
http://www.farnell.com/datasheets/40247.pdf
and here the photos of him and second data that i think is, but is not.
http://www.filedropper.com/dsc02221
http://www.filedropper.com/dsc02224
http://www.filedropper.com/lcdkokost7066uv22
I use flexlcd driver of PCM_p post with some timing modification,
i put just the defines here.
Code: | #include </h/LCD_custom_chars.h>
#define LCD_DB4 PIN_D4
#define LCD_DB5 PIN_D5
#define LCD_DB6 PIN_D6
#define LCD_DB7 PIN_D7
#define LCD_RS PIN_E0
#define LCD_RW PIN_E1
#define LCD_E PIN_E2
// Clear and home
#define LCD_CLR_DISP 0x01 // Clear screen, home cursor, unshift display
#define LCD_RETURN_HOME 0x02 // Home cursor, unshift display
// Set entry mode: display shift on/off, dec/inc cursor move direction
#define LCD_ENTRY_DEC 0x04 // Display shift off, dec cursor move dir
#define LCD_ENTRY_DEC_SHIFT 0x05 // Display shift on, dec cursor move dir
#define LCD_ENTRY_INC 0x06 // Display shift off, inc cursor move dir
#define LCD_ENTRY_INC_SHIFT 0x07 // Display shift on, inc cursor move dir
// Display on/off, cursor on/off, blinking char at cursor position
#define LCD_DISP_OFF 0x08 // Display off
#define LCD_DISP_ON 0x0C // Display on, cursor off
#define LCD_DISP_ON_BLINK 0x0D // Display on, cursor off, blink char
#define LCD_DISP_ON_CURSOR 0x0E // Display on, cursor on
#define LCD_DISP_ON_CURSOR_BLINK 0x0F // Display on, cursor on, blink char
// Move cursor/shift display
#define LCD_MOVE_CURSOR_LEFT 0x10 // Move cursor left (decrement)
#define LCD_MOVE_CURSOR_RIGHT 0x14 // Move cursor right (increment)
#define LCD_MOVE_DISP_LEFT 0x18 // Shift display left
#define LCD_MOVE_DISP_RIGHT 0x1C // Shift display right
// Function set: set interface data length and number of display lines
#define LCD_FUNCTION_4BIT_1LINE 0x20 // 4-bit interface, single line, 5x7 dots
#define LCD_FUNCTION_4BIT_2LINES 0x28 // 4-bit interface, dual line, 5x7 dots
#define LCD_FUNCTION_8BIT_1LINE 0x30 // 8-bit interface, single line, 5x7 dots
#define LCD_FUNCTION_8BIT_2LINES 0x38 // 8-bit interface, dual line, 5x7 dots
#define LCD_CGRAM_BASE_ADDR 0x40 // Set the CGRAM address 0x40
#define LCD_DDRAM_BASE_ADDR 0x80 // Set the DDRAM address 0x80
// Address positions
#define LCD_LINE_1 0x80 // Position of start of line 1 0x80
#define LCD_LINE_2 0xC0 // Position of start of line 2 0xC0
//#define LCD_LINE_1 0x00
//#define LCD_LINE_2 0x40
///#define LCD_LINE_3 0x94 // Position of start of line 3
///#define LCD_LINE_4 0xD4 // Position of start of line 4
//#define LCD_DEGREE_CHAR 0x00 // Ascii 00
#define LCD_DEGREE_CHAR 2 // Ascii 00
#define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines |
Very important my display have the 5x8 dots not 5x7, i notice that doing some tests to fill GGRAM. Also on one command, i don't remember which is, the dots extended to 5x10 below the first line, i see that increasing the contrast to see what happen. I remember the command is below 0x0F. Maybe someone can know the correct datasheet for this.
Last edited by wangine on Fri Nov 20, 2015 11:14 am; edited 1 time in total |
|
|
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Sat Nov 14, 2015 10:44 am |
|
|
Just my hints. If you have so many then rip one apart and find what controller is used. From your Farnell link it is a "ST7066U" controller. Use google and find a pdf on that, I have used it some times and it use 5x8 or 5x11 dot matrix. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Nov 14, 2015 10:48 am |
|
|
this...
http://www.eleceltek.com/jsp/eedtl/
may be the company that made that display.
I'd contact them, send a good photo of both sides of the LCD module and ask for any information about it.
Jay |
|
|
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
|
Posted: Sat Nov 14, 2015 10:50 am |
|
|
hmmpic wrote: | Just my hints. If you have so many then rip one apart and find what controller is used. From your Farnell link it is a "ST7066U" controller. Use google and find a pdf on that, I have used it some times and it use 5x8 or 5x11 dot matrix. |
Not that is the problem, i if you look in the link with a photo, can't see the controller name, it's a presoldered chip without serial number or part number, nothing, is something like this
http://www.buydisplay.com/default/erm2402fs-1
just my is 2x20 not a 2x24.
Last edited by wangine on Sat Nov 14, 2015 11:01 am; edited 1 time in total |
|
|
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Sat Nov 14, 2015 10:56 am |
|
|
On your link there is a line little down:
"IC or Equivalent AIP31066 , HD44780, KS0066 , SPLC780 , ST7066" |
|
|
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
|
Posted: Sat Nov 14, 2015 11:08 am |
|
|
temtronic wrote: | this...
http://www.eleceltek.com/jsp/eedtl/
may be the company that made that display.
I'd contact them, send a good photo of both sides of the LCD module and ask for any information about it.
Jay |
Yeaa Jay i search long time ago here, i send email and no answers, also i search earlier 2 weeks ago thinking the time past and i became smarter.
I'm really frustrated now, right now i try to access each register to see if i can find what type is.
hmmpic wrote: | On your link there is a line little down:
"IC or Equivalent AIP31066 , HD44780, KS0066 , SPLC780 , ST7066" |
If you look in define adress, has for ST7066u but don't work, also HD44780 don't work, even they are compatible. The worst in electronics are poor documentation or more worst missing documentation. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Sat Nov 14, 2015 12:27 pm |
|
|
The odds are that the reason these were cheap, is that they are custom, possibly, with a custom CG ROM.
As you have already found, Elec & Eltek, are quite a well know manufacturer of LCD's:
<http://www.eleceltek.com/jsp/eedtl/>
However their display division was taken over by Display IC, in March this year.
<http://www.displaylc.com/?w=about_partners>
So it might be worth asking them.
B09, is nine dots per character (there may well be a tenth undriven row, this is quite common), Then the 2 is 2 rows.
However if these are custom, then they won't send you data, since this will proprietary to the company who ordered them.
I've had large batches of displays made by them, and they were actually quite helpful, but I was working through a distributor:
<http://www.lcd-module.com/contact/distribution.html> |
|
|
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
|
Posted: Sat Nov 14, 2015 12:58 pm |
|
|
Yup , 3 years ago one company who collaborate with my company as well after has divided, seall some stuff(new sigilated) and has a opportunity to buy some cool and like you say cheap stuff. Unfortunately this display was single without datasheet. One friend in that time give me the correct data but has lose in time or simply i don't remember the name to find in my all hdd. Now i think the single option remain to made a test function, to see and note what instruction is allowed and what she do. I already i made a function for all my custom chars but the last char put in CGRAM in the first 8 empty locations, keep follow me on random letters. If i write CGRAM with just 7 custom locations, the full dots follow me random. In that case what should I do ?
edit later:
Ttelmah wrote: | B09, is nine dots per character (there may well be a tenth undriven row, this is quite common), Then the 2 is 2 rows.
|
I just look carefully and they are just 5x8 and character is written on 7 dots. More and more confusion now in my head. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Sun Nov 15, 2015 3:38 am |
|
|
9th row should be the underline.
I've used a lot of 5*8 displays, and most behave just like 5*7. |
|
|
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
|
Posted: Sun Nov 15, 2015 12:17 pm |
|
|
I've got my problem, not the datasheet was corrupted, never has in my PC, but i have the original function for that LCD but i was unable to solve 3 years ago. The code was for NEC D780016YGF022 controller and other one for cortex_x3, i just see in include .h file, also the controller is on 8 bit and the define port is for 32 bit controller.
I research 3 days my old HDD and seems even now I'm not able to understand and to convert for CCS.
Take example for some function:
Code: | #define IO1DIR IODIR1
#define IO1SET IOSET1
#define IO1CLR IOCLR1
#define IO1PIN IOPIN1
#define LCD_E 0x80000000 /* Enable control pin */
#define LCD_RW 0x20000000 /* Read/Write control pin */
#define LCD_RS 0x10000000 /* Data/Instruction control */
#define LCD_CTRL 0xB0000000 /* Control lines mask */
#define LCD_DATA 0x0F000000 /* Data lines mask */
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static unsigned int lcd_rd_stat (void) {
/* Read status of LCD controller (ST7066u) */
unsigned int stat;
IO1DIR &= ~LCD_DATA;
IO1CLR = LCD_RS;
IO1SET = LCD_RW;
delay (10);
IO1SET = LCD_E;
delay (10);
stat = (IO1PIN >> 20) & 0xF0;
IO1CLR = LCD_E;
delay (10);
IO1SET = LCD_E;
delay (10);
stat |= (IO1PIN >> 24) & 0xF;
IO1CLR = LCD_E;
return (stat);
}
static void lcd_write_4bit (unsigned int c) {
/* Write a 4-bit command to LCD controller. */
IO1DIR |= LCD_DATA | LCD_CTRL;
IO1CLR = LCD_RW | LCD_DATA;
IO1SET = (c & 0xF) << 24;
IO1SET = LCD_E;
delay (10);
IO1CLR = LCD_E;
delay (10);
} |
This is original code, for direction control can simply delete, the compiler will take care itself on pin direction, but to define the data pins is difficult for me.
What i was thinking:
Code: | int8 stat = 0;
BYTE _stat ; /// IO1PIN ???
#bit stat_0 = _stat.0
#bit stat_1 = _stat.1
#bit stat_2 = _stat.2
#bit stat_3 = _stat.3
stat_0 = input(pin_c4);
stat_1 = input(pin_c5);
stat_2 = input(pin_c6);
stat_3 = input(pin_c7);
_stat = is already fill right ?
// then for what this ?
stat = (_stat >> 20) & 0xF0; // 1
stat |= (_stat >> 24) & 0xF; // 2
// stat is not overwrite ? is no sense , should be inverse
return(stat); |
The rest of functions are very simple, just one line, if i can start this i will move step by step. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Mon Nov 16, 2015 2:43 am |
|
|
Comments inline.
Code: |
static unsigned int lcd_rd_stat (void) {
/* Read status of LCD controller (ST7066u) */
unsigned int stat;
IO1DIR &= ~LCD_DATA; //set the TRIS equivalent register for 'read'
//on the four data bits.
IO1CLR = LCD_RS; //turn the RS pin 'off'
IO1SET = LCD_RW; //turn the RW pin 'on'
delay (10); //presumably delay_cycles or uSec
IO1SET = LCD_E; //turn E pin 'on'
delay (10); //delay again
stat = (IO1PIN >> 20) & 0xF0; //read the four bits and put these
//in the high nibble of 'stat' - bits are 24 bits 'up' the register
IO1CLR = LCD_E; //turn E pin 'off'
delay (10); //and delay again
IO1SET = LCD_E; //set the E pin 'on'
delay (10); //and delay
stat |= (IO1PIN >> 24) & 0xF; //now read the four bits and put these
//into the low nibble of stat.
IO1CLR = LCD_E; //Clear the E pin
return (stat); //and return the value read
}
|
The 'CLR' and 'SET' operations are like bit_set, and bit_clear.
You need to be doing the same double enable, but then you only need to rotate your bits left by four, and or these with the second set of bits. Not rotate right by 20/24, which is done to bring the values down from high up the 32bit I/O register..... |
|
|
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
|
Posted: Mon Nov 16, 2015 1:25 pm |
|
|
Ttelmah wrote: |
The 'CLR' and 'SET' operations are like bit_set, and bit_clear.
|
Thanks _Ttelmah, i know what those intructions does, my problem was to define PIN_x individualy to read in that function, not to declare entire port and to shift data according with port dimension or a bus type 4/8. But don't matter anyway, i found the problem. Not my display's was a fault or unknown, the printf() function of CCS is the problem. Example:
on CCS version below 5.000 the printf() work like that
Code: |
printf(lcd_putc " haha ");
|
after 5.008 work like that
Code: |
printf(lcd_putc, " haha ");
or
printf(lcd_putc,"some data %3.4f ", x );
|
Thats create a big confusion if cannot know how to read CCS errors. Anyway after i became frustrated and without any start to solve my issue, i say OK i'm stupid and i reload my old staff on Motorola devices. I reload old project based on a 16x2 display and i get a big surprise, my display shows all characters including ~!@#$%^&*(){}></
My display has a simply ST7066-0A than suport english/japan character.
I think printf() of CCS don't have support on those characters, like on "!" instead is 0x21, printf() don't keep a index and put this on actual data and the buffer will overflow on sum of adress, really i don't know. I'm really mad. It is possible the flex_LCD driver maded by PCM_p to give that issue or is printf() problem? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 16, 2015 2:04 pm |
|
|
Quote: | on CCS version below 5.000 the printf() work like that
Code:
printf(lcd_putc " haha ");
|
That just isn't true. CCS has always required a comma after the
re-direction function in printf().
Here is the June 2012 CCS manual. This is for version 4 of the compiler.
It shows a comma after the function name:
Quote: | printf( ) fprintf( )
Syntax:
printf (string)
or
printf (cstring, values...)
or
printf (fname, cstring, values...)
fprintf (stream, cstring, values...) |
I have noticed that vs. 4.141 does not give a syntax error when compiling
if the comma is missing. But you should still put in the comma. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 16, 2015 2:19 pm |
|
|
wangine wrote: |
I think printf() of CCS don't have support on those characters, like on "!" instead is 0x21, printf() don't keep a index and put this on actual data and the buffer will overflow on sum of adress, really i don't know. I'm really mad. It is possible the flex_LCD driver maded by PCM_p to give that issue or is printf() problem?
|
The following test program was compiled with vs. 4.141 and it worked fine
on a PicDem2 Plus board (old style board). I removed the "%" character
because that's part of printf. It requires a special escape sequence to
display it, so that's why I didn't include it in this test. But my LCD shows
these 15 characters on the top row:
I also compiled and tested the program below with vs. 5.051.
It also works perfectly with that version.
Code: |
#include <16F887.h>
#fuses INTRC_IO, NOWDT
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS)
#include "flex_lcd.c"
//=====================================
void main()
{
lcd_init();
printf(lcd_putc, "~!@#$^&*(){}></");
while(TRUE);
} |
Here is a photo of the lcd with those characters on it.
Also, one more thing. Don't use any early versions of compiler vs. 5.
They are all junk. Do not use 5.008, or 5.013, or 5.014. You have
to use a recent version. |
|
|
wangine
Joined: 07 Jul 2009 Posts: 98 Location: Curtea de Arges, Romania
|
|
Posted: Mon Nov 16, 2015 8:08 pm |
|
|
yea i know, the % don't show, also on other type of display no problems at all, all show correctly. I just give up. I don't want to return on other compiler, i love CCS but unfortunately I'm designer engineer not a programmer, PIC its a hobby, nothing else and i can't spend too much time to read manual. This forum is awesome and enough for me. Still on CCS i avoid to use pointers on some versions are annoying. Thanks for advices. Can be considered solved. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|