LCDInfo.com

http://www.lcdinfo.com
It is currently Tue Apr 16, 2024 11:16

All times are UTC + 2 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Sep 22, 2008 19:21 
Offline

Joined: Mon Sep 22, 2008 19:14
Posts: 2
We are trying to interface nokia 6100 lcd and atmega16.Currently we are trying to display a bitmap image on the LCD.But we are not getting any results on LCD.We have gone through the tutorial posted by James Lynch but still cannot display the image on LCD.Following is our code.Please suggest what is wrong or missing.

#include<avr/io.h>
#include<avr/interrupt.h>
#include "mred.h" // bitmap array header file
#include "lcdh.h"

#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08
#define BIT4 0x10
#define BIT5 0x20
#define BIT6 0x40
#define BIT7 0x80
#define LCDCommand 0
#define LCDData 1


#define TOGGLEBIT(a,x) a=a^x;
#define SETBIT(a,x) a=a|x;
#define CHECKBIT(a,x) (a&x)
#define CLEARBIT(a,x) a=a&(~x);

void delay (unsigned int d)
{
int a,b;
for(a=0;a<700;a++)
{
for(b=0;b<d;b++);
}
}


void SendLcd(char type, char dat)
{

CLEARBIT(PORTB,BIT1); // Chip Select
if(type == 0)
{
CLEARBIT(PORTB,BIT5); // Pull MOSI LoW
}
else
{
SETBIT(PORTB,BIT5); // Pull MOSI High
}


SPCR = 0x50;
SPSR = 0x01; // SCK 16MHz /2 == 8 Mhz
SPDR = dat;

while(!(SPSR & 0x81));




}

void InitLCD(void)
{

CLEARBIT(PORTB,BIT1); //Chip select

CLEARBIT(PORTB,BIT0); //LCD Reset
delay(5);
SETBIT(PORTB,BIT0);
delay(5);

SendLcd(LCDCommand,SLEEPOUT); //Sleep out
SendLcd(LCDCommand,INVON);

SendLcd(LCDCommand,COLMOD); //Color mode
SendLcd(LCDData,0x02);


SendLcd(LCDCommand,MADCTL); //Memory access control
SendLcd(LCDData,0xC8);


SendLcd(LCDCommand,SETCON); // Set Contrast
SendLcd(LCDData,0x70);
delay(3);

SendLcd(LCDCommand,DISPON); //Display On



SendLcd(LCDCommand,RGBSET); //8bit mode
SendLcd(LCDData,0x00); // RED
SendLcd(LCDData,0x02);
SendLcd(LCDData,0x04);
SendLcd(LCDData,0x06);
SendLcd(LCDData,0x08);
SendLcd(LCDData,0x0a);
SendLcd(LCDData,0x0c);
SendLcd(LCDData,0x0f);
SendLcd(LCDData,0x00); // GREEN
SendLcd(LCDData,0x02);
SendLcd(LCDData,0x04);
SendLcd(LCDData,0x06);
SendLcd(LCDData,0x08);
SendLcd(LCDData,0x0a);
SendLcd(LCDData,0x0c);
SendLcd(LCDData,0x0f);
SendLcd(LCDData,0x00); // BLUE
SendLcd(LCDData,0x04);
SendLcd(LCDData,0x09);
SendLcd(LCDData,0x0f);
}

void Image(void)
{
long j;

SendLcd(LCDCommand,MADCTL);
SendLcd(LCDData,0X48);
SendLcd(LCDCommand,DISPOFF);
SendLcd(LCDCommand,CASET);
SendLcd(LCDData,0);
SendLcd(LCDData,image_width);
SendLcd(LCDCommand,PASET);
SendLcd(LCDData,0);
SendLcd(LCDData,image_height);
SendLcd(LCDCommand,RAMWR);
for(j=0;j<sizeof(bitmap);j++)
{

SendLcd(LCDData,bitmap[j]);
}
SendLcd(LCDCommand,MADCTL);
SendLcd(LCDData,0XC8);
SendLcd(LCDCommand,DISPON);
}


void main(void)
{
DDRB = 0xFF;
DDRC = 0x01;
DDRA = 0xFF;


InitLCD();
Image();

}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 13 guests


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

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group