用c8051f320单片机,任选两个IO口进行模拟IIC操做,用软件IIC对加速度芯片MXC6020进行读写操作(IIC接口)

源代码在线查看: target.lst

软件大小: 57 K
上传用户: yamiluoier
关键词: IIC c8051f320 6020 MXC
下载地址: 免注册下载 普通下载 VIP

相关代码

				C51 COMPILER V7.20   TARGET                                                                05/15/2007 15:32:40 PAGE 1   
				
				
				C51 COMPILER V7.20, COMPILATION OF MODULE TARGET
				OBJECT MODULE PLACED IN target.OBJ
				COMPILER INVOKED BY: C:\Keil\C51\BIN\c51.exe target.c DB OE
				
				line level    source
				
				   1          #include "MEMSIC.h" 
				   2          
				   3          
				   4          
				   5          
				   6          /**********************************************************************************
				   7          *
				   8          *
				   9          *
				  10          ***********************************************************************************/
				  11          void Sysclk_Init(void)                   // Initialize oscillator
				  12          {
				  13   1          OSCICN = 0x83;                         // configure internal oscillator 
				  14   1          CLKSEL = 0x00;                         // not divide 12MHz
				  15   1          RSTSRC = 0x04;                         // Missing clock detector
				  16   1                                                 // triggers a reset  
				  17   1      }                                          
				  18          
				  19          
				  20          
				  21          
				  22          
				  23          /**********************************************************************************
				  24          *
				  25          *
				  26          *
				  27          ***********************************************************************************/
				  28          void Port_Init(void)                     // Initialize crossbar and GPIO
				  29          {
				  30   1         P1MDIN   = 0x7F;                      // Port 1 pin 7 set as analog input
				  31   1         P0MDIN   = 0xFF;                      // Not analog input
				  32   1         P0MDOUT  = 0x00;                      // Open-drain output
				  33   1         P1MDOUT |= 0x0F;                      // Port 1 pins 0-3 set high impedence
				  34   1         P2MDOUT |= 0x0C;                      // Port 2 pins 0,1 set high impedence
				  35   1      
				  36   1         P1SKIP   = 0x80;                      // Port 1 pin 7 skipped by crossbar
				  37   1         XBR0     = 0x01;                                                 
				  38   1         XBR1     = 0x40;                      // Enable Crossbar
				  39   1      }
				  40          
				  41          
				  42          
				  43          
				  44          /**********************************************************************************
				  45          *
				  46          *
				  47          *
				  48          ***********************************************************************************/
				  49          void Interrupt_Init(void)
				  50          {
				  51   1          ET2 = 1;                                        // Enable Timer2 interrupt
				  52   1              PT2 = 1;                            // Set T2 to High priority.
				  53   1      }
				  54          
				  55          
				C51 COMPILER V7.20   TARGET                                                                05/15/2007 15:32:40 PAGE 2   
				
				  56          
				  57          
				  58          /**********************************************************************************
				  59          *
				  60          *
				  61          *
				  62          ***********************************************************************************/
				  63          void WDT_Init(void)
				  64          {
				  65   1      }
				
				
				MODULE INFORMATION:   STATIC OVERLAYABLE
				   CODE SIZE        =     41    ----
				   CONSTANT SIZE    =   ----    ----
				   XDATA SIZE       =   ----    ----
				   PDATA SIZE       =   ----    ----
				   DATA SIZE        =   ----    ----
				   IDATA SIZE       =   ----    ----
				   BIT SIZE         =   ----    ----
				END OF MODULE INFORMATION.
				
				
				C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
							

相关资源