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 CCS Technical Support

Some LCD
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JulsPower



Joined: 18 Feb 2008
Posts: 11

View user's profile Send private message

PostPosted: Wed Feb 20, 2008 8:24 pm     Reply with quote

still dont work :(
I also tried to put an external power supply
also trying to not use rw and put it to ground(i commented the define in the driver)
JulsPower



Joined: 18 Feb 2008
Posts: 11

View user's profile Send private message

PostPosted: Thu Feb 21, 2008 8:39 pm     Reply with quote

ok again
I rewired the lcd
i have put a connector to it so now no long wire its right there on the bread board

I also put the delay cycle to 2 because im running at 8mhz

but still doesn t work

/
Code:
*
   Fichier:Encoder.c   
   Date: 7 FEV 2008     
   Auteur: Julien Gingras     
   Revision: 1.0
   Compilation:
            Compilateur: CCS
            Version:     3.5.0.92
            Librairies: 

*/

/*                 ***** LISTE DES INCLUDES *****                            */

#CASE               // Met le compilateur CASE SENSITIVE
#include <18F1220.h>          // Fichier correspondant à notre PIC

#fuses INTRC_IO, NOPUT, NOBROWNOUT, NOWDT, NOCPD, NOWRTD, NOWRTC, NOEBTR, NOEBTRB, NOPROTECT, NOCPB, NOWRTB, NOLVP
#use delay(clock=8000000)      // Fixer la vitesse de l'horloge
                        // Permet d'utiliser delay_ms() et delay_us()       
#use standard_io(A)
#use standard_io(B)
#include "Flex_LCD420.c"      //LCD driver

/*                **** LISTE DES CONSTANTES *****                           */

#define RC5_INPUT PIN_A7

//we can t use B6 and B7 because they are use by ICD2   

/*            **** LISTE DES VARIABLES GLOBALES *****                       */




/*               ***** LISTE DES PROTOTYPES *****                           */

void main(void);
void InitPic(void);

/*               ***** PROGRAMME PRINCPAL *****                             */

void main(void)
{           
   char nData;
    //InitPic();

   delay_ms(500);
   lcd_init();
   
   printf(lcd_putc, "\fThis is the 1st line");
      delay_ms(2000);
   
   while(1)
   {
      output_toggle(PIN_A4);
      delay_ms(100);
   }

}

/**********************************************************************************
Nothing to yet
Port are set automaticly
We set a timer for the RC5
***********************************************************************************/
void InitPic(void)
{   
   setup_adc(ADC_OFF);
   //Set timer 0 in 16 bit to count the uS between input
//   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_8);
//   set_timer0(0);
}



its a 4x16 it work the same way a 4x20 right??

can anyone help me
PCM helped me alot but still failing to make it work


ps this is a third lcd (i can get them free at job to do some test)
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 21, 2008 11:43 pm     Reply with quote

Quote:
its a 4x16 it work the same way a 4x20 right??

The 4x16 LCD may have different starting addresses for the rows.
You never posted the manufacturer and part number so I can't help.
JulsPower



Joined: 18 Feb 2008
Posts: 11

View user's profile Send private message

PostPosted: Fri Feb 22, 2008 5:34 am     Reply with quote

ok but the first row is always 0x00?

optrex
dmc16443
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 22, 2008 11:59 am     Reply with quote

Quote:
ok but the first row is always 0x00?

Quote:
optrex
dmc16443

That's not the real part number. This is the real part number:
OPTREX DMC16433

Electrical data sheet:
http://www.optrex.com/SiteImages/PartList/SPEC/16433aae.pdf

Programming data sheet:
http://www.optrex.com/pdfs/Dmcman_full.pdf
Look on page 20 for a list of the row addresses for the 16x4 LCD.
esa



Joined: 31 Jan 2008
Posts: 19

View user's profile Send private message

PostPosted: Fri Feb 22, 2008 3:01 pm     Reply with quote

Dear Julien,
you can also check here for a good explanation :
http://ouwehand.net/~peter/lcd/lcd.shtml

Normally, for a 4x16 character, you must see after power up ( and contrast adjustment ):
- LINE 1 with filling black square
- LINE 2 blank
- LINE 3 with filling black square
- LINE 4 blank
Then , you must initialize the LCD and you got a 4 x blank LINE :
This is for a 4 bits interface :
Code:

   write4(LCD1,CONFIG,FCT_SET+HEIGHT_BITS,5);
   write4(LCD1,CONFIG,FCT_SET+HEIGHT_BITS,5);
   write4(LCD1,CONFIG,FCT_SET+HEIGHT_BITS,5);
   write4(LCD1,CONFIG,FCT_SET+FOUR_BITS,5);
   write8(LCD1,CONFIG,SET_LCD+TWO_LINES,DELAY_2);
   write8(LCD1,CONFIG,CURSOR+RIGHT,DELAY_2);
   write8(LCD1,CONFIG,CLEAR,DELAY_2);


Code:

#define write_lcd(en1,en2,rw,rs,data)   output_d((data)|((en2)<<7)|((en1)<<6)|((rw)<<4)|((rs)<<5))

void write4(int lcd ,int rs,int data, int ms)//RS=0 => Config
{
   write_lcd(0,0,WRITELCD,rs,data);
   if (lcd==1)   write_lcd(1,0,WRITELCD,rs,data);   //Active Ligne E1
   if (lcd==2)   write_lcd(0,1,WRITELCD,rs,data);   //Active Ligne E2
   write_lcd(0,0,WRITELCD,rs,data);   //Desactive Ligne E1 ou E2
   delay_ms(ms);
}

void write8(int lcd, int rs,int data, int ms)
{
   if(lcd==1)    write_lcd(1,0,WRITELCD,rs,(data&0xF0)>>4);
   if(lcd==2)    write_lcd(0,1,WRITELCD,rs,(data&0xF0)>>4);
   write_lcd(0,0,WRITELCD,rs,(data&0xF0)>>4);
   if(lcd==1)    write_lcd(1,0,WRITELCD,rs,(data&0x0F));
   if(lcd==2)    write_lcd(0,1,WRITELCD,rs,(data&0x0F));
   write_lcd(0,0,WRITELCD,rs,(data&0x0F));
   delay_ms(ms);
}



Code:

#define READLCD      1
#define WRITELCD     0
#define LCD1         1
#define LCD2         2
#define DELAY          1
#define DELAY_2       2

#define CONFIG         0
#define PRINT          1
//------DISPLAY CLEAR---
#define CLEAR         0x01
//------CURSEUR HOME----
#define HOME         0x02
//------CURSEUR---------
#define CURSOR         0x04
#define RIGHT         0x02
#define LEFT         0x00
//------DISPLAY---------
#define DISPLAYCTRL   0x08
#define DISPLAY_ON   0x04
#define CURSOR_ON      0x02
#define BLINK_ON      0x01
#define CURSOR_OFF    0x00
#define BLINK_OFF      0x00
#define DISPLAY_OFF    0x00
//----CONFIGURATION-----
#define FCT_SET      0x02
#define SET_LCD      0x20
#define HEIGHT_BITS  0x01
#define FOUR_BITS      0x00
#define TWO_LINES      0x08
//-----DD RAM ----------
#define DD_RAM         0x80


To Print on LCD

Code:

void lcd(char *chaine,int8 lcdselect)
{
while(*chaine != 0)
      {
      write8(lcdselect,PRINT,*chaine,DELAY);
      chaine++;
      };
}


Eric
JulsPower



Joined: 18 Feb 2008
Posts: 11

View user's profile Send private message

PostPosted: Tue Feb 26, 2008 9:18 pm     Reply with quote

Hi again guys

it does work with my code and the flex driver but with a unitech uc-162A
put I have to put 0V for contrast to see it at a good contrast
a little more with the flex driver (i got no idea why)

seem all the lcd from my job are too old and failed :D ill test them all I think
thanks for your help if I need any more help on this ill post again
JulsPower



Joined: 18 Feb 2008
Posts: 11

View user's profile Send private message

PostPosted: Thu Feb 28, 2008 11:55 am     Reply with quote

i actually made the 16x4 lcd to work.

i have to put -5 V to the contrast source
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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