LCDInfo.com
http://forum.lcdinfo.com/

dmf 5005 ny/ly/ake
http://forum.lcdinfo.com/viewtopic.php?f=8&t=189
Page 1 of 1

Author:  Simon Turner [ Wed Mar 26, 2003 9:53 ]
Post subject:  dmf 5005 ny/ly/ake

hey guys

i have a dmf-5005 ny/ly/ake lcd (uses the t6963 controller).

i have got it hooked up to an atmel mega128 processor (data on port c and control on port d - wr=bit6, rd=bit7, ce=bit4, cd=bit5, reset=bit1)

i am using c to program the microcontroller.

i have attempted the initialisation routine, suggested in the datasheets, but to no avail. the screen still stays blank.

can someone help me please?
my c code is as follows... sorry its so long.....

thanx
simon


Code:
//ICC-AVR application builder : 13/03/2003 5:28:00 PM
// Target : M128
// Crystal: 8.0000Mhz

#include <iom128v.h>
#include <macros.h>

//LCD control bits

#define LCD_CE_on  PORTD |= 0x10            //turn CE on (PD4)
#define LCD_CE_off PORTD &= ~0x10            //turn CE off (PD4)
#define LCD_CD_on  PORTD |= 0x20            //turn CD on (PD5)
#define LCD_CD_off PORTD &= ~0x20            //turn CD off (PD5)
#define LCD_WR_on  PORTD |= 0x40            //turn WR on (PD6)
#define LCD_WR_off PORTD &= ~0x40            //turn WR off (PD6)
#define LCD_RD_on  PORTD |= 0x80            //turn RD on (PD7)
#define LCD_RD_off PORTD &= ~0x80            //turn RD off (PD7)
#define LCD_reset_on   PORTD |= 0x02         //turn reset on (PD1)
#define LCD_reset_off  PORTD &= ~0x02         //turn reset off (PD1)


void port_init(void)
{
PORTA = 0xFF;
DDRA  = 0xFF; //output
PORTB = 0x00;
DDRB  = 0xFF;
PORTC = 0x00; //m103 output only
DDRC  = 0xFF;
PORTD = 0x02;
DDRD  = 0xFF;
PORTE = 0xFF;
DDRE  = 0xFF;
PORTF = 0xFF;
DDRF  = 0xFF;
PORTG = 0x10;
DDRG  = 0xFF;
}

//Comparator initialisation
// trigger on: Output toggle
void comparator_init(void)
{
ACSR = ACSR & 0xF7; //ensure interrupt is off before changing
ACSR = 0x00;
}

//ADC initialisation
// Conversion time: 3uS
void adc_init(void)
{
ADCSRA = 0x00; //disable adc
ADMUX = 0x00; //select adc input 0
ACSR  = 0x00;
ADCSRA = 0x01;
}

//call this routine to initialise all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
XDIV  = 0x00; //xtal divider
XMCRA = 0x00; //external memory
port_init();
comparator_init();
adc_init();

MCUCR = 0x00;
EICRA = 0x00; //extended ext ints
EICRB = 0x00; //extended ext ints
EIMSK = 0x00;
TIMSK = 0x00; //timer interrupt sources
ETIMSK = 0x00; //extended timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialised
}

void Delay()
   {
   unsigned char a, b;

   for (a = 1; a; a++)
      for (b = 1; b; b++)
         ;
   }


int getstatus(void)
{
    int status;
    int statusok;
    int statuschk;
   
   //set up port d
   LCD_CD_on;
   LCD_RD_off;
   LCD_WR_on;
   LCD_CE_off;
   _NOP();           //>150ns?? delay before read
   _NOP();
   _NOP();
   
    DDRC  = 0x00; //input
    PORTC = 0xFF; //pull up
   
    status = PINC; //get status
   // statusok = 0x03; //what status is supposed to look like
   
    LCD_CE_on;        //take CE high again
    LCD_RD_on;        //disable read mode
    DDRC  = 0xFF;      //output
    PORTC = 0x00;      //zeros
   
   // statuschk = status & statusok; //filter out higher bits
   
    // debug - show status
    PORTB = status;
    Delay();
    Delay();
    PORTB = 0x00;
    Delay();
    Delay();
    //
       
   return (status);
}
   
   
void main()
   {
   int i;
   int j;
   int k;
   init_devices();
   /*         
   //reset
   LCD_reset_off;
   _NOP(); //length of time ??
   _NOP();
   LCD_reset_on;
   _NOP();
   _NOP();
   LCD_reset_off;
   _NOP();
   _NOP();
   LCD_reset_on;
   _NOP();
   _NOP();
   */
   
   
   //initialise   
       
   //mode set
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x80;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   
   
   
   //control word set
   //1
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x00;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //2   
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x00;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
       
   //3
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x42;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //number of graphic area set
   //1
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x1E;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //2
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x00;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //3
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x43;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //text home position set
   //1
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x00;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //2
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x00;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //3
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x40;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //number of text area set
   //1
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x1E;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //2
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x00;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //3
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x41;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //address pointer set
   //1
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x23;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //2
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x01;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //3
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x24;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;   
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
       
   //test
   //data
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x21;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //command
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0xC0;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
      //data
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x21;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //command
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0xC0;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
      //data
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x21;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //command
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0xC0;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
      //data
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x21;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //command
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0xC0;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
      //data
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x21;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //command
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0xC0;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
      //data
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0x21;
   LCD_CD_off;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   //command
   do {}
   while((0x03 & getstatus()) !=0x03);
   PORTC = 0xC0;
   LCD_CD_on;
   LCD_WR_off;
   LCD_RD_on;
   LCD_CE_off;
   _NOP();
   LCD_CE_on;
   LCD_WR_on;
   
   // debug
   for(;;)
   {
   PORTB = 0x0F;
   Delay();
   Delay();
   Delay();
   PORTB = 0x00;
   Delay();
   Delay();
   Delay();
   }

   
   }
 

Author:  Henri [ Wed Mar 26, 2003 13:35 ]
Post subject: 

I'll lock this topic as it's also posted here:
http://www.skippari.net/phpBB2/viewtopic.php?t=185

Page 1 of 1 All times are UTC + 2 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/