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

📄 t6963.i

📁 这个是AVR关中定时器与中断方面的程序
💻 I
📖 第 1 页 / 共 2 页
字号:




















































































































































































































#line 8 "C:/icc/include/includes.h"

#line 1 "C:/icc/include/stdlib.h"


#line 1 "C:/icc/include/_const.h"




#line 10 "C:/icc/include/_const.h"







#line 4 "C:/icc/include/stdlib.h"






#line 1 "C:/icc/include/limits.h"






















#line 11 "C:/icc/include/stdlib.h"




typedef unsigned int size_t;










#line 35 "C:/icc/include/stdlib.h"
char *ftoa(float f, int *status);

int abs(int);
double atof( char *);
int atoi( char *);
long atol( char *);
int rand(void);
void srand(unsigned);
long strtol( char *, char **, int);
unsigned long strtoul( char *, char **, int);


char *ltoa(char *buf, long i, int base);
char *itoa(char *buf, int i, int base);
char *ultoa(char *buf, unsigned long i, int base);
char *utoa(char *buf, unsigned i, int base);


void abort(void);
void *calloc(size_t, size_t);
void exit(int);
void free(void *);
void *malloc(size_t);
void _NewHeap(void *start, void *end);
void *realloc(void *, size_t);




#line 10 "C:/icc/include/includes.h"
#line 1 "C:/icc/include/stdio.h"


#line 1 "C:/icc/include/stdarg.h"


typedef char *va_list;




#line 9 "C:/icc/include/stdarg.h"

char *_va_start(void *, int);

#line 13 "C:/icc/include/stdarg.h"




#line 4 "C:/icc/include/stdio.h"
#line 1 "C:/icc/include/_const.h"




#line 10 "C:/icc/include/_const.h"







#line 5 "C:/icc/include/stdio.h"

int getchar(void);
int putchar(char);
int puts( char *);
int printf( char *, ...);
int vprintf( char *, va_list va);
int sprintf(char *, char *, ...);
int vsprintf(char *, char *, va_list va);

int scanf( char *, ...);
int vscanf( char *, va_list va);
int sscanf(char *, char *, ...);
int vsscanf(char *, char *, va_list va);






int cprintf(const char *, ...);
int csprintf(char *, const char *, ...);



#line 11 "C:/icc/include/includes.h"

#line 3 "C:\DOCUME~1\wusheng\桌面\79419083avr-t6963-pro\T6963\cfile\t6963.c"





unsigned char fnGetRow(void)
{
    return(gCurRow);
}



unsigned char fnGetCol(void)
{
    return(gCurCol);
}



unsigned char RD_LCM(void)
{
    unsigned char temp;
(*(volatile unsigned char *)0x37)=0x00;
(*(volatile unsigned char *)0x3B)  |= (1 << 2 );
(*(volatile unsigned char *)0x3B) &= ~(1 << 1);
 asm("nop");
    temp=(*(volatile unsigned char *)0x36);
(*(volatile unsigned char *)0x3B) |= (1<< 1);
(*(volatile unsigned char *)0x37) = 0xff;
    return(temp);
}



unsigned char RD_DAT(void)
{
    unsigned char temp;
(*(volatile unsigned char *)0x37) = 0x00;
(*(volatile unsigned char *)0x3B) &= ~(1<< 2);
(*(volatile unsigned char *)0x3B) &= ~(1 << 1);
 asm("nop");
    temp =(*(volatile unsigned char *)0x36);
(*(volatile unsigned char *)0x3B) |= (1<< 1);
(*(volatile unsigned char *)0x37) = 0xff;
    return(temp);
}



void WR_DAT(unsigned char val)
{
(*(volatile unsigned char *)0x37) = 0xff;
(*(volatile unsigned char *)0x3B) &= ~(1<< 2);
(*(volatile unsigned char *)0x38) = val;
(*(volatile unsigned char *)0x3B) &= ~(1<< 0);
 asm("nop");
 asm("nop");
(*(volatile unsigned char *)0x3B) |= (1<< 0);
}



void WR_CMD(unsigned char val)
{
(*(volatile unsigned char *)0x37) = 0xff;
(*(volatile unsigned char *)0x3B)  |= (1 << 2);
(*(volatile unsigned char *)0x38) = val;
(*(volatile unsigned char *)0x3B) &= ~(1<< 0);
 asm("nop");
 asm("nop");
(*(volatile unsigned char *)0x3B) |= (1<< 0);
}




unsigned char fnSTA01(void)
{
    unsigned char i;
    for(i=10;i>0;i--)
    {
        if((RD_LCM() & 0x03) == 0x03)
        {
            break;
        }
    }
    return(i);
}



unsigned char fnSTA2(void)
{
    unsigned char i;
    for(i=10;i>0;i--)
    {
        if((RD_LCM() & 0x04) == 0x04)
        {
            break;
        }
    }
    return(i);
}



unsigned char fnSTA3(void)
{
    unsigned char i;
    for(i=10;i>0;i--)
    {
        if((RD_LCM() & 0x08) == 0x08)
        {
            break;
        }
    }
    return(i);
}



unsigned char fnSTA6(void)
{
    unsigned char i;
    for(i=10;i>0;i--)
    {
        if((RD_LCM() & 0x40) == 0x40)
        {
            break;
        }
    }
    return(i);
}



unsigned char fnPR1(unsigned char uCmd,unsigned char uPar1,unsigned char uPar2)
{
    if(fnSTA01() == 0)
    {
        return 1;
    }
    WR_DAT(uPar1);
    if(fnSTA01() == 0)
    {
        return 2;
    }
    WR_DAT(uPar2);
    if(fnSTA01() == 0)
    {
        return 3;
    }
    WR_CMD(uCmd);
    return(0);
}



unsigned char fnPR11(unsigned char uCmd,unsigned char uPar1)
{
    if(fnSTA01() == 0)
    {
        return 1;
    }
    WR_DAT(uPar1);
    if(fnSTA01() == 0)
    {
        return 2;
    }
    WR_CMD(uCmd);
    return(0);
}



unsigned char fnPR12(unsigned char uCmd)
{
    if(fnSTA01() == 0)
    {
        return 1;
    }
    WR_CMD(uCmd);
    return(0);
}



unsigned char fnPR13(unsigned char uData)
{
    if(fnSTA3() == 0)
    {
        return 1;
    }
    WR_DAT(uData);
    return(0);
}



unsigned char fnPR2(void)
{
    unsigned char temp;
    if(fnSTA01() == 0)
    {
         return 1;
    }
    temp=RD_DAT();
    return(temp);
}



void fnSetPos(unsigned char urow, unsigned char ucol)
{
    unsigned int iPos;
    iPos = (unsigned int)urow * 30 + ucol;
    fnPR1(0x24,iPos & 0xFF,iPos / 256);
    gCurRow = urow;
    gCurCol = ucol;
}



void cursor(unsigned char uRow, unsigned char uCol)
{
    fnSetPos(uRow * 16, uCol);
}



void cls(void)
{
    unsigned int i;
    fnPR1(0x24,0x00,0x00);
    fnPR12(0xB0);
    for(i=0;i<240*128/8;i++)
    {
        fnSTA3();
        fnPR13(0x0);
    }
    fnPR12(0xB2);
    fnPR1(0x24,0x00,0x00);
    gCurRow = 0;
    gCurCol = 0;
}



char fnLCMInit(void)
{
    if(fnPR1(0x40,0x00,0x00) != 0)
    {
        return (0xff);
    }
    fnPR1(0x41,0x1E,0x00);
    fnPR1(0x42,0x00,0x00);
    fnPR1(0x43,0x1E,0x00);
    fnPR12(0xA0 | 0x01);
    fnPR12(0x80);
    fnPR12(0x90 | 0x08);
    return(0);
}



unsigned char dprintf(unsigned char x,unsigned char y, char *ptr)
{
    unsigned char c1,c2,cData;
    unsigned char i,j,uLen,uRow,uCol;
    unsigned int  k;
    uLen=0;
    i=0;
    uRow = y;
    uCol = x;
    fnSetPos(uRow*16,uCol);
    while (ptr[uLen]!=0)
    {
        uLen++;
    }
    while(i<uLen)
    {
    	c1 = ptr[i];
    	c2 = ptr[i+1];

    	uRow = fnGetRow();
    	uCol = fnGetCol();
    	if(c1 <=128)
      	{
            for(j=0;j<16;j++)
            {
        	fnPR12(0xB0);
        	if (c1 >= 0x20)
          	{
            	    fnPR13( ASC_MSK[(c1-0x20)* 16 +j-(16- 16)] );
          	}
        	else
        	{
          	    fnPR13(cData);
          	}
         	fnPR12(0xB2);
                fnSetPos(uRow+j+1,uCol);
             }
            if(c1 != 0x08)
            {
                uCol++;
            }

        }
    	else
      	{
            for(j=0;j<sizeof(GB_16)/sizeof(GB_16[0]);j++)
            {
                if(c1 == GB_16[j].Index[0] && c2 == GB_16[j].Index[1])
                {
                    break;
                }

            }
            for(k=0;k<sizeof(GB_16[0].Msk)/2;k++)
            {
                fnSetPos(uRow+k,uCol);
        	fnPR12(0xB0);
        	if(j < sizeof(GB_16)/sizeof(GB_16[0]))
          	{
          	    fnPR13(GB_16[j].Msk[k*2]);
          	    fnPR13(GB_16[j].Msk[k*2+1]);
          	}
        	else
          	{
          	    if(k < sizeof(GB_16[0].Msk)/4)
            	    {
                        fnPR13(0x00);
            		fnPR13(0x00);
            	     }
         	    else
            	    {
            		fnPR13(0xff);
			fnPR13(0xff);
            	    }
                }
        	fnPR12(0xB2);
            }
      	    uCol += 2;
      	    i++;
        };
    	if(uCol >= 30)
      	{
      	    uRow += 16;
            if(uRow < 0x80)
            {
                uCol -= 30;
            }
      	    else
            {
        	uRow = 0;
        	uCol = 0;
            }
      	 }
         fnSetPos(uRow,uCol);
    	 i++;
    }
    return uLen;
}



void shortdelay(unsigned int tt)
{
    unsigned char i;
    while (tt)
    {
        i=100;
        while (i)
        {
            i--;
        }
    tt--;
    }
}



void point(unsigned char x,unsigned char y,unsigned char s)
{
    unsigned char x1;
    x1 = x >> 3;
    fnSetPos(y,x1);
    x1 = turnf[ x & 0x07 ];
    x1 = 0xF0 | x1 | s;
    fnPR12(x1);
}



void Linexy(unsigned char x0,unsigned char y0,unsigned char xt,unsigned char yt,unsigned char s)
{
    register unsigned char t;
    int xerr = 0,yerr = 0;
    int delta_x,delta_y,distance;
    int incx,incy,uRow,uCol;
    delta_x = xt-x0;
    delta_y = yt-y0;
    uRow = x0;
    uCol = y0;
    if(delta_x>0)
    {
        incx = 1;
    }
    else if( delta_x==0 )
    {
        incx=0;
    }
    else
    {
        incx = -1;
        delta_x = -delta_x;

    }
    if(delta_y>0)
    {
        incy=1;
    }
    else if( delta_y==0 )
    {
        incy=0;
    }
    else
    {
        incy=-1;
        delta_y=-delta_y;
    }
    if( delta_x > delta_y )
    {
        distance=delta_x;
    }
    else
    {
        distance=delta_y;
    }
    for( t=0;t <= distance+1; t++ )
    {
        point(uRow,uCol,s);
        xerr += delta_x;
        yerr += delta_y;
        if( xerr > distance )
        {
            xerr -= distance;
            uRow += incx;
        }
        if( yerr > distance )
        {
            yerr -= distance;
            uCol += incy;
        }
    }
}



void circle(unsigned char Ox,unsigned char Oy,unsigned char Rx,unsigned char s)
{
    unsigned int xx,rr;
    unsigned int xt,yt;
    unsigned int rs,row,col;
    yt = Rx;
    rr = (unsigned int)Rx*Rx+1;
    rs = (yt+(yt>>1))>>1;
    for (xt=0;xt<=rs;xt++)
    {
        xx = xt*xt;
        while ((yt*yt)>(rr-xx))
        {
            yt--;
        }
        row = Ox+xt;
        col = Oy-yt;
        point(row,col,s);
        row = Ox-xt;
        point(row,col,s);
        col = Oy+yt;
        point(row,col,s);
        row = Ox+xt;
        point(row,col,s);

        row = Ox+yt;
        col = Oy-xt;
        point(row,col,s);
        row = Ox-yt;
        point(row,col,s);
        col = Oy+xt;
        point(row,col,s);
        row = Ox+yt;
        point(row,col,s);
    }
}

⌨️ 快捷键说明

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