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

📄 iceev.asm

📁 八核心MCU 之FPPA 80Cxx 原廠範例程序
💻 ASM
字号:
//***************************************************************************
//***** 	PDK80Cxx Peocessor Application Example Project 		*************
//***************************************************************************
//	Example Name :: ICEEV					Version 1.00		
//	Module Name  :: ICEEV.ASM
//	Abstract:
//        	ICE EV Board Demonstration 
//	Environment:
//        	PADAUK FPPA(TM) IDE Tool Version : 0.500 Beta
//
//	Revision History:
//        	Aug. 07, 2006        Chamber C.P. Ling  Created                 
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006 by PADAUK Technology Co. Ltd. All rights reserved.
//
// This code is free for personal and commercial use, providing this 
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
// No warrantee of any kind, express or implied, is included with this
// software; use at your own risk, responsibility for damages (if any) to
// anyone resulting from the use of this software rests entirely with the
// user.
//
// See the official site at www.padauk.com.tw for documentation and
// the latest news.
//
// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
// service@padauk.com.tw or post them at the message board at the site.
/////////////////////////////////////////////////////////////////////////
// Description:
//	ICEEV.ASM is a simple and easy code in order to understand the basic 
//	architecture of FPPA firmware. Using a Single LED(PA.1) to show internal 
//	multi-core processors control a I/O pin ineractively each otherler. 
// 
//  The counters of LED Flash indicate the action of FPPx !
//=======================================================================
//----
//--
word	RAMindex;
int		ram0;
int		ram1;
int		ram2;
int		ram3;
int		FlashCnt;
int		MCUCtrl;
//---
int		DT0;
int		DT1;
int		DT2;
int		DT3;
//
	// Program Begin
	goto	fpp0Boot ;
	goto	fpp1Boot ;
	goto	fpp2Boot ;
	goto	fpp3Boot ;
	goto	fpp4Boot ;
	goto	fpp5Boot ;
	goto	fpp6Boot ;
	goto	fpp7Boot ;

//========= start MCU0 program ============//
fpp0Boot:
	set0	clkmd.1;		// turn-off watchdog
//------Low clock switch to High clock---------------------------------------
	mov		a, 0x00;
	mov		eoscr, a;	//External OSCillator Register
						// bit-0:	1=Enable XTAL Smith trigger strong mode
						//			0=Disable XTAL Smith trigger strong mode
						// bit-1:	1=Enable XTAL Smith trigger
						//			0=Disable XTAL Smith trigger
						// bit4-2:	Option of driving strength in crystal oscillator
						// bit6-5:	00=External RC oscillator
						//			01=32KHz crystal oscillator
						//			10=4Mhz crystal oscillator
						//			11=20MHz crystal oscillator
						// bit7:	1=Enable external RC oscillator or crystal oscillator
						//			0=Disable external RC oscillator or crystal oscillator
	delay	0x40;		// internal 32KHz need delay 30m/S
						// external 20MHz need delay 1m/S
	mov		a, 0x00 ;
	mov		ihrcrh, a;	//bit-0:Internal high RC
	mov		a, 0x88;
	mov		ihrcrl, a;	//Calibrate the internal RC as 16Mhz
	delay	0x40 ;		//

	mov		a, 0x14;	// select internal High RC and make low RC still run, too !
	mov		clkmd, a; 	// Internal Low RC, Watch Dog disable,
						// bit-0:	Reset Function
						// bit-1:	1=Enable Watch Dog (default)
						//			0=Disable Watch Dog
						// bit-2:	1=Enable Internal Low RC (default)
						//			0=Disable Internal Low RC
						// bit-3:	No Used
						// bit-4:	1=Enable Internal High RC (default)
						//			0=Disable Internal High RC 
						// bit-7~5:	000=internal high RC/4
						//			001=internal high RC/2
						//			010=internal high RC
						//			011=external OSC/4
						//			100=external OSC/2
						//			101=external OSC
						//			110=internal low RC/4
						//			111=internal low RC (default)
//------Low clock switch to High clock End-----------------------------------
	delay	0x40 ;		//
	// Stack Pointer Setting for Processor-0
	mov		a, 0x60 ;
	mov		sp, a ;	
	//---	
	//-- Clear Internal RAM ---	
	mov		a, 0x7f;
	mov		lb@RAMindex, a;	
	mov		a, 0x00;
	mov		hb@RAMindex, a;
ClearRAMLoop:
	wdreset;
	idxm	RAMindex, a;
	dzsn	lb@RAMindex;	
	goto	ClearRAMLoop;	 		
	// IO setting
	mov		a, 0xfe;		// PA output, pa.0 is inputs
	mov		pac, a ;	
//	mov		a, 0x02;		// PA output, pa.1 pull-high
//	mov		paph, a ;	
	mov		a, 0x00 ;
	mov		pa, a ;			// LEDs off
	//	
	// MCU setting
	pmode	2 ;
	//--- initialize the MCU Control flag 
	clear	MCUCtrl;
	//--
	mov		a, 0x03 ;	// Enable FPP1 !!
	mov		fppen, a ;	
	//--- Enable MCU 0 Demo function
	set1	MCUCtrl.0;
FPP0_ReBoot:	
	t1sn	MCUCtrl.0;
	goto	FPP0_ReBoot;
	//---- LED PA.1 Toggle One Time ---
	mov		a, 0x01;
	mov		FlashCnt, a;
FPP0_loop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto    FPP0_loop
	set0	MCUCtrl.0;	// make FPP0 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.1;	// Enable FPP1 Demo Function
	goto	FPP0_ReBoot; // Wait FPP7 clear control flag
//========== end of MCU0 program ===========//
//--
//========== start MCU1 PROGRAM ==========//
fpp1Boot:
	mov		a, 0x64 ;
	mov		sp, a ;	
	mov		a, 0x07 ;	// Enable FPP2 !!
	mov		fppen, a ;	
FPP1_ReBoot:	
	t1sn	MCUCtrl.1;
	goto	FPP1_ReBoot;
	//---- LED PA.1 Toggle two Times ---
	mov		a, 0x02;
	mov		FlashCnt, a;
FPP1LockLoop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto	FPP1LockLoop
	set0	MCUCtrl.1;	// make FPP1 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.2;	// Enable FPP2 Demo Function
	goto	FPP1_ReBoot; // Wait FPP0 clear control flag
//========== end of MCU1 program ===========//
//--
//========== start of MCU2 program =========//
fpp2Boot:
	mov		a, 0x68 ;
	mov		sp, a ;		
	mov		a, 0x0f ;	// Enable FPP3!
	mov		fppen, a ;	
FPP2_ReBoot:	
	t1sn	MCUCtrl.2;
	goto	FPP2_ReBoot;
	//---- LED PA.1 Toggle three Times ---
	mov		a, 0x03;
	mov		FlashCnt, a;
FPP2LockLoop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto	FPP2LockLoop
	set0	MCUCtrl.2;	// make FPP2 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.3;	// Enable FPP3 Demo Function
	goto	FPP2_ReBoot; // Wait FPP1 clear control flag
//========== end of MCU2 program ===========//
//---
//========== start of MCU3 program =========//
fpp3Boot:
	mov		a, 0x6C ;
	mov		sp, a ;	
	mov		a, 0x1f ;	// Enable FPP4 !!
	mov		fppen, a ;	
FPP3_ReBoot:	
	t1sn	MCUCtrl.3;
	goto	FPP3_ReBoot;
	//---- LED PA.1 Toggle four Times ---
	mov		a, 0x04;
	mov		FlashCnt, a;
FPP3LockLoop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto	FPP3LockLoop
	set0	MCUCtrl.3;	// make FPP3 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.4;	// Enable FPP4 Demo Function
	goto	FPP3_ReBoot; // Wait FPP2 clear control flag
//========== end of MCU3 program ===========//
//--
//========== start of MCU4 program =========//
fpp4Boot:
	mov		a, 0x70 ;
	mov		sp, a ;	
	mov		a, 0x3f ;	// Enable FPP5 !!
	mov		fppen, a ;	
FPP4_ReBoot:	
	t1sn	MCUCtrl.4;
	goto	FPP4_ReBoot;
	//---- LED PA.1 Toggle five Times ---
	mov		a, 0x05;
	mov		FlashCnt, a;
FPP4LockLoop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto	FPP4LockLoop
	set0	MCUCtrl.4;	// make FPP4 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.5;	// Enable FPP5 Demo Function
	goto	FPP4_ReBoot; // Wait FPP3 clear control flag
//========== end of MCU4 program ===========//
//--
//========== start of MCU5 program =========//		
fpp5Boot:
	mov		a, 0x74 ;
	mov		sp, a ;	
	mov		a, 0x7f ;	// Enable FPP6 !!
	mov		fppen, a ;	
FPP5_ReBoot:	
	t1sn	MCUCtrl.5;
	goto	FPP5_ReBoot;
	//---- LED PA.1 Toggle six Times ---
	mov		a, 0x06;
	mov		FlashCnt, a;
FPP5LockLoop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto	FPP5LockLoop
	set0	MCUCtrl.5;	// make FPP5 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.6;	// Enable FPP6 Demo Function
	goto	FPP5_ReBoot; // Wait FPP4 clear control flag
//========== end of MCU5 program ===========//
//--
//========== start of MCU6 program =========//
fpp6Boot:
	mov		a, 0x78 ;
	mov		sp, a ;	
	mov		a, 0xff ;	// Enable FPP7, now all FPPx is running !!
	mov		fppen, a ;	
FPP6_ReBoot:	
	t1sn	MCUCtrl.6;
	goto	FPP6_ReBoot;
	//---- LED PA.1 Toggle seven Times ---
	mov		a, 0x07;
	mov		FlashCnt, a;
FPP6LockLoop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto	FPP6LockLoop
	set0	MCUCtrl.6;	// make FPP6 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.7;	// Enable FPP7 Demo Function
	goto	FPP6_ReBoot; // Wait FPP5 clear control flag
//========== end of MCU6 program ===========//
//--
//========== start of MCU7 program =========//
fpp7Boot:
	mov		a, 0x7C ;
	mov		sp, a ;	
FPP7_ReBoot:	
	t1sn	MCUCtrl.7;
	goto	FPP7_ReBoot;
	//---- LED PA.1 Toggle eight Times ---
	mov		a, 0x08;
	mov		FlashCnt, a;
FPP7LockLoop:
	set1	pa.1;
	call	DelayNoAcc;
	set0	pa.1;
	call	DelayNoAcc;
	dzsn	FlashCnt
	goto	FPP7LockLoop
	set0	MCUCtrl.7;	// make FPP7 Hang-up into a lock loop 
	call	delaySomemS;
	set1	MCUCtrl.0;	// Enable FPP0 Demo Function
	goto	FPP7_ReBoot; // Wait FPP6 clear control flag
//========== end of MCU7 program ===========//
//--
delaySomemS:                        // 
        mov     a, 0x28 ;
        mov     DT3, a ;
dloop6:        
		mov		a, 0x80 ;
        mov     DT2, a ;
dloop7:
        delay   0xCA ;
        dzsn    DT2 ;
        goto    dloop7 ;
        dzsn    DT3 ;
        goto    dloop6 ;
        ret	

DelayNoAcc:                  // 		
        clear   DT0;
NoAcc_loop6:        
        clear   DT1;
NoAcc_loop7:
        dzsn    DT1 ;			// 2*255 us = 510us + 2us = 512 us
        goto    NoAcc_loop7 ;	// 
        dzsn    DT0 ;			// 512 * (255*2us) + 2 us = 261.122 ms
        goto    NoAcc_loop6 ;
        ret	
        

⌨️ 快捷键说明

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