📄 avr325.i
字号:
// CodeVisionAVR C Compiler
// (C) 1998-2005 Pavel Haiduc, HP InfoTech S.R.L.
// I/O registers definitions for the ATmega325
#pragma used+
sfrb PINA=0;
sfrb DDRA=1;
sfrb PORTA=2;
sfrb PINB=3;
sfrb DDRB=4;
sfrb PORTB=5;
sfrb PINC=6;
sfrb DDRC=7;
sfrb PORTC=8;
sfrb PIND=9;
sfrb DDRD=0xa;
sfrb PORTD=0xb;
sfrb PINE=0xc;
sfrb DDRE=0xd;
sfrb PORTE=0xe;
sfrb PINF=0xf;
sfrb DDRF=0x10;
sfrb PORTF=0x11;
sfrb PING=0x12;
sfrb DDRG=0x13;
sfrb PORTG=0x14;
sfrb TIFR0=0x15;
sfrb TIFR1=0x16;
sfrb TIFR2=0x17;
sfrb EIFR=0x1c;
sfrb EIMSK=0x1d;
sfrb GPIOR0=0x1e;
sfrb EECR=0x1f;
sfrb EEDR=0x20;
sfrb EEARL=0x21;
sfrb EEARH=0x22;
sfrw EEAR=0X21; // 16 bit access
sfrb GTCCR=0x23;
sfrb TCCR0A=0x24;
sfrb TCNT0=0x26;
sfrb OCR0A=0x27;
sfrb GPIOR1=0x2a;
sfrb GPIOR2=0x2b;
sfrb SPCR=0x2c;
sfrb SPSR=0x2d;
sfrb SPDR=0x2e;
sfrb ACSR=0x30;
sfrb OCDR=0x31;
sfrb SMCR=0x33;
sfrb MCUSR=0x34;
sfrb MCUCR=0x35;
sfrb SPMCSR=0x37;
sfrb SPL=0x3d;
sfrb SPH=0x3e;
sfrb SREG=0x3f;
#pragma used-
// Interrupt vectors definitions
//#include <macros1.h>
/****************************************************
定义管脚名称
*****************************************************/
unsigned char csd;
void delay_39us()
{
unsigned int i;
for(i=0;i<300;i++)
{
#asm
nop
nop
nop
nop
#endasm
}
}
void PortIni(void)
{
PORTB=0xff;
PORTD=0xff;
PORTC=0xff;
PORTG=0xff;
DDRB=0xff;
DDRD=0xff;
DDRC=0xff;
DDRG=0xff;
}
unsigned char LCD_Busy ( void )
{
unsigned char temp;
PORTG&=~0x02;
DDRC=0x00;
PORTD&=~0x80;
PORTG|= 0x01;
PORTG|= 0x02;
#asm
nop
#endasm
temp = PINC;
PORTG&=~0x02;
DDRC=0xFF;
return temp;
}
/*----------------------------------------------- LCD ------------------------------------------*/
void Lcd_start(void)
{
PORTD&=~0x80;
PORTG&=~0x01;
PORTG|= 0x02;
PORTC=0x00;
PORTC=0x30;
for(csd=0;csd<10;csd++)
{
#asm
nop
nop
nop
nop
#endasm
}
PORTG&=~0x02;
delay_39us();
}
/*-------------------------------------------------------*/
/* ???: Lce_set */
/* ?? :8?????,1???,5
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -