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

📄 main.lst

📁 at89c51+isp1581控制程序(c语言源代码).包含快速模式和高速模式
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V6.20c  MAIN                                                                  05/19/2003 01:05:03 PAGE 1   


C51 COMPILER V6.20c, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN Main.OBJ
COMPILER INVOKED BY: E:\WIN98\HARDWARE\KEILC\C51\BIN\C51.EXE Main.c DB OE SMALL ROM(LARGE) 

stmt level    source

   1          
   2          #include "HAL.H"
   3          //#include "USBD12.H"
   4          #include "SMPro.H"
   5          //#include "USB110.H"
   6          #include "USB.H"
   7          #include "CHAP9.H"
   8          #include "VDOR.H"
   9          #include "Isp1581.h"
  10          #include "main.h"
  11          #include "Hal4sys.h"
  12          #include "Iso.h"
  13          
  14          GLOBE_VARIABLE globe_variable;
  15          ///////////////////////////////////
  16          // Data definition
  17          extern unsigned long lClockTicks;
  18          ZBOARDFLAGS bdata bZBoardFlags;
  19          extern CONTROL_XFER ControlData;
  20          //extern CODE_DATA idata CodeData;
  21          IO_REQUEST idata ioRequest;
  22          extern unsigned char idata last_key;
  23          
  24          void Init_Timer0(void)
  25          {
  26   1      	TMOD &= 0xF0;                   /* clear Timer 0      */
  27   1      	TMOD  |= 0x1;
  28   1      	TL0 = 0x0;                   	/* value set by user  */
  29   1      	TH0 = 0x0;                  	/* value set by user  */
  30   1      	ET0 = 1;     		  	/* IE.1*/
  31   1      	TR0 = 1;                	/* TCON.4 start timer */
  32   1      //	PT0 = 1;
  33   1      }
  34          
  35          
  36          void Init_Port()
  37          {
  38   1      	P0 = 0xFF;
  39   1      	P1 = 0xFF;
  40   1      	P2 = 0xFF;
  41   1      	P3 = 0xFF;
  42   1      }
  43          
  44          
  45          /*------------------------------------------------
  46          The main C function.  Program execution starts
  47          here after stack initialization.
  48          ------------------------------------------------*/
  49          void main (void)
  50          {
  51   1      unsigned short temp2;
  52   1      	////////////////////////////////////////////////
  53   1      	bZBoardFlags.bits.At_IRQL1 =1;
  54   1      	////////////////////////////////////////////////
  55   1      	Init_Timer0();
C51 COMPILER V6.20c  MAIN                                                                  05/19/2003 01:05:03 PAGE 2   

  56   1      	Init_Port();
  57   1      	temp2=ISP1581_ReadChipID();  //1581
  58   1      	////////////////////////////////////////
  59   1      	last_key=0x3;
  60   1      
  61   1      	LED_STATUS=1;
  62   1      	MCU_LED0 = 0;
  63   1      	MCU_LED1 = 0;
  64   1      	/////////////////////////////////////////////////////
  65   1      	bZBoardFlags.bits.At_IRQL1 =0;
  66   1      	/////////////////////////////////////////////////////
  67   1      	ISP1581_ResetDevice();
  68   1      	EX0=1;
  69   1      	
  70   1      	Device_Initiate();
  71   1      	ENABLE_INTERRUPTS;
  72   1      
  73   1      	/* Main program loop */
  74   1      	while(TRUE)
  75   1      	{
  76   2      		
  77   2      		if (bZBoardFlags.bits.bTimer){
  78   3      			DISABLE_INTERRUPTS;
  79   3      			bZBoardFlags.bits.bTimer = 0;
  80   3      			ENABLE_INTERRUPTS;
  81   3      
  82   3      			if(bZBoardFlags.bits.bConfiguration)
  83   3      				check_key_LED();
  84   3      		}
  85   2      							
  86   2      		if (bZBoardFlags.bits.bBus_Reset)
  87   2      		{
  88   3      			DISABLE_INTERRUPTS;
  89   3      			bZBoardFlags.bits.bBus_Reset = 0;
  90   3      			ENABLE_INTERRUPTS;
  91   3      			Isr_BusReset();
  92   3      		} // if bus reset
  93   2      		if (bZBoardFlags.bits.DCP_state == USBFSM4DCP_REQUESTPROC && bZBoardFlags.bits.CONTROL_HANDLE_DONE == 1 
             -)
  94   2      		{
  95   3      			RaiseIRQL();
  96   3      			bZBoardFlags.bits.CONTROL_HANDLE_DONE = 0;
  97   3      			DeviceRequest_Handler();
  98   3      			LowerIRQL();
  99   3      		} /* if setup_packet for DeviceRequest*/
 100   2      		if (bZBoardFlags.bits.setup_dma == 1 && (bZBoardFlags.bits.dma_state == DMA_IDLE))
 101   2      		{
 102   3      			RaiseIRQL();
 103   3      			bZBoardFlags.bits.setup_dma = 0;
 104   3      			setup_dma();
 105   3      			LowerIRQL();
 106   3      		} // if setup_dma
 107   2      		if (bZBoardFlags.bits.DCP_state == USBFSM4DCP_CONTROLOUTDONE)
 108   2      		{
 109   3      			Chap9_ControlWriteHandshake();
 110   3      		}
 111   2      		
 112   2      		if (bZBoardFlags.bits.ISO_CONFIG)
 113   2      		{
 114   3      			bZBoardFlags.bits.ISO_CONFIG = 0;
 115   3      			ISO_CONFIG();
 116   3      		}
C51 COMPILER V6.20c  MAIN                                                                  05/19/2003 01:05:03 PAGE 3   

 117   2      
 118   2      	} // Main Loop
 119   1      
 120   1      }
 121          
 122          
 123          /////////////////////////////////////////////////
 124          
 125          void ISP1581_Initiate(void)
 126          {
 127   1      	//adress reg: 0x00
 128   1      	ISP1581_SetAddressEnable(0x0, 0x01); // set address to 0 and enable it.
 129   1      	ISP1581_SetTestMode(0); // clear test mode
 130   1      	
 131   1      	ISP1581_SetMode(/* mode_clkaon*/mode_glintena|mode_softct);
 132   1      //					|mode_wkupcs
 133   1      //					|mode_pwroff
 134   1      //					|mode_softct
 135   1      //					|mode_clkaon
 136   1      //					);
 137   1      	ISP1581_SetIntConfig(0x0
 138   1      				|intcfg_cdbgmod_as	// control interrupt on ack and stall
 139   1      				|intcfg_ddbgmodin_a	// IN data interrupt on ack only
 140   1      				|intcfg_ddbgmodout_asy	// OUT data on ack and stall and nyet intertupt
 141   1      				//|intcfg_polh);   // level interrupt and active high
 142   1      //				|intcfg_edgetrig
 143   1      					);
 144   1      	ISP1581_SetIntEnableLow(int_busreset|int_susp|int_resume
 145   1      				|int_hs_stat|int_dma|int_ep0set
 146   1      				|int_ep0rx|int_ep0tx
 147   1      				|int_ep1rx|int_ep1tx
 148   1      				|int_ep2rx|int_ep2tx);
 149   1      	ISP1581_SetIntEnableHigh(int_ep3rx|int_ep3tx
 150   1      				|int_ep4rx|int_ep4tx
 151   1      				|int_ep5rx|int_ep5tx
 152   1      				|int_ep6rx|int_ep6tx
 153   1      				|int_ep7rx|int_ep7tx);
 154   1      	ISP1581_ConfigEndpoint();		// default config as a full speed device
 155   1      	//-------------xxg-----------------
 156   1      	// dma config: 0x38
 157   1      	ISP1581_SetDMAConfig(dmacfg_width8|dmacfg_modediorw/*|dmacfg_modediorack*/|dmacfg_burst0);
 158   1      	// dma hardware:0x3c
 159   1      	ISP1581_SetDMAHDCfg(dmahd_dreqpolh/*|dmahd_dackpolh*/|dmahd_eotpolh/*|dmahd_readpolh|dmahd_writepolh*/);
 160   1      	
 161   1      }
 162          
 163          
 164          void ISP1581_ConfigEndpoint(void)
 165          {
 166   1      	
 167   1      	// disable all endpoint firsr;
 168   1      	ISP1581_SetEndpointConfig(EPINDEX4EP01OUT, 0);

⌨️ 快捷键说明

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