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

📄 main.asm.bak

📁 display a char with the position and ascci data
💻 BAK
字号:
//----------------------------------------------------------------------------------------
//File Name:		main.asm
//Applied Body:		SPT6605A
//Description:		This is a Demo code of diplay for SPT6605
//Compile:		Sunplus unSP IDE
//Current Version:	V1.0
//Written Date:		2007/3/3
//----------------------------------------------------------------------------------------
.include		Resource.inc
.include		SPT6605.inc
.include		dispChar.asm
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
.Code
//----------------------------------------------------------------------------------------
.public _main;
_main:
        INT     OFF;                    //Disable Interrupt
        R1 = 0;
        [P_WakeUp] = R1;                //disable all wakeup sources
        [P_Int] = R1;
        R1 = 0x55AA;                    //clear Watchdog
        [P_Watchdog_Clr] = R1;
        R1 = B_8KHz+B_512Hz+B_128Hz+B_2Hz+B_Enable32768+B_Strong32768;
        [P_TimeBaseSet] = R1;           // it's very important to keep 32KHz
                                        // crystal running in strong mode
        R1 = [P_WakeUpClr];
        [P_WakeUpClr] = R1;             //clear all wakeup hardware flags

        R1 = B_NormalCpuClock;
        [P_SystemClock] = R1;           // 1MHz/4 - for normal operation

        CALL    F_InitHardWare;         //reset hardware
        CALL    F_ClrAllSRAM;

        CALL    F_InitLcd;              //clear LCD dots, turn on LCD and
                                        // set LCD contrast
        CALL    F_InitDisplay;

        R1 = [P_IntClr];
        [P_IntClr] = R1;                //clear all interrupt requirement
        R1 = B_512HzInt+B_2HzInt+B_IoaInt;
        [P_Int] = R1;                   //set interrupt sources
        INT     FIQ,IRQ;
        R1 = 0x42;
				R2 = 10;
//----------------------------------------------------------------------------------------
MainLoop:	
        CALL    _F_DisplayChar;              //scan keyboard
        JMP     MainLoop;
//////////////////////////////////////////////////////////////////////////////////////////
//  Functions for Main Program
//////////////////////////////////////////////////////////////////////////////////////////

//----------------------------------------------------------------------------//
F_InitHardWare:
        R1 = 0;
        [P_IOA_Data] = R1;
        [P_IOA_Dir] = R1;
        [P_IoaWakeUp] = R1;
        R1 = 0x8000;                    //Enable IOA7 internal Pull-high resistor
        [P_IOA_PullR] = R1;

        R1 = 0;
        [P_IOB_Data] = R1;
        R1 = 0x00FF;
        [P_IOB_Dir] = R1;

        R1 = 0;
        [P_IOC_Data] = R1;
        R1 = 0x00FF;
        [P_IOC_Dir] = R1;

        R1 = 0;
        [P_IOD_Data] = R1;
        R1 = 0x00FF;
        [P_IOD_Dir] = R1;

        R1 = 0x000F;                    //IOC0 & IOC1 provide interrupt/wakeup
        [P_IOCD_Ctrl] = R1;             // at both rising & falling edges

        R1 = 0;
        [P_BatDet] = R1;
        [P_AdcCtrl] = R1;
        [P_AgcCtrl] = R1;
        [P_PgaInSelect] = R1;
        [P_Tmr_Ctrl] = R1;
        [P_DtmfTone] = R1;
        [P_Ch0Envelope] = R1;
//        [P_KeyScanCtrl] = R1;           //disable Key-Scan funcion that
//        [P_KeyScanMode] = R1;           // share pins with LCD segments
//        [P_KeyScanPort] = R1;
        [P_RiDet] = R1;
        [P_LineDetCtrl] = R1;

        R1 = 0x0080;                    //Enable Auto Key Scan
        [P_KeyScanCtrl] = R1;
        R1 = 0x007F;                    //IOA0~6 serve as Key Input port
        [P_KeyScanMode] = R1;
        R1 = 0;
        [P_KeyScanPort] = R1;
        RETF;

//----------------------------------------------------------------------------------------
F_ClrAllSRAM:
        BP = 0;
        R1 = 0;
ClrSRAMLoop:
        [BP++] = R1;
        CMP     BP,0x03FF;
        JNZ     ClrSRAMLoop;
        RETF;

//----------------------------------------------------------------------------*/
F_InitLcd:
        CALL    F_ClrLcd;       //clear all Lcd dots

        R1 = B_Duty+B_LcdEn + 0x000F;
        [P_LcdCtrl] = R1;
        RETF;

F_ClrLcd:
        R1 = 0;
        R2 = P_Seg0;
ClrLcdLoop:
        [R2++] = R1;
        CMP     R2,P_Seg39;
        JBE     ClrLcdLoop;
        RETF;
//---------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------*/
F_InitDisplay:
				R2 = 0;
				R1 = 0X53;                  //S
        CALL    _F_DisplayChar;     
        R2 = 1;
				R1 = 0X75;                  //u
        CALL    _F_DisplayChar;
        R2 = 2;
				R1 = 0X6e;                  //n
        CALL    _F_DisplayChar;
        R2 = 3;
				R1 = 0X64;                  //d
        CALL    _F_DisplayChar;
       
        R2 = 5;
				R1 = 0X54;                  //T
        CALL    _F_DisplayChar;
        R2 = 6;
				R1 = 0X61;                  //a
        CALL    _F_DisplayChar;
        R2 = 7;
				R1 = 0X6f;                  //o
        CALL    _F_DisplayChar;
        
        R2 = 9;
				R1 = 0X57;                  //W
        CALL    _F_DisplayChar;
        R2 = 10;
				R1 = 0X65;                  //e
        CALL    _F_DisplayChar;
        R2 = 11;
				R1 = 0X69;                  //i
        CALL    _F_DisplayChar;
//------------------------------------------------------------------------------------------------------------
	 

⌨️ 快捷键说明

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