LCDInfo.com

http://www.lcdinfo.com
It is currently Fri Nov 22, 2024 3:19

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed May 26, 2004 18:32 
Offline

Joined: Wed May 26, 2004 18:21
Posts: 2
I'm using a T6963C controller with an ATmega8 from Atmel.

I've successfully displayed an image and I can set/reset any pixel in the screen. Now I'm searching the best way to print an image in any location on the screen, NOT in a byte-boundary address ... Well my first idea is to begin each line using pixel manipulation and then finish with bytes (exept the last byte).

Has someone a little algorithm, or a better idea ? What is the fastest way to print an image ?

Moreover, I've found a command : DATA AUTO --> can it be useful for me ?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 12:32 
Offline

Joined: Fri May 21, 2004 15:27
Posts: 4
Hi!

You can use the automode to write a data block in the VRAM. The advantage is that the address pointer will increment automatically.

This is an code example in C for the 80C535 to to transfer a array of data from the uC rom to the VRAM. I hope that this will help you. You should also see the datasheet from the T6963C which is proffer on this page.

Code:

   //P5 is connected to the display
   //Set address pointer
   statuscheck();
   P5 = 0x00;
   writedatum();

   statuscheck();
   P5 = 0x14;
   writedatum();

   statuscheck();
   P5 = 0x24;
   writecommand();
   
   //Auto inc on
   statuscheck();
   P5 = 0xb0;
   writecommand();

   for(i=0;i<10;i++)
   {
      statuscheck_Automode();
      P5 = Daten[i];
      writedatum();
   }
   

    //Auto inc off
   statuscheck();
   P5 = 0xb2;
   writecommand();
       
   //Set Text on, Graphics off, Cursor off
   statuscheck();
   P5 = 0x94;
   writecommand();
   
   while(1);


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 27, 2004 15:28 
Offline

Joined: Wed May 26, 2004 18:21
Posts: 2
ok thanks. I will do that because my code is too slow.
Here is my code, it can diplay an image in ANY position in pixel, not only byte boundary positions :



Code:
void LCD_DrawPic( const char __flash * pic, u8 w, u8 h, u8 x, u8 y )
{
   u8 i, j, k, debut, fin=0, val, flag, padding=0, temp=0, offset, decal;

   if( x%8 != 0 )   // pas aligné sur une adresse multiple de 8, on va afficher le début pixel par pixel
   {
      debut = x/8+1;
      debut = debut * 8; // debut est aligné sur un multiple de 8
      flag=1;
      offset = debut-8;
   }
   else
   {
      flag = 0;
      offset = x;
      debut = x;
   }


   if( w%8 != 0 )   // y'a un padding (bourrage à la fin de chaque ligne)
   {
      fin = w/8+1;
      padding = fin*8 - w;      
   }
   
   // On commence par afficher en haut à gauche, ligne par ligne
   for( i=0; i<h; i++ )
   {
      j=0;
      
      // premiers pixels
      if( flag==1 )
      {
         val = pic[ (h-1-i)*fin + j ]; // le BMP est stocké à l'envers
         for( k=7; k>=(8-(debut-x)); k-- )
         {
            if( (val&(1<<k)) != 0 )
               LCD_SetPixel( x+j*8+(7-k), y+i);
         }
         
         temp = val;
         j=1;
      }
      
      for( ; j<fin-1; j++ )
      {
         val = pic[ (h-1-i)*fin + j ];   // le BMP est stocké à l'envers
         
         if( flag == 1 )
         {
            temp = temp << (debut-x);
            temp = temp | (val >> (8-(debut-x)));
         }
         else
         {
            temp = val;
         }

         LCD_SetGraphXY( offset+j*8, y+i );
         LCD_Write_1_Data( temp, 0xC0 );

         temp = val;
      }
      
      // dernier octet de la ligne
      val = pic[ (h-1-i)*fin + j ];   // le BMP est stocké à l'envers
      decal = 0;
      
      if( flag == 1 )
      {
         // On affiche le reste de l'octet précédent
         for( k=0; k<(8-(debut-x)); k++ )
         {
            if( (temp&(1<<k)) != 0 )
               LCD_SetPixel( offset+j*8+((8-(debut-x))-k-1), y+i);
         }
         
         decal = (8-(debut-x));
      }
      
      // on affiche juste les pixels nécessaires, sans le bourrage
      for( k=7; k>=padding; k-- )
      {
         if( (val&(1<<k)) != 0 )
            LCD_SetPixel( offset+decal+j*8+(7-k), y+i);
      }
      
      
   

   }
}


Sorry for the non-english comments. Warning, the code is NOT optimized ;-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 56 guests


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

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group