Pages: 1 [2] 3 4 ... 7   Go Down
Author Topic: LCD shield and/or LCD serial backpack  (Read 31803 times)
0 Members and 1 Guest are viewing this topic.
New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i use these monochrome nokia displays (monochrome, 84px x 48px). i have the code working and really would like to work on a library if someone would be willing to assist.
Ooo, yes. :-) I have an LCD wired up here but haven't tested it because I got distracted by the whole network thing... smiley-grin

Here are my Arduino and Nokia LCD notes probably not much use currently but thought I'd throw them on the pile.

--Phil.
Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 295
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a basic code to display text, lines and dots. Original c code came from Massimo. I already posted it to the forum, but thing get easily lost here. i know it should be up on the playground. but me too got distracted from it by other projects. The circuit i use never got updated, like i planned, using a proper 3,3v regulator for the display. i'm doing other stuff lately with arduino running on 3.3v so i might get back to it.

here the lazy circuit http://flickr.com/photos/12058013@N07/2203300707/ using 4 diodes to reduce voltage to appr. 3.2v and voltage dividers for communication.
here's a basic version of the code [again here, and not on the playground, so maybe we could clean it up build a library from it together]:
Code:
//  arduino pinout for LCD.
int CONTROL_LED=12;
int LCD_POWER_PIN      =       11;
int LCD_DC_PIN         =        2; //  PB0  4  Data Command
int LCD_CE_PIN         =        3; //  PB2  5  /CS   active low chip select ??
int SPI_MOSI_PIN       =        4; //  PB3  3  Serial   line
int LCD_RST_PIN        =        5; //  PB4  8   /RES RESET
int SPI_CLK_PIN        =        6; //  PB5  2  CLOCK


#define LCD_X_RES                  84
#define LCD_Y_RES                  48



#define LCD_CACHE_SIZE             ((LCD_X_RES * LCD_Y_RES) / 8)

/*--------------------------------------------------------------------------------------------------
 Type definitions
 --------------------------------------------------------------------------------------------------*/



#define    LCD_CMD  0
#define    LCD_DATA  1

#define    PIXEL_OFF   0
#define    PIXEL_ON    1
#define    PIXEL_XOR   2

#define    FONT_1X  1
#define    FONT_2X  2


typedef unsigned int               word;

// Public function prototypes

void LcdInit       ( void );
void LcdClear      ( void );
void LcdUpdate     ( void );
void LcdGotoXY     ( byte x, byte y );
void LcdChr        ( int size, byte ch );
void LcdStr        ( int size, char *dataPtr );
void LcdPixel      ( byte x, byte y, int mode );
void LcdLine       ( byte x1, byte y1, byte x2, byte y2, int mode );
void LcdSendCmd ( byte data, int cd );


// This table defines the standard ASCII characters in a 5x7 dot format.


// Global Variables

byte  LcdCache [ LCD_CACHE_SIZE ];

int   LcdCacheIdx;
int   LoWaterMark;

int   HiWaterMark;
boolean  UpdateLcd;
 char sign;

// This table defines the standard ASCII characters in a 5x7 dot format.
static const byte FontLookup [][5] =
{
  {
    0x7E, 0x11, 0x11, 0x11, 0x7E     }
  ,   // A
  {
    0x7F, 0x49, 0x49, 0x49, 0x36     }
  ,   // B
  {
    0x3E, 0x41, 0x41, 0x41, 0x22     }
  ,   // C
  {
    0x7F, 0x41, 0x41, 0x22, 0x1C     }
  ,   // D
  {
    0x7F, 0x49, 0x49, 0x49, 0x41     }
  ,   // E
  {
    0x7F, 0x09, 0x09, 0x09, 0x01     }
  ,   // F
  {
    0x3E, 0x41, 0x49, 0x49, 0x7A     }
  ,   // G
  {
    0x7F, 0x08, 0x08, 0x08, 0x7F     }
  ,   // H
  {
    0x00, 0x41, 0x7F, 0x41, 0x00     }
  ,   // I
  {
    0x20, 0x40, 0x41, 0x3F, 0x01     }
  ,   // J
  {
    0x7F, 0x08, 0x14, 0x22, 0x41     }
  ,   // K
  {
    0x7F, 0x40, 0x40, 0x40, 0x40     }
  ,   // L
  {
    0x7F, 0x02, 0x0C, 0x02, 0x7F     }
  ,   // M
  {
    0x7F, 0x04, 0x08, 0x10, 0x7F     }
  ,   // N
  {
    0x3E, 0x41, 0x41, 0x41, 0x3E     }
     // O

  ,   // Y
  {
    0x61, 0x51, 0x49, 0x45, 0x43     }
    //Z
};
/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdSendCmd
 
 Description  :  Sends data to display controller.
 
 Argument(s)  :  data -> Data to be sent
 cd   -> Command or data (see/use enum)
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdSendCmd ( byte data, int cd )
{


  byte i = 8;

  byte mask;



  //

  if ( cd == LCD_DATA )
  {
    digitalWrite(LCD_DC_PIN,HIGH);
  }
  else
  {
    digitalWrite(LCD_DC_PIN,LOW) ;
  }




  while(0 < i) {

    mask = 0x01 << --i; // get bitmask and move to least significant bit
    // cause edge to fall
    digitalWrite(SPI_CLK_PIN,LOW); // tick
    delayMicroseconds(400);
    // set out byte
    if(data & mask){ // choose bit

      digitalWrite(SPI_MOSI_PIN,HIGH); // send 1

    }
    else{

      digitalWrite(SPI_MOSI_PIN,LOW); // send 0

    }

    // cause edge to rise

    digitalWrite(SPI_CLK_PIN,HIGH); // tock
    delayMicroseconds(400);





  }


}

//end of part 1
Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 295
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

part 2 of the sketch
Code:


/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdInit
 
 Description  :  Performs MCU SPI & LCD controller initialization.
 
 Argument(s)  :  None.
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdInit ( void )
{

  int m;


  //  Toggle display reset pin.
  digitalWrite(LCD_RST_PIN,LOW);
  delay(40);
  digitalWrite(LCD_RST_PIN,HIGH);

  //  Enable SPI port: No interrupt, MSBit first, Master mode, CPOL->0, CPHA->0, Clk/4
  // SPCR = 0x50;



  LcdSendCmd( 0x21, LCD_CMD );  // LCD Extended Commands.
  LcdSendCmd( 0xB3, LCD_CMD );  // Set LCD Vop (Contrast). //B1
  LcdSendCmd( 0x04, LCD_CMD );  // Set Temp coefficent. //0x04

  LcdSendCmd( 0x13, LCD_CMD );  // LCD bias mode 1:48. //0x13
  LcdSendCmd( 0x20, LCD_CMD );  // LCD Standard Commands, Horizontal addressing mode.

  LcdSendCmd( 0x0C, LCD_CMD );  // LCD in normal mode. 0x0d for inverse
  // LcdSendCmd( 0x0D, LCD_CMD );

  //  Reset watermark pointers.
  LoWaterMark = LCD_CACHE_SIZE;
  HiWaterMark = 0;
  


  
    LcdClear();
  LcdUpdate();
}

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdContrast
 
 Description  :  Set display contrast.
 
 Argument(s)  :  contrast -> Contrast value from 0x00 to 0x7F.
 
 Return value :  None.
 
 Notes        :  No change visible at ambient temperature.
 
 --------------------------------------------------------------------------------------------------*/
void LcdContrast ( byte contrast )
{
  //  LCD Extended Commands.
  LcdSendCmd( 0x21, LCD_CMD );

  // Set LCD Vop (Contrast).
  LcdSendCmd( 0x80 | contrast, LCD_CMD );

  //  LCD Standard Commands, horizontal addressing mode.
  LcdSendCmd( 0x20, LCD_CMD );
}

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdClear
 
 Description  :  Clears the display. LcdUpdate must be called next.
 
 Argument(s)  :  None.
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdClear ( void )
{
  int i;

  for ( i = 0; i < LCD_CACHE_SIZE; i++ )
  {
    LcdCache[i] = 0x00;
  }

  //  Reset watermark pointers.
  LoWaterMark = 0;
  HiWaterMark = LCD_CACHE_SIZE - 1;

  UpdateLcd = true;
}

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdGotoXY
 
 Description  :  Sets cursor location to xy location corresponding to basic font size.
 
 Argument(s)  :  x, y -> Coordinate for new cursor position. Range: 1,1 .. 14,6
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdGotoXY ( byte x, byte y )
{
  LcdCacheIdx = (x - 1) * 6 + (y - 1) * 84;
}

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdChr
 
 Description  :  Displays a character at current cursor location and increment cursor location.
 
 Argument(s)  :  size -> Font size. See enum.
 ch   -> Character to write.
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdChr ( int size, byte ch )
{
  byte i, c;
  byte b1, b2;
  int  tmpIdx;

  if ( LcdCacheIdx < LoWaterMark )
  {
    //  Update low marker.
    LoWaterMark = LcdCacheIdx;
  }

  if ( (ch < 0x20) || (ch > 0x7b) )
  {
    //  Convert to a printable character.
    ch = 65;
  }

  if ( size == FONT_1X )
  {
    for ( i = 0; i < 5; i++ )
    {
      LcdCache[LcdCacheIdx++] = FontLookup[ch - 65][i] << 1;
    }
  }
  else if ( size == FONT_2X )
  {
    tmpIdx = LcdCacheIdx - 84;

    if ( tmpIdx < LoWaterMark )
    {
      LoWaterMark = tmpIdx;
    }

    if ( tmpIdx < 0 ) return;

    for ( i = 0; i < 5; i++ )
    {
      c = FontLookup[ch - 32][i] << 1;
      b1 =  (c & 0x01) * 3;
      b1 |= (c & 0x02) * 6;
      b1 |= (c & 0x04) * 12;
      b1 |= (c & 0x08) * 24;

      c >>= 4;
      b2 =  (c & 0x01) * 3;
      b2 |= (c & 0x02) * 6;
      b2 |= (c & 0x04) * 12;
      b2 |= (c & 0x08) * 24;

      LcdCache[tmpIdx++] = b1;
      LcdCache[tmpIdx++] = b1;
      LcdCache[tmpIdx + 82] = b2;
      LcdCache[tmpIdx + 83] = b2;
    }

    //  Update x cursor position.
    LcdCacheIdx += 11;
  }

  if ( LcdCacheIdx > HiWaterMark )
  {
    //  Update high marker.
    HiWaterMark = LcdCacheIdx;
  }

  //  Horizontal gap between characters.
  LcdCache[LcdCacheIdx++] = 0x00;
}

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdStr
 
 Description  :  Displays a character at current cursor location and increment cursor location
 according to font size.
 
 Argument(s)  :  size    -> Font size. See enum.
 dataPtr -> Pointer to null terminated ASCII string to display.
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdStr ( int size, char *dataPtr )
{
  while ( *dataPtr )
  {
    LcdChr( size, *dataPtr++ );
  }
}
Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 295
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

part 3 (this is long. note that i kept running out of memory while getting this together fot the atmega8. that's why there are no small letters in the font bitmap)
Code:

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdPixel
 
 Description  :  Displays a pixel at given absolute (x, y) location.
 
 Argument(s)  :  x, y -> Absolute pixel coordinates
 mode -> Off, On or Xor. See enum.
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdPixel ( byte x, byte y, int mode )
{
  word  index;
  byte  offset;
  byte  data;

  if ( x > LCD_X_RES ) return;
  if ( y > LCD_Y_RES ) return;

  index = ((y / 8) * 84) + x;
  offset  = y - ((y / 8) * 8);

  data = LcdCache[index];

  if ( mode == PIXEL_OFF )
  {
    data &= (~(0x01 << offset));
  }
  else if ( mode == PIXEL_ON )
  {
    data |= (0x01 << offset);
  }
  else if ( mode  == PIXEL_XOR )
  {
    data ^= (0x01 << offset);
  }

  LcdCache[index] = data;

  if ( index < LoWaterMark )
  {
    //  Update low marker.
    LoWaterMark = index;
  }

  if ( index > HiWaterMark )
  {
    //  Update high marker.
    HiWaterMark = index;
  }
}

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdLine
 
 Description  :  Draws a line between two points on the display.
 
 Argument(s)  :  x1, y1 -> Absolute pixel coordinates for line origin.
 x2, y2 -> Absolute pixel coordinates for line end.
 mode   -> Off, On or Xor. See enum.
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdLine ( byte x1, byte y1, byte x2, byte y2, int mode )
{
  int dx, dy, stepx, stepy, fraction;

  dy = y2 - y1;
  dx = x2 - x1;

  if ( dy < 0 )
  {
    dy    = -dy;
    stepy = -1;
  }
  else
  {
    stepy = 1;
  }

  if ( dx < 0 )
  {
    dx    = -dx;
    stepx = -1;
  }
  else
  {
    stepx = 1;
  }

  dx <<= 1;
  dy <<= 1;

  LcdPixel( x1, y1, mode );

  if ( dx > dy )
  {
    fraction = dy - (dx >> 1);
    while ( x1 != x2 )
    {
      if ( fraction >= 0 )
      {
        y1 += stepy;
        fraction -= dx;
      }
      x1 += stepx;
      fraction += dy;
      LcdPixel( x1, y1, mode );
    }
  }
  else
  {
    fraction = dx - (dy >> 1);
    while ( y1 != y2 )
    {
      if ( fraction >= 0 )
      {
        x1 += stepx;
        fraction -= dy;
      }
      y1 += stepy;
      fraction += dx;
      LcdPixel( x1, y1, mode );
    }
  }

  UpdateLcd = true;
}

/*--------------------------------------------------------------------------------------------------
 
 Name         :  LcdUpdate
 
 Description  :  Copies the LCD cache into the device RAM.
 
 Argument(s)  :  None.
 
 Return value :  None.
 
 --------------------------------------------------------------------------------------------------*/
void LcdUpdate ( void )
{
  int i;
  
//always update everything for the moment
LoWaterMark = 0;
HiWaterMark = LCD_CACHE_SIZE - 1;


  if ( LoWaterMark < 0 ){
    LoWaterMark = 0;
  }
  else if ( LoWaterMark >= LCD_CACHE_SIZE ){
    LoWaterMark = LCD_CACHE_SIZE - 1;
  }

  if ( HiWaterMark < 0 ){
    HiWaterMark = 0;
  }
  else if ( HiWaterMark >= LCD_CACHE_SIZE ){
    HiWaterMark = LCD_CACHE_SIZE - 1;
  }

  //  Set base address according to LoWaterMark.
  LcdSendCmd( 0x80 | (LoWaterMark % LCD_X_RES), LCD_CMD );
  LcdSendCmd( 0x40 | (LoWaterMark / LCD_X_RES), LCD_CMD );

  //  Serialize the video buffer.
  for ( i = LoWaterMark; i <= HiWaterMark; i++ )
  {
    LcdSendCmd( LcdCache[i], LCD_DATA );
  }

  //  Reset watermark pointers.
  LoWaterMark = LCD_CACHE_SIZE - 1;
  HiWaterMark = 0;

  UpdateLcd = false;
}


and finally setup() and our loop()
Code:
void setup() {

  beginSerial(19200);
  //power control led
  pinMode(CONTROL_LED,OUTPUT);


  pinMode(LCD_RST_PIN,OUTPUT);
  pinMode(LCD_DC_PIN ,OUTPUT);
  pinMode(LCD_CE_PIN ,OUTPUT);
  pinMode(SPI_MOSI_PIN ,OUTPUT);
  pinMode(SPI_CLK_PIN,OUTPUT);

  //power the display
  //not used in this sketch. the display was powered permanently
 // pinMode(LCD_POWER_PIN,OUTPUT);

  //start
  digitalWrite(CONTROL_LED, HIGH);
  LcdInit();
  
}

void loop() {
 LcdLine ( 0, 0, 83, 47, 2 );
  LcdChr(1,(char)'A');
  LcdStr(1, "BCDEFG");
  LcdUpdate();
}



//kuk
Logged

Underhill Center, Vermont, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 71
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The K107 looks good but it has a awful number of limitations.

 Just to clarify some things sort of mis-stated above. Peter Anderson http://www.phanderson.com created the LCD1x7 and LCD1x8 series of PIC chips (currently 16F648A) that serve as the core of the serial to parallel conversion for a HD44780 character based LCD display. He sells the chip and packages a schematic with it.

The K107 is a pcb I designed to house Peter's chip. It s a flexible design which can accomodate 2x7, 1x10, 1x14, and 1x16 pin configurations (2x8 has been added to Rev 4 of the board which will go to production runs in the next month or so). Peter's firmware allows handling of 2x16, 2x20, 2x24, 2x40, 4x16 and 4x20 character geometries (software selectable). The signal input can be TTL TRUe or RS232 INVerted (jumper selectable) and can be had in 2400 baud, 9600 baud, or 19200 baud. The serial baudrate is fixed in firmware specifically to avoid the potential problems, some of which have been discussed above. The K107 board with an Anderson chip comes up running every time. The Anderson firmware provides for all the expected LCD controls, as well as customizable characters, customizable startup splash screen,  4 line high numerals for large displays, etc.

 The Anderson chip uses the PIC internal UART and has a 64 character buffer so a very busy display may require some 1-40 ms delays. LCD displays are not fast devices these delays are going to happen no matter how fast you get data to the control board, whether it be serial, SPI or I2C

I wrote a complete library for the K107 based upon the TX part of Software Serial. I run my displays at 19200 on my Arduino and BBB boards all the time with no problems.

I would be interested to know exactly what you feel are the 'awful number of limitations'

  The K107 Serial LCD Controller can be seen at http://www.wulfden.org/k107/ and my Freeduino offerings (incuding some bundles with K107 boards and displays) can be seen at http://www.wulfden.org/freeduino/freeduino.shtml.

  By the way, while the original Anderson design called for a TIP41C (TO220) to PWM the display backlight. That was overkill. I found that a 2N4401 (TO92) in the negative line of the LED backlight was more than adequate for even  the brightest 4x20 backlit displays. I have sold nearly 2000 K107 boards and not one user has complained of the 4401 burning up or getting hot.


 cheers ... BBR


« Last Edit: January 21, 2008, 01:12:02 am by brianbr » Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I would be interested to know exactly what you feel are the 'awful number of limitations'
Most of the reasons why I think its limited are due to the software.

The only hardware complaint is its not very small. smiley
While board area doesnt matter much, yours is rather thick.

Here is a list of software issues I can think of in my jet lagged state. smiley-wink
  • Its not open in any sense of the word. The chip is a black box.
  • Fixed serial speed.
  • You can only use serial while SPI and I2C can be more useful in many circumstances.
  • No feedback. I'm thinking of implementing 'slow down' feedback so if the buffer gets full then data isnt lost.
  • Its a 'dumb' chip. It only does what its told. It cannot do any cool things like automated custom character animation or ticker displays which are perfectly possible and reduces the load for the device controlling it.
  • It cannot be upgraded. If Peter makes a new version then you need to buy a new chip.
Logged

Underhill Center, Vermont, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 71
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote
I would be interested to know exactly what you feel are the 'awful number of limitations'
Most of the reasons why I think its limited are due to the software.

The only hardware complaint is its not very small. smiley
While board area doesnt matter much, yours is rather thick.

Here is a list of software issues I can think of in my jet lagged state. smiley-wink
  • Its not open in any sense of the word. The chip is a black box.
  • Fixed serial speed.
  • You can only use serial while SPI and I2C can be more useful in many circumstances.
  • No feedback. I'm thinking of implementing 'slow down' feedback so if the buffer gets full then data isnt lost.
  • Its a 'dumb' chip. It only does what its told. It cannot do any cool things like automated custom character animation or ticker displays which are perfectly possible and reduces the load for the device controlling it.
  • It cannot be upgraded. If Peter makes a new version then you need to buy a new chip.

The board size is dictated much by the real estate required for the various hole sets to connect to various pinouts, and by my desire to keep the board as a through-hole project to make it useable by a broader range of hobbyists. the ExpressPCB boards is a bit thick, but since I aimed it at being hung onto the back of the display by it connector, the extra thickness serves to strengthen  the board.

Granted it is 'closed.' Peter's chip is proprietary.  The income through the years from that chip alone has gone a long way to fund projects for his students. I have no problem with that. As for 'upgrades' and 'having to buy a new chip' there's been one upgrade  almost two years ago and  a 'silent' upgrade (no chip designation change) two months ago (Fixed a bug John Carter and I each discovered independently that had been around for three years without being discovered).

I don't see fixed baudrate as a problem. The tradeoff in variable baudrates can be erratic, unpredictable startup.

No Feedback ... that would be nice, the cost is another connection  and i/o line

SPI/I2C ... yes, it could be handy, but again more complexity.

You are right and wrong about 'special features' there is some provision to send binary commands that could enable dot-row/column scrolling and other 'special effects.' But that indeed does pass an increased burden on the host processor.


cheers ... BBR
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I don't see fixed baudrate as a problem. The tradeoff in variable baudrates can be erratic, unpredictable startup.
I've got a simple solution to users borking their baud rates. smiley
Just a a pair of contacts. Short them out with a screwdriver or similar and apply power. Resets to defaults.

Quote
No Feedback ... that would be nice, the cost is another connection  and i/o line
The feature would be completely optional. I2C and SPI can have a polled mode where the host asks if its ok to send.
If your using serial and dont have a spare gpio then you just ignore it.

Quote
You are right and wrong about 'special features' there is some provision to send binary commands that could enable dot-row/column scrolling and other 'special effects.' But that indeed does pass an increased burden on the host processor.
Well I did say that the chip was 'dumb' and only did what it was told. smiley
I dont see why you wouldnt add in special effects considering the chip is mostly idling and it cant be using too much flash space.

I'll hopefully have a beta firmware in a week or two. smiley-grin
Then I can get a prototype going and calculate costs and stuff like that.
Logged

Maastricht, The Netherlands
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
Techno!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Here's a basic code to display text, lines and dots. Original c code came from Massimo. I already posted it to the forum, but thing get easily lost here. i know it should be up on the playground. but me too got distracted from it by other projects. The circuit i use never got updated, like i planned, using a proper 3,3v regulator for the display. i'm doing other stuff lately with arduino running on 3.3v so i might get back to it.

here the lazy circuit http://flickr.com/photos/12058013@N07/2203300707/ using 4 diodes to reduce voltage to appr. 3.2v and voltage dividers for communication.
here's a basic version of the code [again here, and not on the playground, so maybe we could clean it up build a library from it together]:
Code:

....


Wow, that sounds very nice 8-)
I'm a starter with this "Arduino" things, but it looks really nice all this!!

The code what you've wrote (in 4 parts) is that only for a ATmega168 (for the Arduino) ??
Or can I use it also for example a ATmega48 or something?

Thanks in advance,

Atmoz
Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 295
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi atmoz,

the code should be easily portable. in fact the original code was written for a pic if i rememeber correctly. the only arduino specific thing should be the pins definition at the beginning.

best, kuk
Logged

Maastricht, The Netherlands
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
Techno!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
hi atmoz,

the code should be easily portable. in fact the original code was written for a pic if i rememeber correctly. the only arduino specific thing should be the pins definition at the beginning.

best, kuk


Hello Kuk,

Thanks for the fast reply.
Sounds really nice again!! So only change

Code:
int LCD_POWER_PIN = 11;
int LCD_DC_PIN    = 2; //  PB0  4 Data Command
int LCD_CE_PIN    = 3; //  PB2  5 /CS   active low chip select ??
int SPI_MOSI_PIN  = 4; //  PB3  3 Serial   line
int LCD_RST_PIN   = 5; //  PB4  8 /RES RESET
int SPI_CLK_PIN   = 6; //  PB5  2 CLOCK


into the right pins at an ATmega48?
Nothing else? clockspeeds, timings, etc??

[edit]

I don't have a Arduino yet, so I can't test it. Therefore I ask this smiley
« Last Edit: February 02, 2008, 12:05:29 pm by Atmoz » Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 295
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

note that the out commented port names are from the original code. well, so i guess it was AVR rather than pic.
Quote
Nothing else? clockspeeds, timings, etc??

ok. good you're asking again.
there's a little arduino specific stuff inside which boils down to delayMicroseconds() at some places, i think. your compiler should warn you if there's more. you can just replace them with something else that "delays" the program. but i've not touched the code for over a year. it really was on of the first thing i hacked together when i got my first board. i just posted it to encourage others to work with the display.

timing isn't crucial here because of the spi clock line. i think the display was very tolerant. but really, if your not working with the arduino IDE at all, you might be better of checking out those links provided by follower a few posts up. the only thing "special" about my code is that it works on an arduino like it is. plus, i removed the lowercase letters from the bitmap to make it fit into an atmega8. more a bug than a feature.

kuk

Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok I've been perfecting the PCB and double checking prices.
It looks like I can easily make them for $10 each. smiley

I'll plan how I'm going to organize distributing them and then I will start making. smiley
Logged

Maastricht, The Netherlands
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
Techno!!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Ok I've been perfecting the PCB and double checking prices.
It looks like I can easily make them for $10 each. smiley

I'll plan how I'm going to organize distributing them and then I will start making. smiley

Sounds good smiley-grin
Let us know when they are ready. I think I'll order some smiley (and hopefully the shipment costs aren't that much...)

And thanks for the answer kuk!

Regards,

Atmoz
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming Australia Post calls it a letter and not a parcel, shipping will only be about $3.85 AUD. smiley
To the US it should take about 4 - 6 days.

This is using Australia Post's online calculator so it may not be exact. I need to find out more details.
http://www1.auspost.com.au/pac/int_letter.asp
Logged

Pages: 1 [2] 3 4 ... 7   Go Up
Jump to: