Отговори на тема  [ 5 мнения ] 
Проблем с графичeн LCD AG-12232A (Ampire) 
Автор Съобщение
Ранг: Ориентиран
Ранг: Ориентиран

Регистриран на: Вто Фев 06, 2007 2:45 am
Мнения: 263
Мнение Проблем с графичeн LCD AG-12232A (Ampire)
Здравейте,
Единственото, което не успях да направя с този дисплей, е да му задам коректнo страница, в която да рисува. Дисплея е вързан правилно към един PIC18, контролен порт, дата порт - всичко е ток и жица, таймингите са х3 спрямо минималните, които се препоръчват в даташийта, клок подавам от PWM1 и е с честота около (не помня точно) 8,712 kHz. Write командите се приемат и изпълняват без проблем. Правих опити с бутон циклично да въртя страниците, но резултата беше писане само в горната половина на дисплея (COM0 - COM16). Честно казано, нямам си идея защо се получава така.

Слушам всякакви идеи за решаването на проблема.
Предварително благодаря :)

П.П. Само ще добавя, че драйвера на модула е SBN1661, аналог на SED1520.


Пет Сеп 14, 2007 12:40 pm
Профил
Ранг: Професионалист
Ранг: Професионалист
Аватар

Регистриран на: Сря Окт 13, 2004 11:24 pm
Мнения: 500
Местоположение: Стара Загора
Мнение 
Имах подобни пробеми на твоите със AG12864, пишеше само в първата страница каквото му падне, първоначално бях взел драйвера за управлението на готово и нормално се усъмних във верността на кода му, пробвах разни неща по метода проба грешка и нещата тръгнаха стабилно със следните read write функции:
Код:
#define     tris_d_in_val     0b11111111
#define     tris_d_out_val    0b00000000
#byte       PORTA    = 0xf80
#byte       PORTB    = 0xf81
#byte       PORTC    = 0xf82
#byte       PORTD    = 0xf83
#byte       PORTE    = 0xf84
#define     LCD_data_port     PORTD

#bit        GLCD_DI        = PORTB.4   // Data or Instruction input
#bit        GLCD_RW        = PORTB.3   // Read/Write
#bit        GLCD_E         = PORTB.2   // Enable
#bit        GLCD_CS1       = PORTB.7   // Chip Selection 1
#bit        GLCD_CS2       = PORTB.6   // Chip Selection 2
#bit        GLCD_RST       = PORTB.5   // Reset


BYTE glcd_readByte(BYTE chip , BYTE mode)
{
   BYTE data;                 
   GLCD_DI = mode;
   if(chip == chip_1)       
      GLCD_CS1 = 1;
   else
      GLCD_CS2 = 1;
   set_tris_d(tris_d_in_val);   
   GLCD_RW = 1;                   
   GLCD_E = 1;
   delay_us(10);
   GLCD_E = 0;                   
   delay_us(2);
   GLCD_E = 1;
   delay_us(5);
   data = LCD_data_port;           
   GLCD_E = 0;
   GLCD_CS1 = 0;                   
   GLCD_CS2 = 0;
   return data;                   
}

void glcd_writeByte(char chip, BYTE data, BYTE mode)
{
   while( (glcd_readByte( chip , instr) & 0b10000000) == 0b10000000 );

   GLCD_DI = mode;
   if(chip == chip_1)       
      GLCD_CS1 = 1;
   else
      GLCD_CS2 = 1;
   GLCD_RW=0;       
   set_tris_d(tris_d_out_val);
   LCD_data_port = data;           
   GLCD_E=1;       
   delay_us(2);
   GLCD_E=0;       
   GLCD_CS1=0;     
   GLCD_CS2=0;
}


има малка разлика във таймигна на управляващите сигнали спрямо PDF-a на LCD-то, не знам защо се получи така но при мен само така работи


Пет Сеп 14, 2007 8:54 pm
Профил YIM
Ранг: Ориентиран
Ранг: Ориентиран

Регистриран на: Вто Фев 06, 2007 2:45 am
Мнения: 263
Мнение 
За съжаление тоя код не ми върши никаква работа, щото е за KS0108.
Все пак благодаря за отделеното време. :)


Пет Сеп 14, 2007 9:36 pm
Профил
Ранг: Ориентиран
Ранг: Ориентиран

Регистриран на: Вто Яну 31, 2006 11:11 pm
Мнения: 295
Местоположение: София
Мнение 
и аз се мъчих с един дисплей дето пишеше 12232 на него но се оказа 100 х 32 (даже и в дефиницията седи 100 х 32). Ето с този код за драйвер за CSS
Даже не помня откъде го взех този драйвер


Код:
//****************************************************************
// TITLE:   SED1520LCD.C
// DATE:    04 DEC 05
// BY:      JV
// DESCRIPTION: SED1520 code for CCS graphics
//              driver
//----------------------------------------------------------------
// Revision:    V1.0 (first release)
//****************************************************************

// PICCore Pin definitions----------//
#define LCD_CS1     PIN_C2          // Enable Left Side of LCD
#define LCD_CS2     PIN_C3          // Enable Right Side of LCD
#define LCD_RW      PIN_C1          // Read/Write
#define LCD_A0      PIN_C0          // Control or Data
#define D0          PIN_D0          // Databus 0
#define D1          PIN_D1          // Databus 1
#define D2          PIN_D2          // Databus 2
#define D3          PIN_D3          // Databus 3
#define D4          PIN_D4          // Databus 4
#define D5          PIN_D5          // Databus 5
#define D6          PIN_D6          // Databus 6
#define D7          PIN_D7          // Databus 7

// Tell CCS Graphics.c how big the display is
#define GLCD_WIDTH   100            // Number of Horizontal pixels
#define GLCD_HEIGHT   32            // Number of Vertical Pixels

#define LEFT    1
#define RIGHT   0

// Global Variables for this application (LCD)
int   SIDE;                         // Left or Right side of LCD

// Function Prototype for CCS Graphics.c driver
void glcd_pixel(int8, int8, int1);  // Required for CCS GRAPHICS.C


//===============================================================
// command_write (Cdata)
// Write command data to the LCD
// See SED1520 datasheet for more info
//===============================================================
void LCDCWrite(int8 CData)           // Write Instruction to LCD
  {
   if (SIDE==LEFT)
    {
     OUTPUT_LOW(LCD_A0);            // Instruction (not display data)
     OUTPUT_LOW(LCD_RW);         // We are going to WRITE Data
     OUTPUT_LOW(LCD_CS1);         // CS Low on the LEFT side of the display
     delay_cycles(10);

     OUTPUT_HIGH(LCD_CS1);          // CS High (starts cycle)
     OUTPUT_D(CData);             // Put the data on the bus
     delay_cycles(2);               

     OUTPUT_LOW(LCD_CS1);         // Latch the data into the LCD
     delay_cycles(2);               
    }
else // The RIGHT hand side
    {
     OUTPUT_LOW(LCD_A0);            // Instruction (not display data)
     OUTPUT_LOW(LCD_RW);         // We are going to WRITE Data
     OUTPUT_LOW(LCD_CS2);         // CS Low on the RIGHT side of the display
     delay_cycles(10);

     OUTPUT_HIGH(LCD_CS2);         // CS High (starts cycle)
    OUTPUT_D(CData);             // Put the data on the bus
     delay_cycles(2);

     OUTPUT_LOW(LCD_CS2);         // Latch the data into the LCD
     delay_cycles(2); 
    }
}


//===============================================================
// Data write (DData)
// Writes display data to the LCD
//===============================================================
void LCDWrite(int8 DData)               // Write Data to LCD
  {
   OUTPUT_HIGH(LCD_A0);                 // Data (not instruction)
   OUTPUT_LOW(LCD_RW);                // We are going to WRITE Data
   if(SIDE==LEFT)OUTPUT_LOW(LCD_CS1);   // If Left side then use CS1
   if(SIDE==RIGHT)OUTPUT_LOW(LCD_CS2);  // If Right side then use CS2
   delay_cycles(2);

   if(SIDE==LEFT) OUTPUT_HIGH(LCD_CS1);
   if(SIDE==RIGHT) OUTPUT_HIGH(LCD_CS2);
   OUTPUT_D(DData);                   // Put the data onto the bus
   delay_cycles(10);

   if(SIDE==LEFT) OUTPUT_LOW(LCD_CS1);  // and latch the data into
   if(SIDE==RIGHT) OUTPUT_LOW(LCD_CS2); // the LCD display
   delay_cycles(2);
  }


//===============================================================
// Display data read
// Reads the display data pointed to by the page, column and
// chip select. Returns the data.
//===============================================================
int8 LCDRead()                          // Read Data from LCD
  {
   int8 DData;

   if(SIDE==LEFT) OUTPUT_HIGH(LCD_CS1); 
   if(SIDE==RIGHT) OUTPUT_HIGH(LCD_CS2);   

   OUTPUT_HIGH(LCD_A0);                 // Data
   OUTPUT_HIGH(LCD_RW);                // Read Data
   if(SIDE==LEFT)OUTPUT_LOW(LCD_CS1);
   if(SIDE==RIGHT)OUTPUT_LOW(LCD_CS2);
   delay_cycles(2);

   set_tris_d(0xff);   // Allow LCD to drive the data lines

   if(SIDE==LEFT) OUTPUT_HIGH(LCD_CS1);
   if(SIDE==RIGHT) OUTPUT_HIGH(LCD_CS2);

   delay_cycles(50);
   DData=INPUT_D();                   // Get the data
   if(SIDE==LEFT) OUTPUT_LOW(LCD_CS1);
   if(SIDE==RIGHT) OUTPUT_LOW(LCD_CS2);
   delay_cycles(2);

return(DData);
}

//===============================================================
// Draw a single pixel
// This is required by the Graphics.c driver file provided by
// CCS. It tells the driver how to draw a single pixel anywhere
// on the LCD display
// x=1 to 122      y=1 to 32     color=1=ON    color=0=OFF
//===============================================================
void glcd_pixel(int8 x, int8 y, int1 color)   
{
int8 ucMask;
int8 i;
int8 Data;
x-=1;                                 
// Which side of the display (which SED1520 controller)
if (x<(GLCD_WIDTH/2)) SIDE = LEFT;
else SIDE = RIGHT;

// Which vertical page needs selecting
Data=184+((y-1)/8);                     // Control data to write is
LCDCWrite(Data);                        // 184 + the page number (0-3)
if (y>8)y-=((Data-184)*8);              // y should always be 1-8

// Horizontal position (column)
if (x>=(GLCD_WIDTH/2))                                // x should always be 0-61
   x-=(GLCD_WIDTH/2);                               // for each half of the LCD

LCDCWrite(x);                           // Go to column 'x'

LCDCWrite(0xe0);                       // Start R-M-Write operation
  LCDRead();                          // Dummy Read
  Data = LCDRead();                      // Read LCD dissplay data

  ucMask = 1;                           // Create a bit mask of the
  for (i=1;i<y;i++)                      // pixel to change
       ucMask<<=1;                      //

  if (color) Data|=ucMask;              // Set or clear the pixel as                       
  else Data&=~ucMask;                   // requested
  LCDWrite(Data);
LCDCWrite(0xee);                      // End R-M-Write operation
}

//===================================================================
// Initialise the SED11520 controllers
// for the display type we are using
//===================================================================
void InitSED1520()
{
int8 i;

// Setup both SED1520 ccontrollers
for (i=0;i<2;i++)
    {
    SIDE=i;
   LCDCWrite(0xaf);        // Turn on the display
   LCDCWrite(0xa4);        // Static drive is off
   LCDCWrite(0xa9);        // Duty cycle is set to 1/32
   LCDCWrite(0xe2);        // Reset the chip
   LCDCWrite(0xa0);        // Set ADC
   LCDCWrite(0xee);        // Read modify write disabled
   LCDCWrite(0xc0);        // Set the start position to
   LCDCWrite(0xb8);         // the top left of the display
   LCDCWrite(0x00);        // in column 0
   }
    OUTPUT_LOW(LCD_CS1);    // De-select each side to start
    OUTPUT_LOW(LCD_CS2);    //
    delay_ms(60);
}

void ClearScreen(){
int8 i,j,k;
for(k=0;k<2;k++){         // Clear both controlers data
  SIDE=k;
  for(j=0;j<4;j++){        // Now go through all pages and clear the LCD RAM
   LCDCWrite(184+j);      // so that the display is cleared   
   LCDCWrite(0);
   for(i=0;i<=(GLCD_WIDTH/2);i++) LCDWrite(0x00);
  }
}
}


Съб Сеп 15, 2007 9:53 pm
Профил
Ранг: Ориентиран
Ранг: Ориентиран

Регистриран на: Вто Фев 06, 2007 2:45 am
Мнения: 263
Мнение 
Проблема се оказа овчарски - една миниатюрна пръска тинол окъсявала две писти от дата шината...едвам се виждаше с просто око :evil:
Иначе дисплея е бомба - бачка си както пише в PDF-а:) (засега)
Още веднъж благодаря на отзовалите се :drinkers:


Пон Сеп 17, 2007 11:02 pm
Профил
Покажи мненията от миналия:  Сортирай по  
Отговори на тема   [ 5 мнения ] 

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 4 госта


Вие не можете да пускате нови теми
Вие не можете да отговаряте на теми
Вие не можете да променяте собственото си мнение
Вие не можете да изтривате собствените си мнения
Вие не можете да прикачвате файл

Търсене:
Иди на:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Хостинг и Домейни