CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Graphic LCD suggestions - off topic

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Bill T.
Guest







Graphic LCD suggestions - off topic
PostPosted: Tue Jul 13, 2004 1:50 pm     Reply with quote

Hello all -

Sorry to be off-topic, but wondered if the group can suggest a graphics LCD for interfacing to a 16F877 PIC. B&W is OK, and I would like to plot a time series of data, maybe something on the order of 30 or so x and y pairs. Not quite sure what resolution/number of pixels this will require. The data to be plotted will be floating point values ranging anywhere from 0 to 100, and I think a resolution of 1 will be ok. The max. and min. of the data to be plotted can be used to expand the display to take advantage of all of the vertical pixels.

Of course, ease of interfacing and cost is of paramount importance. Suggestions, things to be aware of, good/bad experiences appreciated.

Thanks very much,
Bill
Futureatwork
Guest







PostPosted: Tue Jul 13, 2004 2:24 pm     Reply with quote

I saw some people using nokia phone displays, they are 96x62pixels I think.

www.picbasic.org/forum has some code to start but you will have to port to C.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Tue Jul 13, 2004 4:12 pm     Reply with quote

Not the cheapest solution but may be the simplest, Scott Edwards Electronics sells two serially interfaced graphic LCDs.

http://www.seetron.com/slcds.htm

G12864 128x64 pixel
G12032 120x32 pixel
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Tue Jul 13, 2004 5:29 pm     Reply with quote

This might also be worth looking at:

http://www.earthlcd.com/ACX705AKM-7.htm
Sergio



Joined: 16 Oct 2003
Posts: 11
Location: Arkansas, USA

View user's profile Send private message

PostPosted: Tue Jul 13, 2004 10:23 pm     Reply with quote

Don't know what your budget is but I did a medical project with this product:

http://www.amulettechnologies.com/

It required multiple menus and graphics. Am pretty satisfied.
_________________
Sergio
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

t6963c controller chip
PostPosted: Wed Jul 14, 2004 10:31 am     Reply with quote

If you end up opting for a graphical lcd with the t6963c controller chip, the following code will help you out. I started with some code that I think I got from here, and I modified it quite a bit. I'm using a varitronix MGLS-24064 240x64 display, which is less than $90 CDN from digikey. Really quite reasonable, really.

The hookup is really easy - you only need 8 data lines, and an additional 4 control lines: /WR, /RD, C/D (command/data), and /RESET. There is a document regarding the 6963 chip somewhere on the 'net that says that you also need to hook up the /CE signal, but you don't. Just tie it to ground, along with the FS pin (font select), which will give you 8x8 sized spaces for characters (the characters are always 5x7, regardless of the state of the FS pin).

The only function of the display that I haven't implemented is the user-defined characters in the text mode.

Most of the 240x64 displays come with 8k RAM, which is enough for about 4 full unique displays. To quickly switch between these displays, just set the graphics home to the base address of the new screen/picture.

Anyway, here's some sample code (18F452 @ 4 MHz) that I cut & pasted from a project that I'm currently working on. That's the reason why the interrupts are enabled, but there are no interrupt routines.

Code:
#include <18F452.h>
#device *=16
#device adc=10
#use delay(clock=4000000,RESTART_WDT)
#fuses XT, BROWNOUT, BORV27, PUT, STVREN, NOLVP

/////////////////////////////////////////////////////////////////////////
////                                                                 ////
//// This file contains drivers for using a Tosiba T6963C controller ////
//// in parallel/8080(intel) mode.  The T6963C is 240 pixels across  ////
////  and 64 pixels down. The driver treats the upper left pixel 0,0 ////
////                                                                 ////
////  Connections are as follows:                                    ////
////  /WR - - C4                                                     ////
////  /RD - - C5                                                     ////
////  C//D- - C6                                                     ////
////  /RST- - C7                                                     ////
////  DATA0-7 PORTD0-7                                               ////
////  LCD's FS is tied low (FS = 0 is 8x8 font)                      ////
////                                                                 ////
/////////////////////////////////////////////////////////////////////////

// 240 x 64 in the 8x8 font mode means that 30 characters across by
// 8 rows of characters may be displayed

#define set_tris_lcd(x) set_tris_d(x)
//TRIS DataBus=x,  note:control bus (PORTC) always outputs
const int16 TextHome = 0x0780;
const int8  TextArea = 0x001E; // how many bytes before a new line
const int16 GraphicsHome = 0x0000;
const int8  GraphicsArea = 0x001E; // how many bytes before a new line

const int8 AutoModeWrite = 0xB0;
const int8 AutoModeRead  = 0xB1;
const int8 AutoModeReset = 0xB2;

const int8 LCDModeSet  = 0x80;   // send this OR'd with the following
const int8 LCDMode_OR  = 0b0000;
const int8 LCDMode_XOR = 0b0001;
const int8 LCDMode_AND = 0b0010;
const int8 LCDMode_TA  = 0b0100; // TEXT ATTRIBUTE mode.
const int8 LCDMode_RAM = 0b1000; // 1=CG RAM, 0=internal CG ROM

const int8 LCDSetCursorPtr  = 0x21;  // cursor address
const int8 LCDSetCursorSize = 0xA0;  // 1 line cursor

const int8 LCDDispMode = 0x90;   // send this OR'd with the following
const int8 LCDDisp_BLK = 0b0001;
const int8 LCDDisp_CUR = 0b0010;
const int8 LCDDisp_TXT = 0b0100;
const int8 LCDDisp_GRH = 0b1000;

struct lcd_pin_def
{
   BOOLEAN unused1;    // C0
   BOOLEAN unused2;    // C1
   BOOLEAN unused3;  // C2
   BOOLEAN unused4;  // C3
   BOOLEAN w_bar;  // C4 Write bar active low
   BOOLEAN r_bar;  // C5 Read bar active low
   BOOLEAN cd;         // C6 Command/Data BAR   1=command 0=data
   BOOLEAN reset_bar;  // C7 Reset active low
   int  data    :  8;  // PortD=Data bus
};
struct lcd_pin_def  LCD;

#byte LCD = 0xf82    // portC address on 18F452

int   glcd_ReadByte(void);
void  glcd_WriteByte(int1 cd, int data);
void  glcd_WriteByteAuto(int data);
void  glcd_WriteCmd2(int16 data, int cmd);
void  glcd_WriteCmd1(int data, int cmd);
void  glcd_gotoxy(int x, int y, int1 text);

void glcd_init(void) {
  int16 counter;
  set_tris_lcd(0xff);   //TRIS DATA bus,note:control bus always outputs

  LCD.w_bar = 1;      // INITIAL STATES OF CONTROL PINS
  LCD.r_bar = 1;      //
  LCD.cd = 1;         // command

  LCD.reset_bar = 0;  // perform a reset
  delay_us(10);      // delay for a reset
  LCD.reset_bar = 1;  // run

  // Set up the graphics and text areas
  glcd_WriteCmd2(TextHome, 0x40);
  glcd_WriteCmd2(TextArea, 0x41);
  glcd_WriteCmd2(GraphicsHome, 0x42);
  glcd_WriteCmd2(GraphicsArea, 0x43);

  // set address to 0
  glcd_WriteCmd2(0x0000, 0x24);
  glcd_WriteCmd2(0x0000, 0x24);

  // Clear all RAM of LCD (8k)
  glcd_WriteByte(1, AutoModeWrite);
  for (counter = 0; counter < 0x1fff; counter++)
  {
    glcd_WriteByteAuto(0);    // fill everything with zeros
  }
  glcd_WriteByte(1, AutoModeReset);
}

void glcd_WriteByte(int1 cd, int data)
{
    int status = 0, temp = 0;
    set_tris_lcd(0xff);
    LCD.w_bar = 1;
    LCD.r_bar= 1;
    LCD.cd = 1;//defaults

    while (status != 0x03) {  // is LCD busy?
       LCD.r_bar= 0;
       temp = LCD.data;
       LCD.r_bar = 1;
       status = temp & 0x03;
    }

    set_tris_lcd(0x00);    // All outputs
    LCD.cd = cd;           // Command/Data bar
    LCD.data = data;
    LCD.r_bar = 1;         // not read
    LCD.w_bar = 0;         // write
    LCD.w_bar = 1;         // release
}

void glcd_WriteByteAuto(int data)
{
   int status = 0, temp = 0; // status bits ARE DIFFERENT BITS THAN NORMAL
   set_tris_lcd(0xff);
   LCD.w_bar = 1;
   LCD.r_bar = 1;
   LCD.r_bar_bot = 1;
   LCD.cd = 1; // defaults

   while (status != 0x08) {  // is LCD busy?
     LCD.r_bar = 0;
     temp = LCD.data;
     LCD.r_bar = 1;
     status = temp & 0x08;
   }

   set_tris_lcd(0x00);     // All outputs
   LCD.cd = 0;             // This is always data, cd=0
   LCD.data = data;        // Put data on data bus
   LCD.w_bar = 0;          // write
   LCD.w_bar = 1;          // release
}

void glcd_WriteCmd1(int data, int cmd)
{
  glcd_WriteByte(0, data);
  glcd_WriteByte(1, cmd);
}

void glcd_WriteCmd2(int16 data, int cmd)
{
  glcd_WriteByte(0, data & 0xff);
  glcd_WriteByte(0, data>>8);
  glcd_WriteByte(1, cmd);
}

int glcd_ReadByte(void)
{
  int data = 0, status = 0, temp = 0;
  set_tris_lcd(0xff);
  LCD.w_bar = 1;
  LCD.r_bar = 1;
  LCD.cd = 1;  // defaults

  while (status != 0x03) {  // is LCD busy?
    LCD.r_bar = 0;
    temp = LCD.data;
    LCD.r_bar = 1;
    status = temp & 0x03;
  }

  LCD.cd = 0;          // Command/Data bar
  LCD.r_bar = 0;        // read
  data = LCD.data;
  LCD.r_bar = 1;
  LCD.cd = 1;
  return data;        // Return the read data
}

void glcd_putc(char c) {
   glcd_WriteCmd1(c - 0x20, 0xc0);
}

void glcd_gotoxy(int x, int y, int1 text) { // sets memory location to screen location x, y
   // location 1,1 is upper left corner;  text = 1 (text area), text = 0 (graphics area)
   int16 location, home;
   int line;

   if (!text) {
      home = GraphicsHome;
      line = GraphicsArea;
   }
   else {
      home = TextHome;
      line = TextArea;
   }

   location = home + (((int16)y - 1) * line) + x - 1;
   glcd_WriteCmd2(location, 0x24);
}

#use fast_io(D)

void main() {

   setup_adc_ports(ALL_ANALOG);
   setup_adc(ADC_CLOCK_DIV_8);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_wdt(WDT_ON);
   setup_timer_0(RTCC_DIV_256|RTCC_8_bit);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   enable_interrupts(INT_RTCC);
   enable_interrupts(INT_AD);
   enable_interrupts(INT_RB);
   enable_interrupts(global);

   set_tris_c(0x00);  // graphic lcd control lines all output
   glcd_init();
   glcd_WriteByte(1, (LCDModeSet|LCDMode_XOR));
   glcd_WriteByte(1, (LCDDispMode|LCDDisp_TXT|LCDDisp_GRH));
}


The above code will initialize the graphic lcd. If you wanted to display "Hi there" beginning at screen location column 4, row 3, then these two commands will do that:

Code:
glcd_gotoxy(4,3,1); // 1 = text area of memory; note that there are only
                             // 8 rows of text possible
glcd_putc("Hi there");


If you wanted to create an 8 pixel x 8 pixel black square with the upper left corner of the square located at 9 pixels in from the left, and 43 pixels down from the top, then this code will do that:

Code:
int n;
for (n = 0; n< 8; n++) {
   glcd_gotoxy(2,43+n,0);  // 0 = graphics memory area;  note that there
   // are still 30 columns (30 x 8 pixels = 240), but now there are now 64
   // rows so pixel location 9,43 translates into column 2, row 43.  A little
   // confusing, I know, but that's the way it works.
   glcd_WriteCmd1(0xff,0xc0);
}


Hope this helps.
lucky



Joined: 12 Sep 2003
Posts: 46
Location: South Coast - England

View user's profile Send private message Visit poster's website

Nokia 3310 LCD
PostPosted: Mon Jul 19, 2004 2:27 am     Reply with quote

Hi Bill,

I have not tryed them yet but there are 2 Nokia LCD that look very easy to drive.

3310 LCD for B&W
6610 LCD for Colour

I have data sheets on my website.
_________________
Lucky
www.mpic3.com - MPIC3 player project, Forum, Downloads, Online Shop
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Mon Jul 19, 2004 10:07 am     Reply with quote

newguy, That look like the code I wrote. Can you update it in the code
library.

http://www.ccsinfo.com/forum/viewforum.php?f=2


thanks
Smile
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

Hope you don't mind...
PostPosted: Mon Jul 19, 2004 10:20 am     Reply with quote

Treitmey,

Sorry about modifying your code without giving you credit, but I couldn't find the original post I pulled the code from when I posted this. Hope you don't mind. Wink

Anyway, I'll move the code to the code library, as per your suggestion.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Jul 21, 2004 12:51 pm     Reply with quote

No problem.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group