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

📄 pwm841.lst

📁 关于aduc841单片机的一些实用入门程序
💻 LST
字号:
C51 COMPILER V5.50,  PWM841                                                                20/10/03  09:04:48  PAGE 1   


DOS C51 COMPILER V5.50, COMPILATION OF MODULE PWM841
OBJECT MODULE PLACED IN PWM841.OBJ
COMPILER INVOKED BY: C:\ADUC\BIN\C51.EXE PWM841.C DB

stmt level    source

   1          //pwm841.c
   2          /*
   3          Author: Eckart Hartmann Date:15/10/2003
   4          Description of Software: 
   5          	This program demonstrates the PWM functions 
   6          	<A HREF="/mcc/softw/841/pwm/Pwm841Cfg.html">PwmCfg()</A>,<A HREF="/mcc/softw/841/pwm/Pwm841W16.html">PwmW
             -16()</A>, <A HREF="/mcc/softw/841/pwm/Pwm841W8.html">PwmW8()</A>.
   7          Development progress: <A HREF="/mcc/softw/834/pwm/Pwm834Df.html">pwm834.df</A>.
   8          */
   9          #include"..\kei841.h"	//;<A HREF="/mcc/softw/841/Kei841Sfr.html">SFR definition file</A>.
  10          #include"..\lib841.h"	//;<A HREF="/mcc/softw/841/Lib841H.html">Function and variable declaration file</A>.
  11          #include<stdio.h>	//"stdio.h"
  12          #include<ctype.h>	//"ctype.h"
  13          
  14          	unsigned int uPwm;
  15          
  16          //Use T1 interupt to ramp uPwm at constant rate.
  17          void t0int(void) interrupt 1 using 0
  18          	{
  19   1      	uPwm += 4;
  20   1      	P34 = !P34;
  21   1      	}
  22          
  23          void t1int(void) interrupt 3 using 0
  24          	{
  25   1      	uPwm += 4;
  26   1      	P34 = !P34;
  27   1      	}
  28          
  29          void main(void)
  30          	{
  31   1      	unsigned int u1;
  32   1      	double	dY;	//Factor to liniarize PWM in NRZ mode.
  33   1      
  34   1      	PwmW8(0,0,0);
  35   1      	uPwm = 16000;
  36   1      	TH0 = 10;
  37   1      	TL0 = 10;
  38   1              TMOD |= 0x2;	//T0 reload.
  39   1              TR0 = 1;	//Start T0.
  40   1              IE = 0x82;	//Enable T0 interupt.
  41   1      /*	TH1 = 40;
  42   1      	TL1 = 40;
  43   1              TMOD |= 0x20;	//T1 reload.
  44   1              TR1 = 1;	//Start T1.
  45   1              IE = 0x88;	//Enable T1 interupt.
  46   1      */	UrtCfg(0x02,-72);	//<A HREF="/mcc/softw/841/urt/Urt841Cfg.html">UrtCfg</A> configures UART.
  47   1      
  48   1      	printf("\n\nADuC841 PWM Demonstration Program\n");
  49   1      	printf("=======================================\n");
  50   1      	printf("Connect 10k resistor from P2.6 (PWM out)\n");
  51   1      	printf("via 100nF to ground. Connect oscilloscope\n");
  52   1      	printf("accross capacitor. Repeat for P2.7.\n");
  53   1      	printf("Oscilloscope will show slow ramps.\n");
  54   1      	
  55   1          	dY = 0.001;	//Typical value.
  56   1          	PwmCfg(0x067);	//Dual RZ sigma delta at fosc/4.
  57   1      	
  58   1      	while(1)
C51 COMPILER V5.50,  PWM841                                                                20/10/03  09:04:48  PAGE 2   

  59   1      		{
  60   2      	        u1 = uPwm-(int)((uPwm-0x8000)*dY);
  61   2            		if(uPwm<0x8000)	u1 = uPwm;
  62   2      		PwmW16(1,u1);	//Corrected.
  63   2            		PwmW16(0,uPwm);	//Plain.
  64   2      //      		PwmW16(1,uPwm);	//Plain.
  65   2      	}	}
  66          	


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    229    ----
   CONSTANT SIZE    =    236    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      4       6
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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