⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main._c

📁 本科毕业设计做的一个东西,用的是AT908515,驱动128*64的LCD,开发环境是ICCAVR6.22.这些代码现在已经在成熟的产品中应用了
💻 _C
字号:
#include<io8515.h> 
//**the data port,use the port a,if donot change it
#define Db     PORTA
#define DbIn   PINA
#define DbDir  DDRA
//** DB0--PA0  DB1--PA1  DB2--PA2  DB3--PA3  DB4--PA4
//** DB5--PA5  DB6--PA6  DB7--PA7
//*****************************************************  
//**the contral port,use the port c,if not change it
#define ContrPort PORTC
#define ContrIn PINC
#define ContrDir DDRC
//**D_I--PC0
#define D_I   0b00000001
//**R_W--PC1
#define R_W   0b00000010
//**E--PC4
#define E     0b00010000
//**CS1--PC7
#define CS1   0b10000000
//**CS2--PC6
#define CS2   0b01000000
//**RESET--PC5
#define RESET 0b00100000
#define All   0b11110011
//*******************************************************
//P0  data
//P1  clock
//P2   TRO
#define  DisPort   PORTB
#define  DisDdr    DDRB
#define  str       0b00000100
#define  data      0b00000001
#define  clock     0b00000010
#define  and3      0b00000111
//************************************

void ClearRam(void);
void Cacu_Display(unsigned char temp);
void lcdsetup();
void WriteCgram(unsigned char DataSequent,unsigned char Point);
void ClearRam(void);
//**************************************************
void WriInsn(unsigned char command);
unsigned char Readdata(void);
void WriData(unsigned char WriData);
void StartDiaplay(void);  
//===============================================================
void main()
	 {  
	    unsigned char i,j,k;
	    unsigned char main_i,main_j,main_k;
	    DDRB=0b11111111;
		DDRA=0b11111111;
		DDRC=0b11111111;		
//*****************************************
//********reset the lcd*********************
		PORTC=PORTC&0b11011111;//reset=0		
		main_i=0xff;
		main_j=0xff;
		main_k=50;		
		while(main_k)
		   {
		     main_k--;
			 while(main_j)
			   { 
			     main_j--;
				 while(main_i)
				    {main_i--;}		   
			   }
		   }
		
	    PORTC=PORTC|~0b11011111;//reset=1		
		ClearRam();						
//*********************************************	  
//trantport  number
         WriteCgram(10,18);  
		 WriteCgram(11,19);
		 WriteCgram(12,20);
		 WriteCgram(13,21);
		 
		 
		 WriteCgram(17,24);
		 WriteCgram(18,25);
		 WriteCgram(19,26);
		 WriteCgram(20,27);
		 WriteCgram(21,28);
		 WriteCgram(22,29);
		 
		 
		 
		
		
        StartDiaplay();
		Cacu_Display(222);
		while(1)
		   {}
	 
	 
	 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -