Discussion in "ARM Development" started by    mhel    Dec 23, 2007.
Mon Jan 07 2008, 12:03 am
#21
@mhel

but the original author uses 128x128 lcd, mine is 240x128



well if u talking abt the following function u r right
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
Mon Jan 07 2008, 01:23 am
#22
shyam:
I'll try to clean it first then I'll upload it.

thanks.
Mon Jan 07 2008, 03:50 am
#23
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.



Wed Jan 09 2008, 04:41 pm
#24
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.
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.
Wed Jan 16 2008, 11:53 pm
#25
I got the image drawing working, I can't believe it's this simple I had to hit my head a couple of times :blush
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
Thu Jan 17 2008, 01:03 am
#26
congratulations.. mhel!!!!...
enjoy your work!!
!dance !dance !dance
Fri Jan 18 2008, 02:41 am
#27
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.
Mon Feb 04 2008, 10:15 pm
#28
I managed to add blinking cursor to lcd driver:
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.
Mon Feb 04 2008, 11:09 pm
#29
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?
Tue Feb 05 2008, 01:03 am
#30
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

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Robertrip
Fri Apr 26 2024, 11:20 am
ArnoldDiant
Fri Apr 26 2024, 03:53 am
RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm
SamuelSmise
Thu Apr 25 2024, 09:56 am
DustinErele
Thu Apr 25 2024, 08:44 am
ztaletpzca
Wed Apr 24 2024, 11:19 pm
IrardlPex
Wed Apr 24 2024, 08:42 pm