I use either MPASM or CCS C compiler for code development. For the 2-Zone propagation misting timer on my site, I used the CCS C compiler for all of the code. I have the LCD module (Hitachi controller) configured for 4-bit interface and I tie the R/W* pin to ground so I am using delays between commands as opposed to polling the controller. The code space is about the same but I save on a pin. Tom Deutschman www.wizbangdesigns.com The LCD driver module source follows: ------------------------------------------- //////////////////////////////////////////////////////////////////////// //// //// LCD.C //// //// Driver for common LCD modules //// //// //// //// lcd_init() Must be called before any other function. //// //// //// //// lcd_putc(c) Will display c on the next position of the LCD. //// //// The following have special meaning: //// //// \f Clear display //// //// \n Go to start of second line //// //// \b Move back one position //// //// //// //// lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) //// //// //// //// lcd_getc(x,y) Returns character at position x,y on LCD //// //// //// //// //// //// *** This code has been modified. Note the following differences: //// //// --> Uses port A pins for LCD. //// //// --> Does not read from LCD, RW line tied to logic level. //// //// --> Read routines removed. //// //// --> LCD Init string has been modified for my purposes. //// //// //// //////////////////////////////////////////////////////////////////////// //// // //---------------------------------------------------------------------- -------- // Project: timer2 // // Description: This is the firmware for the Timer 2 product based on // the PIC16F87 microcontroller. // // $Log: lcd.c,v $ // Revision 1.2 2003/09/26 21:06:59 tom // Added CVS header // // //---------------------------------------------------------------------- -------- #define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines #define lcd_line_two 0x40 // LCD RAM address for the second line byte CONST LCD_INIT_STRING[6] = {0x28, 0x0c, 1, 2}; // These bytes need to be sent to the LCD // to start it up. // The following are used for setting // the I/O port direction register. void lcd_send_nibble( byte n ) { output_bit(PIN_A0, n & 1); output_bit(PIN_A1, n & 2); output_bit(PIN_A2, n & 4); output_bit(PIN_A3, n & 8); delay_us(1); output_high(LCD_E); delay_us(1); output_low(LCD_E); delay_us(10); } void lcd_send_byte( byte address, byte n ) { if (address == 0) output_low(LCD_RS); else output_high(LCD_RS); delay_us(1); lcd_send_nibble(n >> 4); lcd_send_nibble(n & 0xf); } void lcd_init() { byte i; output_low(LCD_RS); output_low(LCD_E); delay_ms(20); lcd_send_nibble(3); delay_ms(5); lcd_send_nibble(3); delay_us(120); lcd_send_nibble(3); delay_us(10); lcd_send_nibble(2); for(i = 0; i <= 3; ++i) { lcd_send_byte(0,LCD_INIT_STRING[i]); delay_ms(4); } delay_ms(5); } void lcd_gotoxy( byte x, byte y) { int address; if (y != 1) address = lcd_line_two; else address = 0; address = address + x - 1; lcd_send_byte(0, 0x80 | address); delay_ms(1); } void lcd_putc( char c) { switch (c) { case '\f' : lcd_send_byte(0,1); delay_ms(2); break; case '\n' : lcd_gotoxy(1,2); break; case '\b' : lcd_send_byte(0,0x10); break; default : lcd_send_byte(1,c); break; } } void lcd_shift_left( byte x ) { byte i; for (i = 0; i < x; ++i) { delay_ms(260); lcd_send_byte(0,0x18); } } -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of llile@SALTONUSA.COM Sent: Monday, November 10, 2003 3:22 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: seconds and interrupts >As an aside, check out www.crystalfontz.com as a source for inexpensive (10 or more) LCD modules. I use the 8x2 module without backlight and the cost is around $5 in qty of 10. What do you like to use asd an LCD driver? or are these serial interface modules? -- Lawrence Lile wizbangdesigns Sent by: pic microcontroller discussion list 11/10/2003 04:36 PM Please respond to pic microcontroller discussion list To: PICLIST@MITVMA.MIT.EDU cc: Subject: Re: seconds and interrupts I use the dual row 0.1" headers to connect the LCD module to my main PCB with the PIC. As an aside, check out www.crystalfontz.com as a source for inexpensive (10 or more) LCD modules. I use the 8x2 module without backlight and the cost is around $5 in qty of 10. Much less than the Optrex modules from say Digi-Key (where I buy all of my other parts.) You can see a picture of my design at www.wizbangdesigns.com on the products page. The schematics are available on the downloads page. This is my first pass at the web site. I'll have much more about the product design cycle and PICs in general. The schematics and source for all my projects will be published on the site. Tom www.wizbangdesigns.com H-bent on a path towards self-emplyment! --- In piclist1@yahoogroups.com, Leon Heller wrote: > In message <9711300251.AA19460@c...>, Tom Sgouros > writes > > [deleted] > > >And finally, and a little off-topic, I have, to my great relief, > >finished constructing the protoype of my first project using an LCD. > >Now I wonder what is the `real' way to connect my PIC's board to the > >little LCD controller board (from Optrex). The LCD board has 14 little > >copper pads along its edge, looking for all the world like they were > >meant for some connector. The problem is that I have no idea what > >connector or what it's called. Consulting catalogs has not helped so > >far. Perhaps somebody here can? > > Maplin sells snap-off strips of turned-pin plugs and sockets that I have > used to connect an LCD display to a piece of Veroboard in a mother-board > - daughter-board arrangement. The plugs are double-ended - one end is > soldered into the hole in the display, the other end is about the same > size as an IC pin. This is the neatest way I have found of connecting > these displays. > > Leon > -- > Leon Heller: leon@l... http://www.lfheller.demon.co.uk > Amateur Radio Callsign G1HSM Tel: +44 (0) 118 947 1424 > See http://www.lfheller.demon.co.uk/rcm.htm for details of a low-cost > reconfigurable computing module using the XC6216 FPGA -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.