Example codes for ADuC842 CPU family

源代码在线查看: led.src

软件大小: 184 K
上传用户: whyzhao
关键词: Example family codes ADuC
下载地址: 免注册下载 普通下载 VIP

相关代码

				; .\LED.SRC generated from: LED.c
				; COMPILER INVOKED BY:
				;        D:\Programy\Elektronika\Keil\C51\BIN\C51.EXE LED.c OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND CODE LISTINCLUDE SYMBOLS PREPRINT SRC(.\LED.SRC)
				
				$NOMOD51
				
				NAME	LED
				
				ADCOFSL	DATA	0F1H
				P0	DATA	080H
				P1	DATA	090H
				P2	DATA	0A0H
				P3	DATA	0B0H
				AC	BIT	0D0H.6
				T0	BIT	0B0H.4
				T1	BIT	0B0H.5
				EA	BIT	0A8H.7
				T2	BIT	090H.0
				CAP2	BIT	0C8H.0
				I2CI	BIT	0E8H.0
				D0EN	BIT	0E8H.3
				D1EN	BIT	0E8H.6
				I2CADD	DATA	09BH
				SCONV	BIT	0D8H.4
				I2CM	BIT	0E8H.3
				EADC	BIT	0A8H.6
				IE	DATA	0A8H
				ADCI	BIT	0D8H.7
				EDATA1	DATA	0BCH
				TIMECON	DATA	0A1H
				T3FD	DATA	09DH
				EDATA2	DATA	0BDH
				EDATA3	DATA	0BEH
				DP	DATA	082H
				EDATA4	DATA	0BFH
				EXF2	BIT	0C8H.6
				RD	BIT	0B0H.7
				CNT2	BIT	0C8H.1
				PRE0	BIT	0C0H.4
				ES	BIT	0A8H.4
				PRE1	BIT	0C0H.5
				PADC	BIT	0B8H.6
				IP	DATA	0B8H
				I2CDAT	DATA	09AH
				PRE2	BIT	0C0H.6
				PRE3	BIT	0C0H.7
				RI	BIT	098H.0
				DMAH	DATA	0D3H
				T2LH	DATA	0CCH
				CY	BIT	0D0H.7
				INT0	BIT	0B0H.2
				CPHA	BIT	0F8H.2
				INT1	BIT	0B0H.3
				TI	BIT	098H.1
				EADR	DATA	0C6H
				DMAL	DATA	0D2H
				I2CCON	DATA	0E8H
				RCAP2H	DATA	0CBH
				PS	BIT	0B8H.4
				DMAP	DATA	0D4H
				SP	DATA	081H
				T2EX	BIT	090H.1
				OV	BIT	0D0H.2
				DCON	DATA	0E8H
				PWM0	DATA	0B1H
				SPR0	BIT	0F8H.0
				RCAP2L	DATA	0CAH
				ECON	DATA	0B9H
				PWM1	DATA	0B3H
				SPR1	BIT	0F8H.1
				WR	BIT	0B0H.6
				DACCON	DATA	0FDH
				RCLK	BIT	0C8H.5
				ADCDATAH	DATA	0DAH
				CPOL	BIT	0F8H.3
				TCLK	BIT	0C8H.4
				P00	BIT	080H.0
				P10	BIT	090H.0
				P01	BIT	080H.1
				ADCDATAL	DATA	0D9H
				SBUF	DATA	099H
				PCON	DATA	087H
				P20	BIT	0A0H.0
				P11	BIT	090H.1
				P02	BIT	080H.2
				ADCGAINH	DATA	0F4H
				ADCOFS	DATA	0F1H
				P30	BIT	0B0H.0
				P21	BIT	0A0H.1
				P12	BIT	090H.2
				P03	BIT	080H.3
				CHIPID	DATA	0C2H
				P31	BIT	0B0H.1
				P22	BIT	0A0H.2
				P13	BIT	090H.3
				P04	BIT	080H.4
				SCON	DATA	098H
				DSR_USB	BIT	0B0H.6
				P32	BIT	0B0H.2
				P23	BIT	0A0H.3
				P14	BIT	090H.4
				P05	BIT	080H.5
				TMOD	DATA	089H
				TCON	DATA	088H
				CTS_USB	BIT	0B0H.5
				WCOL	BIT	0F8H.6
				ISPI	BIT	0F8H.7
				P33	BIT	0B0H.3
				P24	BIT	0A0H.4
				P15	BIT	090H.5
				P06	BIT	080H.6
				ADCGAINL	DATA	0F3H
				WDIR	BIT	0C0H.3
				P34	BIT	0B0H.4
				P25	BIT	0A0H.5
				P16	BIT	090H.6
				P07	BIT	080H.7
				P35	BIT	0B0H.5
				P26	BIT	0A0H.6
				P17	BIT	090H.7
				P36	BIT	0B0H.6
				P27	BIT	0A0H.7
				SPIM	BIT	0F8H.4
				P37	BIT	0B0H.7
				I2CADD1	DATA	091H
				I2CADD2	DATA	092H
				I2CADD3	DATA	093H
				IE0	BIT	088H.1
				IE1	BIT	088H.3
				HOUR	DATA	0A5H
				DAC0H	DATA	0FAH
				B	DATA	0F0H
				HTHSEC	DATA	0A2H
				DAC1H	DATA	0FCH
				WDWR	BIT	0C0H.0
				DAC0L	DATA	0F9H
				CS0	BIT	0D8H.0
				DAC1L	DATA	0FBH
				CS1	BIT	0D8H.1
				SPIDAT	DATA	0F7H
				ACC	DATA	0E0H
				CS2	BIT	0D8H.2
				CS3	BIT	0D8H.3
				ET0	BIT	0A8H.1
				ET1	BIT	0A8H.3
				TF0	BIT	088H.5
				PLLCON	DATA	0D7H
				ET2	BIT	0A8H.5
				TF1	BIT	088H.7
				TF2	BIT	0C8H.7
				RB8	BIT	098H.2
				TH0	DATA	08CH
				EX0	BIT	0A8H.0
				IT0	BIT	088H.0
				TH1	DATA	08DH
				EX1	BIT	0A8H.2
				TB8	BIT	098H.3
				IT1	BIT	088H.2
				SPICON	DATA	0F8H
				TH2	DATA	0CDH
				P	BIT	0D0H.0
				SM0	BIT	098H.7
				INTVAL	DATA	0A6H
				TL0	DATA	08AH
				SM1	BIT	098H.6
				TL1	DATA	08BH
				DMA	BIT	0D8H.6
				SM2	BIT	098H.5
				PSMCON	DATA	0DFH
				TL2	DATA	0CCH
				PT0	BIT	0B8H.1
				LED	BIT	0B0H.7
				RS0	BIT	0D0H.3
				PT1	BIT	0B8H.3
				MDE	BIT	0E8H.6
				RS1	BIT	0D0H.4
				PT2	BIT	0B8H.5
				TR0	BIT	088H.4
				PWMCON	DATA	0AEH
				TR1	BIT	088H.6
				TR2	BIT	0C8H.2
				PX0	BIT	0B8H.0
				PX1	BIT	0B8H.2
				RCAP2	DATA	0CAH
				RxD_USB	BIT	090H.7
				MDI	BIT	0E8H.4
				IEIP2	DATA	0A9H
				ADCCON1	DATA	0EFH
				SEC	DATA	0A3H
				TxD_USB	BIT	0B0H.4
				ADCCON2	DATA	0D8H
				DPH	DATA	083H
				ADCCON3	DATA	0F5H
				MCO	BIT	0E8H.5
				MDO	BIT	0E8H.7
				WDE	BIT	0C0H.1
				DPL	DATA	082H
				ADXL_Y	BIT	090H.4
				EXEN2	BIT	0C8H.3
				I2CRS	BIT	0E8H.2
				ADCDATA	DATA	0D9H
				MIN	DATA	0A4H
				DPP	DATA	084H
				REN	BIT	098H.4
				EADRH	DATA	0C7H
				TEM	BIT	0A0H.0
				DMALH	DATA	0D2H
				T2CON	DATA	0C8H
				SPE	BIT	0F8H.5
				T3CON	DATA	09EH
				ADCGAIN	DATA	0F3H
				EADRL	DATA	0C6H
				I2CTX	BIT	0E8H.1
				SPH	DATA	0B7H
				PSI	BIT	0B8H.7
				PWM0H	DATA	0B2H
				WDS	BIT	0C0H.2
				RXD	BIT	0B0H.0
				PWM1H	DATA	0B4H
				CFG842	DATA	0AFH
				TXD	BIT	0B0H.1
				PWM0L	DATA	0B1H
				PWM1L	DATA	0B3H
				D0	BIT	0E8H.5
				D1	BIT	0E8H.7
				F0	BIT	0D0H.5
				DPCON	DATA	0A7H
				F1	BIT	0D0H.1
				DAC0	DATA	0F9H
				DAC1	DATA	0FBH
				CCONV	BIT	0D8H.5
				ADCOFSH	DATA	0F2H
				PSW	DATA	0D0H
				WDCON	DATA	0C0H
				?PR?_delay?LED       SEGMENT CODE 
				?DT?_delay?LED       SEGMENT DATA OVERLAYABLE 
				?PR?main?LED         SEGMENT CODE 
				?C_INITSEG           SEGMENT CODE 
				?DT?LED              SEGMENT DATA 
					EXTRN	CODE (_SendByte)
					EXTRN	CODE (ReadByte)
					EXTRN	CODE (_DelayUs)
					EXTRN	CODE (DelayUs2)
					EXTRN	CODE (?C_STARTUP)
					PUBLIC	s_data
					PUBLIC	i
					PUBLIC	c?
					PUBLIC	napis
					PUBLIC	main
					PUBLIC	_delay
				
					RSEG  ?DT?_delay?LED
				?_delay?BYTE:
				     length?040:   DS   2
				
					RSEG  ?DT?LED
				          napis:   DS   22
				             c?:   DS   1
				              i:   DS   2
				         s_data:   DS   2
				
					RSEG  ?C_INITSEG
					DB	016H
					DB	napis
					DB  ' ' ,'S' ,'p' ,'u' ,'k' ,'i' ,' ' ,'j' ,'e' ,'s' 
					DB  't' ,' ' ,'d' ,'e' ,'b' ,'e' ,09CH,'c' ,'i' ,'a' 
					DB  'k' ,' ' 
				
				
					DB	002H
					DB	i
					DW	00000H
				
					DB	002H
					DB	s_data
					DW	00000H
				
					DB	001H
					DB	c?
					DB	000H
				
				; //#include 
				; #include 
				; #include 
				; 
				; 
				; sbit TEM = P2^0;
				; sbit ADXL_Y = P1^4;
				; 
				; unsigned char napis[22] = " Spuki jest debe渃iak ";
				; 
				; 
				; signed int i=0;
				; signed int s_data=0;
				; unsigned char c=0;
				; 
				; 
				; void delay(unsigned int length) { 
				
					RSEG  ?PR?_delay?LED
				_delay:
					USING	0
							; SOURCE LINE # 17
					MOV  	length?040,R6
					MOV  	length?040+01H,R7
				?C0001:
				; 	while (length!=0) {
							; SOURCE LINE # 18
					MOV  	A,length?040+01H
					ORL  	A,length?040
					JZ   	?C0004
				; 		i = ReadByte();
							; SOURCE LINE # 19
					LCALL	ReadByte
					MOV  	i,R6
					MOV  	i+01H,R7
				; 		if (i>=0) c = i&0xFF;
							; SOURCE LINE # 20
					CLR  	C
					MOV  	A,i
					XRL  	A,#080H
					SUBB 	A,#080H
					JC   	?C0003
					MOV  	A,R7
					MOV  	c?,A
				?C0003:
				; 		length--;
							; SOURCE LINE # 21
					MOV  	A,length?040+01H
					DEC  	length?040+01H
					JNZ  	?C0001
					DEC  	length?040
				?C0008:
				; 	}
							; SOURCE LINE # 22
					SJMP 	?C0001
				; }
							; SOURCE LINE # 23
				?C0004:
					RET  	
				; END OF _delay
				
				; 
				; 
				; //void delayms(unsigned char length) { while (length!=0) length--; }
				; /*
				; void Timer2_Int () interrupt 5
				; {
				; 	LED = !LED;
				; 	TF2 = 0;
				; }
				; */
				; 
				; 
				; void main (void)
				
					RSEG  ?PR?main?LED
				main:
					USING	0
							; SOURCE LINE # 36
				; {	
							; SOURCE LINE # 37
				; 	DelayUs(0x01); DelayUs2();
							; SOURCE LINE # 38
					MOV  	R7,#01H
					LCALL	_DelayUs
					LCALL	DelayUs2
				; 	TxD_USB = 1; // Wysoki stan na linii nadawczej
							; SOURCE LINE # 39
					SETB 	TxD_USB
				; 	P1 = 11101111; // Port P1.4 jako Analog Input;
							; SOURCE LINE # 40
					MOV  	P1,#0B7H
				; 	PLLCON = 0x01; //PLL Clock config
							; SOURCE LINE # 41
					MOV  	PLLCON,#01H
				; 
				; 	//Timer2 config
				; //    ET2 = 1;
				; //   	TH2 = 0x00;	TL2 = 0x00; 
				; //	RCAP2H = 0xF0; RCAP2L = 0x00;
				;     EA = 0;
							; SOURCE LINE # 47
					CLR  	EA
				; //	T2CON = 0x04;
				;  	napis[0] = 0xFF;
							; SOURCE LINE # 49
					MOV  	napis,#0FFH
				; 	napis[21] = 0x00;
							; SOURCE LINE # 50
					CLR  	A
					MOV  	napis+015H,A
				?C0005:
				; 
				; 	while(1) {
							; SOURCE LINE # 52
				; 		s_data = c;
							; SOURCE LINE # 53
					MOV  	s_data,#00H
					MOV  	s_data+01H,c?
				; 		SendByte(s_data >> 8);
							; SOURCE LINE # 54
					MOV  	A,s_data
					MOV  	R7,A
					RLC  	A
					SUBB 	A,ACC
					LCALL	_SendByte
				; 		SendByte(c);
							; SOURCE LINE # 55
					MOV  	R7,c?
					LCALL	_SendByte
				; 		SendByte(P0);
							; SOURCE LINE # 56
					MOV  	R7,P0
					LCALL	_SendByte
				; 		SendByte(P1);
							; SOURCE LINE # 57
					MOV  	R7,P1
					LCALL	_SendByte
				; 		SendByte(P2);
							; SOURCE LINE # 58
					MOV  	R7,P2
					LCALL	_SendByte
				; 		SendByte(P3);
							; SOURCE LINE # 59
					MOV  	R7,P3
					LCALL	_SendByte
				; 		delay(0x03FF);
							; SOURCE LINE # 60
					MOV  	R7,#0FFH
					MOV  	R6,#03H
					LCALL	_delay
				; 	}
							; SOURCE LINE # 61
					SJMP 	?C0005
				; END OF main
				
					END
							

相关资源