www.pudn.com > TFT.rar > Main.c
//*************************************************************************
// Camera Module Controler
// Writed By Holmestang
// 编译环境 : ICCAVR 支持器件 : ATMEGA8515
// Use extern CRYSTAL 11.0592MHz fusebit 0xD9DE, lockbit 0x00FF
// COPYRIGHT (C) 2007
// EXTRAM: 32K (Max Address 0x260~0xFFFF)
// Crystal: 16.000Mhz
//
//*************************************************************************
#include "Main.h"
#include "TFTdriver.h"
#include "Serinit.h"
#include "Delay.h"
unsigned char *Bmp_Buffer=(unsigned char *)0x0260;
///////////////////////////////////////////////////////////
void main(void)
{
CLI(); //Disable all interrupts
PORTA = 0x00;
DDRA = 0x00;
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00;
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
PORTE = 0x00;
DDRE = 0x00;
MCUCR = 0x80; //Enable ExtRam
EMCUCR = 0x00; //Ext Ram 0x0260~0xFFFF,Low 0 wait,High 0 wait
GICR = 0x00; //No interrupt
TIMSK = 0x00; //Disable T/C1,T/C0
SFIOR = BIT(XMBK)|BIT(PUD); //XM break keeper, Pull up disable
delayms(100);
serinit();
SEI(); //Enable all interrupts
send_string("Test TFT V02\x0D\x0A\x00");
if ( !check_extram() )
send_string("Ram fail!\x0D\x0A\x00");
else
{
send_string("Ram pass!\x0D\x0A\x00");
load_bmp_to_ram();
Test_TFT_Lcd();
}
while(1);
}
void load_bmp_to_ram(void)
{
unsigned char value;
unsigned int i,length,chksum=0;
send_string("Please load bmp data to ram!\x0D\x0A\x00");
length=get_data();
length=length*0x100+get_data();
send_num( MSB(length) );
send_num( LSB(length) );
send_data(0x0D);
send_data(0x0A);
for (i=0;i