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

📄 pdk82c13_basic.asm

📁 使用應廣PDK82C13 來實現8顆CPU的處理
💻 ASM
字号:
//
// File Name:PDK82C13_IPRO_V1.1.asm
//-----------------------------------------------------------------------
// Project Name: PDK82C13 3-CH Remote Control
// Module Name: IPRO Remote Control
//-----------------------------------------------------------------------
//
// Company:Semiconductor Device Solution, Inc 
//         http://www.sdsi.com.tw/
//
// Engineer: Owen Chen
// Create Date: 14:30:00 12/07/2007 
// Revision: 1.01
//
// Description: 
//              1). 3-CH: CH1-Analog
//                        CH2-Analog
//                        CH3-Digital
//              2). Generate 3-Channel PPM Signal
//              3). Use two Internal MCU(FPPA0 & FPPA1)
//              
//                                           
// 
// Target Devcies: PADAUK PDK82C13 
//
// Tool Chain: Assembly
// Copyright Semiconductor Device Solution, Inc .All Rights Reserved
//
//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
//CHIP define
//-----------------------------------------------------------------------
//.CHIP	PDK82C13	//Standard
.CHIP	PDK82S_EV	//ICE

//-----------------------------------------------------------------------
//RAM Define	(0xc0/192byte)(0x100/256byte)
//-----------------------------------------------------------------------
		word	RAM_TempW;
		byte	RAM_TempB;
		byte	Delay_1B;
		byte	Delay_2B;



//-----------------------------------------------------------------------
//Register bit flag definition
//-----------------------------------------------------------------------
		//Definition for flag register
		Z	equ	 flag.0
		C	equ	 flag.1
//		AC	equ	 flag.2
//		OV	equ	 flag.3


		
//-----------------------------------------------------------------------
//I/O PIN Name Define
//-----------------------------------------------------------------------		
		
               ADC_CH1         EQU      PB.0;   // Analog Input: CH1 ADC Input without Pull-up resistor
	       ADC_CH2         EQU      PB.1;   // Analog Input: CH2 ADC Input without Pull-up resistor
	       CH3             EQU      PB.2;   // Digutal Input: CH3 digital input with Pull-up resistor
 		
//-----------------------------------------------------------------------
//Constant value definition
//-----------------------------------------------------------------------
		RAM_SIZE	equ	0xff;	//Define as 256 byte RAM size





//-----------------------------------------------------------------------
//Program Begin
//-----------------------------------------------------------------------
	goto	FPPA0_BOOT;
	goto	FPPA1_BOOT;
	goto	FPPA2_BOOT;
	goto	FPPA3_BOOT;
	goto	FPPA4_BOOT;
	goto	FPPA5_BOOT;
	goto	FPPA6_BOOT;
	goto	FPPA7_BOOT;


//-----------------------------------------------------------------------
//Interrupt service area
//-----------------------------------------------------------------------	
.romadr	0x10
interrupt:
	reti

//-----------------------------------------------------------------------
//All system initial
//-----------------------------------------------------------------------
FPPA0_BOOT:
  	  		set0	clkmd.1;	// turn-off watchdog
			mov	a, 0x00;
			mov	inten,a;	// Disable all interrupt
	//---------------------------------------------------------------
	//system clock initial
	//---------------------------------------------------------------
			mov	a, 0x00;	// Internal RC use
			//mov	a, 0xD0;	// 11010000b
			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
						// bit-7:1=Enable external RC oscillator or crystal oscillator
						//	 0=Disable external RC oscillator or crystal oscillator
						// external 20MHz need delay 1m/S
    			delay	0xFF;		// internal 32KHz need delay 30m/S  
    			delay	0xFF;
    			delay	0xFF;
    			delay	0xFF;

			mov	a, 0x14;	// select internal High RC and make low RC still run, too !
			//mov	a, 0xB4   	// 10110100b
			mov	clkmd, a; 	// Internal Low RC, Watch Dog disable,
						// bit-0:0=PA5 1=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)
    			delay	0x40;
 
	//------------------------------------------------------------------
	//I/O pin initial
	//------------------------------------------------------------------
			//Port A initial	//pa.5 Input only
			mov	a, 0xff;
			mov	pac, a;		//Set pa output
			mov	pbc, a;
			mov	pcc, a;
			mov	pdc, a;
			mov	pec, a;
			mov	pfc, a;
			mov	pgc, a;
			mov	phc, a;
			mov	pic, a;
			//Port A initial	//pa.5 Input only
			mov	a, 0x00;
			mov	pa, a;
			mov	paph, a;
			mov	paod, a;
			//Port B/AD initial
			//mov	a, 0x00;
			mov	pb, a;
			mov	pbph, a;
			mov	pbod, a;
			mov	adcdi, a;		//0:Port B digital input.	//1:Port B Analog input.
			//Port C initial
			//mov	a, 0x00;
			mov	pc, a;
			mov	pcph, a;
			mov	pcod, a;
			//Port D initial
			//mov	a, 0x00;
			mov	pd, a;
			mov	pdph, a;
			mov	pdod, a;
			//Port E initial
			//mov	a, 0x00;
			mov	pe, a;
			mov	peph, a;
			mov	peod, a;
			//Port F initial
			//mov	a, 0x00;
			mov	pf, a;
			mov	pfph, a;
			//mov	pfod, a;	//PDK82C series no support (no address)
			//Port G initial
			//mov	a, 0x00;
			mov	pg, a;
			mov	pgph, a;
			//mov	pgod, a;	//PDK82C series no support (no address)
			//Port H initial
			//mov	a, 0x00;
			mov	ph, a;
			mov	phph, a;
			//mov	phod, a;	//PDK82C series no support (no address)
			//Port C initial
			//mov	a, 0x00;
			mov	pi, a;
			mov	piph, a;
			//mov	piod, a;	//PDK82C series no support (no address)

//-----------------------------------------------------------------------
//Interrupt Initial
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
//Timer Initial
//-----------------------------------------------------------------------



//-----------------------------------------------------------------------
//FPPA speed setup
//-----------------------------------------------------------------------
			//pmode	2 ;		// Set FPP time share = /16,/2,/8,/16,/16,/16,/16,/16
     			//pmode	1 ;		// Set FPP time share = /4,/4,/8,/8,/16,/16,/16,/16
     			pmode	29;		// Set FPP time share = /16,/2,/8,/16,/16,/16,/16,/16

//-----------------------------------------------------------------------
//Clear Internal RAM
//-----------------------------------------------------------------------
			mov	a,RAM_SIZE;	
			mov	lb@RAM_TempW,a; 	
			mov	a,0x00;
			mov	hb@RAM_TempW,a;
_CLEAR_RAM_LOOP:
			idxm	RAM_TempW,a;
			dzsn	lb@RAM_TempW;	
			goto	_CLEAR_RAM_LOOP;


			mov	a, 0x01;
			mov	fppen, a;

//-----------------------------------------------------------------------
//FPPA0 Program area
//-----------------------------------------------------------------------
			mov	a, 0xa0;
			mov	sp, a;
FPPA0_PROG:
			mov	a, 0xff;
			mov	RAM_TempB, a;
			call	Delay_1Sec;
			mov	a, 0xff;
			mov	pa, a;
			mov	pb, a;
			mov	pc, a;
			mov	pd, a;
			mov	pe, a;
			mov	pf, a;
			mov	pg, a;
			mov	ph, a;
			mov	pi, a;
			//call	Delay_1Sec;
			//mov	a, 0x00;
			mov	pa, a;
			mov	pb, a;
			mov	pc, a;
			mov	pd, a;
			mov	pe, a;
			mov	pf, a;
			mov	pg, a;
			mov	ph, a;
			mov	pi, a;
			goto	FPPA0_PROG;

//-----------------------------------------------------------------------
//FPPA1 Program area
//-----------------------------------------------------------------------
FPPA1_BOOT:
			mov	a, 0xa4;
			mov	sp, a;
FPPA1_PROG:
			
			goto	FPPA1_PROG;
	
//-----------------------------------------------------------------------
//FPPA2 Program area
//-----------------------------------------------------------------------
FPPA2_BOOT:
			mov	a, 0xa8;
			mov	sp, a;
FPPA2_PROG:

			goto	FPPA2_PROG;

//-----------------------------------------------------------------------
//FPPA3 Program area
//-----------------------------------------------------------------------
FPPA3_BOOT:
			mov	a, 0xac;
			mov	sp, a;
FPPA3_PROG:

			goto	FPPA3_PROG;

//-----------------------------------------------------------------------
//FPPA4 Program area
//-----------------------------------------------------------------------
FPPA4_BOOT:
			mov	a, 0xb0;
			mov	sp, a;
FPPA4_PROG:

			goto	FPPA4_PROG;

//-----------------------------------------------------------------------
//FPPA5 Program area
//-----------------------------------------------------------------------
FPPA5_BOOT:
			mov	a, 0xb4;
			mov	sp, a;
FPPA5_PROG:

			goto	FPPA5_PROG;

//-----------------------------------------------------------------------
//FPPA6 Program area
//-----------------------------------------------------------------------
FPPA6_BOOT:
			mov	a, 0xb8;
			mov	sp, a;
FPPA6_PROG:

			goto	FPPA6_PROG;

//-----------------------------------------------------------------------
//FPPA7 Program area
//-----------------------------------------------------------------------
FPPA7_BOOT:
			mov	a, 0xbc;
			mov	sp, a;
FPPA7_PROG:

			goto	FPPA7_PROG;

//-----------------------------------------------------------------------
//Marco area
//-----------------------------------------------------------------------
Delay_1Sec:
			mov	a, 0xff;
			mov	Delay_1B, a;
			mov	a, 0x01;
			mov	Delay_2B, a;
	Delay_1Sec_1:
			dzsn	Delay_2B;
			goto	Delay_1Sec_1;
			dzsn	Delay_1B;
			goto	Delay_1Sec_1;
			ret

⌨️ 快捷键说明

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