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

📄 moto.lst

📁 电机驱动!四相五线的步进电机用C8051F020驱动
💻 LST
字号:
C51 COMPILER V7.50   MOTO                                                                  04/10/2009 16:31:46 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE MOTO
OBJECT MODULE PLACED IN moto.OBJ
COMPILER INVOKED BY: D:\Program Files\KEIL\C51\BIN\C51.EXE moto.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <C8051F020.H>
   2          #include <absacc.h>
   3          #include <intrins.h>
   4          #include<string.h>
   5          #define uchar unsigned char
   6          #define uint  unsigned int
   7          
   8          #define BAUDRATE     9600            // Baud rate of UART in bps
   9          #define SYSCLK       22118400          // SYSCLK frequency in Hz
  10          
  11          
  12          
  13          uchar code moto_rd[8]={0x8,0xc,0x4,0x6,0x2,0x3,0x1,0x9,}; 
  14          //uchar code moto_rd[8]={0xc,0xc,0x6,0x6,0x3,0x3,0x9,0x9,}; 
  15          //uchar code moto_rd[8]={0x3,0x3,0x6,0x6,0xc,0xC,0x9,0x9,};
  16          uchar mty;
  17          
  18          
  19          void SYSCLK_Init (void)
  20          {
  21   1         int i;                              // delay counter
  22   1      
  23   1         OSCXCN = 0x67;                      // start external oscillator with
  24   1                                             // 22.1184MHz crystal
  25   1      
  26   1         for (i=0; i < 256; i++) ;           // XTLVLD blanking interval (>1ms)
  27   1         
  28   1         while (!(OSCXCN & 0x80)) ;          // Wait for crystal osc. to settle
  29   1      
  30   1         OSCICN = 0x88;                      // select external oscillator as SYSCLK
  31   1                                             // source and enable missing clock
  32   1                                             // detector
  33   1              
  34   1                                                                                               
  35   1              
  36   1      }
  37          
  38          
  39          void xspdelay(unsigned int x)
  40          {
  41   1      while(x--){}
  42   1      }
  43          
  44          void mb_moto_y(bit fx,unsigned int i)
  45          {
  46   1         unsigned int ii;
  47   1         unsigned char mt;
  48   1      
  49   1         mt=moto_rd[mty]<<4;
  50   1         P6=mt;
  51   1         xspdelay(1000);
  52   1         for (ii=0;ii<i;ii++)
  53   1         {
  54   2           if(fx==1) mty=(mty+1)&0x07;
  55   2               else mty=(mty-1)&0x07;
C51 COMPILER V7.50   MOTO                                                                  04/10/2009 16:31:46 PAGE 2   

  56   2           mt=moto_rd[mty]<<4;         
  57   2               P6=mt;
  58   2           
  59   2           xspdelay(1000);
  60   2           
  61   2         }
  62   1      
  63   1         
  64   1      }   
  65          
  66          void main()
  67          {      
  68   1             WDTCN = 0xde;                       // disable watchdog timer
  69   1             WDTCN = 0xad;
  70   1                       
  71   1                
  72   1             SYSCLK_Init ();
  73   1      
  74   1                 P74OUT |= 0x30;
  75   1                 P6=0;
  76   1                  
  77   1                 mb_moto_y(1,500);
  78   1                 while(1)
  79   1                 {
  80   2      //         mb_moto_y(0,500);
  81   2                
  82   2      
  83   2                 P6=0;
  84   2                 }
  85   1                
  86   1      }
  87          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    125    ----
   CONSTANT SIZE    =      8    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      1       2
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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