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

📄 usb_i2ci.lst

📁 soome examples of I2C transfer
💻 LST
字号:
C51 COMPILER V6.14  USB_I2CI                                                               04/03/2003 11:25:17 PAGE 1   


C51 COMPILER V6.14, COMPILATION OF MODULE USB_I2CI
OBJECT MODULE PLACED IN .\USB_I2CI.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\USB_I2CI\USB_I2CI.C DEBUG OBJECTEXTEND PRINT(.\USB_I2CI.lst) OBJECT(.\US
                    -B_I2CI.obj) 

stmt level    source

   1          #pragma NOIV					
   2          #include <ezusb.h>
   3          #include <ezregs.h>
   4          #include <fx.h>
   5          
   6          #define DIP_ADDR		0x20
   7          #define LED_ADDR		0x21
   8          
   9          extern BOOL	GotSUD;			// Received setup data flag
  10          extern BOOL	Sleep;
  11          extern BOOL	Rwuen;
  12          extern BOOL	Selfpwr;
  13          //+++++++++++++++++
  14          #define P0  			OUTA
  15          #define P1	        	OUTB
  16          #define P2			    OUTD
  17          //+++++++++++++++++
  18          
  19          BYTE	Configuration;		// Current configuration
  20          BYTE	AlternateSetting;	// Alternate settings
  21          BYTE    suspCount;
  22          
  23          code unsigned char Digit[]={0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, 0x88, 0x83, 0xc6, 
             -0xa1, 0x86, 0x8e };
  24          BYTE xdata *Dipswitch;
  25          
  26          BYTE num1,num2;  
  27          
  28          BYTE InReportBytes;
  29          void *dscr_ptr;
  30          
  31          void DELAY(unsigned int value) //10us 
  32          {
  33   1       while (value!=0) value--;
  34   1      }
  35          
  36          void TD_Init(void) 				// Called once at startup
  37          {
  38   1             	PORTACFG = 0x00;
  39   1          	OEA = 0xFF;
  40   1      
  41   1          	IN07VAL |= bmEP2 ;
  42   1      	    OUT07VAL |= bmEP2;
  43   1      
  44   1              OUT07IEN |= bmEP2;
  45   1              IN07IEN |= bmEP2;
  46   1      
  47   1              EZUSB_InitI2C();
  48   1              suspCount = 1;
  49   1              OEA = 0xFF;
  50   1              Rwuen = TRUE;				// Enable remote-wakeup
  51   1      }
  52          
  53          void TD_Poll(void) 				// Called repeatedly while the device is idle
C51 COMPILER V6.14  USB_I2CI                                                               04/03/2003 11:25:17 PAGE 2   

  54          {
  55   1      
  56   1           EZUSB_ReadI2C(DIP_ADDR,0x01,&Dipswitch[0]);
  57   1         	 num2=Dipswitch[0];
  58   1      }
  59          
  60          BOOL TD_Suspend(void) 			// Called before the device goes into suspend mode
  61          {
  62   1      	return(TRUE);
  63   1      }
  64          
  65          BOOL TD_Resume(void) 			// Called after the device resumes
  66          {
  67   1      	return(TRUE);
  68   1      }
  69          
  70          BOOL DR_GetDescriptor(void)
  71          {
  72   1      	return(TRUE);
  73   1      }
  74          
  75          BOOL DR_SetConfiguration(void)	// Called when a Set Configuration command is received
  76          {
  77   1      	Configuration = SETUPDAT[2];
  78   1      	return(TRUE);				// Handled by user code
  79   1      }
  80          
  81          BOOL DR_GetConfiguration(void)	// Called when a Get Configuration command is received
  82          {
  83   1      	IN0BUF[0] = Configuration;
  84   1      	EZUSB_SET_EP_BYTES(IN0BUF_ID,1);
  85   1      	return(TRUE);				// Handled by user code
  86   1      }
  87          
  88          BOOL DR_SetInterface(void) 		// Called when a Set Interface command is received
  89          {
  90   1      	AlternateSetting = SETUPDAT[2];
  91   1      	return(TRUE);				// Handled by user code
  92   1      }
  93          
  94          BOOL DR_GetInterface(void) 		// Called when a Set Interface command is received
  95          {
  96   1      	IN0BUF[0] = AlternateSetting;
  97   1      	EZUSB_SET_EP_BYTES(IN0BUF_ID,1);
  98   1      	return(TRUE);				// Handled by user code
  99   1      }
 100          
 101          BOOL DR_GetStatus(void)
 102          {
 103   1      	return(TRUE);
 104   1      }
 105          
 106          BOOL DR_ClearFeature(void)
 107          {
 108   1      	return(TRUE);
 109   1      }
 110          
 111          BOOL DR_SetFeature(void)
 112          {
 113   1      	return(TRUE);
 114   1      }
 115          
C51 COMPILER V6.14  USB_I2CI                                                               04/03/2003 11:25:17 PAGE 3   

 116          #define EZUSB_UNARM_EP(ep_id)  			EPIO[ep_id].cntrl = bmEPBUSY
 117          
 118          BOOL DR_VendorCmnd(void)
 119          {
 120   1         return(TRUE);
 121   1      }
 122          
 123          //-----------------------------------------------------------------------------
 124          // USB Interrupt Handlers
 125          //	The following functions are called by the USB interrupt jump table.
 126          //-----------------------------------------------------------------------------
 127          
 128          
 129          void ISR_Sudav(void) interrupt 0
 130          {
 131   1      	GotSUD = TRUE;				// Set flag
 132   1      
 133   1      
 134   1      	EZUSB_IRQ_CLEAR();
 135   1      	USBIRQ = bmSUDAV;			// Clear SUDAV IRQ
 136   1      }
 137          
 138          void ISR_Sutok(void) interrupt 0
 139          {
 140   1      	EZUSB_IRQ_CLEAR();
 141   1      	USBIRQ = bmSUTOK;			// Clear SUTOK IRQ
 142   1      }
 143          
 144          void ISR_Sof(void) interrupt 0
 145          {
 146   1      	EZUSB_IRQ_CLEAR();
 147   1      	USBIRQ = bmSOF;				// Clear SOF IRQ
 148   1      }
 149          
 150          void ISR_Ures(void) interrupt 0
 151          {
 152   1         
 153   1         REPORTDSCR *rdp;
 154   1         dscr_ptr = (REPORTDSCR xdata *) pReportDscr;
 155   1         rdp = dscr_ptr;
 156   1         InReportBytes = rdp -> Report_Count_In_Value;
 157   1         EPIO[IN2BUF_ID].bytes = InReportBytes;
 158   1      
 159   1         EPIO[OUT2BUF_ID].bytes = 64;
 160   1      
 161   1      	EZUSB_IRQ_CLEAR();
 162   1      	USBIRQ = bmURES;			// Clear URES IRQ
 163   1      }
 164          
 165          void ISR_IBN(void) interrupt 0
 166          {
 167   1       
 168   1      }
 169          
 170          void ISR_Susp(void) interrupt 0
 171          {
 172   1         Sleep = TRUE;
 173   1      
 174   1         EZUSB_IRQ_CLEAR();
 175   1         USBIRQ = bmSUSP;
 176   1      }
 177          
C51 COMPILER V6.14  USB_I2CI                                                               04/03/2003 11:25:17 PAGE 4   

 178          void ISR_Ep0in(void) interrupt 0
 179          {
 180   1      }
 181          
 182          void ISR_Ep0out(void) interrupt 0
 183          {
 184   1      }
 185          
 186          void ISR_Ep1in(void) interrupt 0
 187          {
 188   1      }
 189          
 190          void ISR_Ep1out(void) interrupt 0
 191          {
 192   1         
 193   1      }
 194          
 195          void ISR_Ep2in(void) interrupt 0
 196          {
 197   1      
 198   1      	IN2BC = InReportBytes;
 199   1       
 200   1      	EZUSB_IRQ_CLEAR();
 201   1      	IN07IRQ = bmEP2;
 202   1      
 203   1      }
 204          
 205          void ISR_Ep2out(void) interrupt 0
 206          
 207          {
 208   1      
 209   1      
 210   1         if (EPIO[IN2BUF_ID].cntrl & bmEPBUSY)
 211   1         {
 212   2            TOGCTL = 0x08 | IN2BUF_ID;
 213   2            WRITEDELAY();
 214   2            if (TOGCTL & 0x80)
 215   2               TOGCTL |= 0x20;
 216   2            else
 217   2               TOGCTL |= 0x40;
 218   2         }
 219   1      
 220   1      
 221   1      		IN2BUF[0]=num2;
 222   1         
 223   1         IN2BC = 0;
 224   1      
 225   1         
 226   1         OUT2BC = 0;
 227   1      
 228   1       
 229   1      	EZUSB_IRQ_CLEAR();
 230   1      	OUT07IRQ = bmEP2;
 231   1      }
 232          
 233          void ISR_Ep3in(void) interrupt 0
 234          {
 235   1      }
 236          
 237          void ISR_Ep3out(void) interrupt 0
 238          {
 239   1      }
C51 COMPILER V6.14  USB_I2CI                                                               04/03/2003 11:25:17 PAGE 5   

 240          
 241          void ISR_Ep4in(void) interrupt 0
 242          {
 243   1      }
 244          
 245          void ISR_Ep4out(void) interrupt 0
 246          {
 247   1        
 248   1      
 249   1      }
 250          
 251          void ISR_Ep5in(void) interrupt 0
 252          {
 253   1      }
 254          
 255          void ISR_Ep5out(void) interrupt 0
 256          {
 257   1      
 258   1      }
 259          
 260          void ISR_Ep6in(void) interrupt 0
 261          {
 262   1      }
 263          
 264          void ISR_Ep6out(void) interrupt 0
 265          {
 266   1       
 267   1      }
 268          
 269          void ISR_Ep7in(void) interrupt 0
 270          {
 271   1      }
 272          
 273          void ISR_Ep7out(void) interrupt 0
 274          {
 275   1       
 276   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    428    ----
   CONSTANT SIZE    =     16    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     11       1
   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 + -