8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Go to page  1 2 [3] 4 5
Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
shyam
Sun Jan 06 2008, 10:33AM

 User Offline

Registered Member #2984
Joined: Mon Aug 06 2007, 11:33AM

Posts: 665
Thanked 93 times in 89 posts
@mhel
but the original author uses 128x128 lcd, mine is 240x128


well if u talking abt the following function u r right
CODE:

static uint32_t current_addr_pointer (void)
/**************************************************************/
{
  return 1024 * selected_page + yStart*Nmax + xStart/8;
}
 


ok see...
using 5x8 pixel... =>
8 pixel y direction

128 *8 = 1024

=>one page = 1024

now if i want to select page 2 coordinates 30,40
so the function will return 1024 *2 + 30*5 + 40*8

i guess that is what the function is doing...

bottom line...
wether it be 240x128 or 128x128...
for complete page scan we need to scan 128
so doesnt matter..
it wud be 1024 in both the cases...
not tested on board just a logical suggestion



lProgress is not made by early risers or hard workers, but by LAZY people, trying to find easier ways to do the same........
Back to top


mhel
Sun Jan 06 2008, 11:53AM
 User Offline
Registered Member #5217
Joined: Sat Dec 22 2007, 03:02PM

Posts: 36
Thanked 9 times in 9 posts
shyam:
I'll try to clean it first then I'll upload it.

thanks.
Back to top


mhel
Sun Jan 06 2008, 02:20PM
 User Offline
Registered Member #5217
Joined: Sat Dec 22 2007, 03:02PM

Posts: 36
Thanked 9 times in 9 posts
Hi Shyam,

this is the simple setup I have, to test the lcd.
pinouts are in the config.h. this is taken from WinArm samples, I use CodeBlocks as
as my editor, I like it, not keil but better than programmer's notepad.



winarm_lcdt.zip
Back to top


mhel
Wed Jan 09 2008, 03:11AM
 User Offline
Registered Member #5217
Joined: Sat Dec 22 2007, 03:02PM

Posts: 36
Thanked 9 times in 9 posts
bottom line...
wether it be 240x128 or 128x128...
for complete page scan we need to scan 128
so doesnt matter..
it wud be 1024 in both the cases...
not tested on board just a logical suggestion


I have verified the above to be correct, I have changed it to 3840, and changed it back to 1024 and the behaviour is the same. I assumed, since I was using 240x128 and fontwidth of 8 that I needed 3840 bytes according to a document I read. Although I think my math skills is skewed I have 30columns by 16rows, does this mean I only need 480bytes of ram per page? or this calculation only applicable to Text mode?

BTW, I attempted to to draw bitmaps, but it only draws part of the image, please tell me what I missed thanks. The structure for IMG is defined with height, width, and the actual data.
CODE:
uint8_t draw_img(uint8_t x1, uint8_t y1, IMG * img)
{
  uint8_t x, y;
  uint8_t *iptr=img->data;
//  set_display(F5x8, NORMAL);
  gotoxy(x1,y1);
  x = x1;
  y = y1;
  while (y < y1+img->height)
    {
      while (x < x1+img->width/8)
        {
          framebuffer[current_addr_pointer()]=*iptr;
          iptr++;
          x+=1;
        }
      x=x1;
      y+=1;
      if (Nmax != img->width/8)//Nmax = 30
        {
          gotoxy(x,y);
        }

    }
  refresh_LCD(0);
  return x1 + img->width + 1;
}


Shyam: I appreciate your time on doing the scroll thing, I'll wait for it 'cause I doubt I'd be able to hack it. Thanks.
Back to top


mhel
Wed Jan 16 2008, 10:23AM
 User Offline
Registered Member #5217
Joined: Sat Dec 22 2007, 03:02PM

Posts: 36
Thanked 9 times in 9 posts
I got the image drawing working, I can't believe it's this simple I had to hit my head a couple of times
CODE:
uint8_t draw_img(uint8_t x1, uint8_t y1, IMG * img)
{
  gotoxy(x1,y1);
  wrbm(img->width, img->height, img->data);
  refresh_LCD(0);
  return xStart + 1;//returns next x position
}


I guess if you look at the code for a long time it will just pop up
Back to top


shyam
Wed Jan 16 2008, 11:33AM

 User Offline

Registered Member #2984
Joined: Mon Aug 06 2007, 11:33AM

Posts: 665
Thanked 93 times in 89 posts
congratulations.. mhel!!!!...
enjoy your work!!



lProgress is not made by early risers or hard workers, but by LAZY people, trying to find easier ways to do the same........
Back to top


mhel
Thu Jan 17 2008, 01:11PM
 User Offline
Registered Member #5217
Joined: Sat Dec 22 2007, 03:02PM

Posts: 36
Thanked 9 times in 9 posts
thnx shyam,

one question, in the lcd code, what do you think would be the posible uses of the function copy_page(), right now I have it commented out since i limit my framebuffer pages to just 1.
Back to top


mhel
Mon Feb 04 2008, 08:45AM
 User Offline
Registered Member #5217
Joined: Sat Dec 22 2007, 03:02PM

Posts: 36
Thanked 9 times in 9 posts
I managed to add blinking cursor to lcd driver:
CODE:
static void set_cursor(uint8_t row, uint8_t col, uint8_t cursor)
{
  uint16_t addr;
  addr =  GHOME + (row/8)  + (col*30);
  lcd_setaddr(0x24, addr);
  if (cursor)
    lcd_sendcmd(0xf8 | ((7-row%8)));
  else
    lcd_sendcmd(0xf0 | ((7-row%8)));
}

void set_curpos(void)
{
  uint8_t i, c;
  c = yStart+8;
  cursortoggle ^= 1;
  for (i=0; i<8;i++){
//    set_cursor(xStart, yStart+i, cursortoggle); /* set vertical cursor position */
set_cursor(xStart+i, c , cursortoggle); /* set horizontal cursor position */
  }
}


the code above is independent of the framebuffer, It is called after the lcd is refreshed. Actually, it is called from a timer interrupt every 500ms,
I place a flag in refresh_LCD() and is checked in the interrupt if the cursor is to be displayed. xStart and yStart is global and primarily used in the framebuffer. I can't remember why I had the cursortoggle global too tho. the code is basically turning on/off 8pixels following the xStart & yStart.
Back to top


Ajay
Mon Feb 04 2008, 09:39AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3375
Thanked 616 times in 583 posts
great going mhel (whats your real name )
adding blinking cursor to LCD will keep controller busy, is it? coz gfx LCD has to be updated after every half sec or something.. what you say?

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top


shyam
Mon Feb 04 2008, 11:33AM

 User Offline

Registered Member #2984
Joined: Mon Aug 06 2007, 11:33AM

Posts: 665
Thanked 93 times in 89 posts
he is a wise guy..
using interrupts..
there are lots of interrupt sources in arm that you can use mostly IRQ not much burden on the controller...!! ARM is supposed to handle this business @ low power

lProgress is not made by early risers or hard workers, but by LAZY people, trying to find easier ways to do the same........
Back to top


Go to page  1 2 [3] 4 5  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems