亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? i2c.c

?? C8051F411單片機的I2C接口通信程序,調(diào)試通過
?? C
?? 第 1 頁 / 共 2 頁
字號:
//-----------------------------------------------------------------------------
// F41x_SMBus_Slave.c
//-----------------------------------------------------------------------------
// Copyright 2006 Silicon Laboratories, Inc.
// http://www.silabs.com
//
// Program Description:
//
// Example software to demonstrate the C8051F41x SMBus interface in Slave mode
// - Interrupt-driven SMBus implementation
// - Only slave states defined
// - 1-byte SMBus data holder used for both transmit and receive
// - Timer1 used as SMBus clock rate (used only for free timeout detection)
// - Timer3 used by SMBus for SCL low timeout detection
// - ARBLOST support included
// - Pinout:
//    P0.0 -> SDA (SMBus)
//    P0.1 -> SCL (SMBus)
//
//    P2.1 -> LED
//
//    P2.7 -> C2D (debug interface)
//
//    all other port pins unused
//
// How To Test:
//
// 1) Download code to a 'F41x device that is connected to a SMBus master.
// 2) Run the code.  The slave code will write data and read data from the
//    same data byte, so a successive write and read will effectively echo the
//    data written.  To verify that the code is working properly, verify on the
//    master that the data written is the same as the data received.
//
// NOTE: On the 'F410 Target Board, verify J13 and J14 are not populated
// before testing.
//
// FID:            41X000021
// Target:         C8051F41x
// Tool chain:     Keil C51 7.50 / Keil EVAL C51
// Command Line:   None
//
// Release 1.0
//    -Initial Revision (TP)
//    -30 MAR 2006
//

//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------

#include <C8051F410.h>

//-----------------------------------------------------------------------------
// Global Constants
//-----------------------------------------------------------------------------

#define  SYSCLK         24500000       // System clock frequency in Hz

#define  SMB_FREQUENCY  10000          // Target SMBus frequency
                                       // This example supports between 10kHz
                                       // and 100kHz

#define  WRITE          0x00           // SMBus WRITE command
#define  READ           0x01           // SMBus READ command

#define  SLAVE_ADDR     0xA2           // Device addresses (7 bits,
                                       // lsb is a don't care)

// Status vector - top 4 bits only
#define  SMB_SRADD      0x20           // (SR) slave address received
                                       //    (also could be a lost
                                       //    arbitration)
#define  SMB_SRSTO      0x10           // (SR) STOP detected while SR or ST,
                                       //    or lost arbitration
#define  SMB_SRDB       0x00           // (SR) data byte received, or
                                       //    lost arbitration
#define  SMB_STDB       0x40           // (ST) data byte transmitted
#define  SMB_STSTO      0x50           // (ST) STOP detected during a
                                       //    transaction; bus error
// End status vector definition

#define  NUM_BYTES_WR   4              // Number of bytes to write
                                       // Slave <- Master
#define  NUM_BYTES_RD   2              // Number of bytes to read
                                       // Slave -> Master

//-----------------------------------------------------------------------------
// Global VARIABLES
//-----------------------------------------------------------------------------

// Global holder for SMBus data.
// All receive data is written here
// NUM_BYTES_WR used because an SMBus write is Master->Slave
unsigned char SMB_DATA_IN[NUM_BYTES_WR]; 

// Global holder for SMBus data.
// All transmit data is read from here
// NUM_BYTES_RD used because an SMBus read is Slave->Master
unsigned char SMB_DATA_OUT[NUM_BYTES_RD];

unsigned char a1,a2,a3,a4;

static unsigned char rec_byte_counter;

bit DATA_READY = 0;                    // Set to '1' by the SMBus ISR
                                       // when a new data byte has been
                                       // received.

// 16-bit SFR declarations
sfr16    TMR3RL   = 0x92;              // Timer3 reload registers
sfr16    TMR3     = 0x94;              // Timer3 counter registers

//sbit LED = P2^1;                       // LED on port P2.1

//-----------------------------------------------------------------------------
// Function PROTOTYPES
//-----------------------------------------------------------------------------

void SMBus_Init (void);
void Timer1_Init (void);
void Timer3_Init (void);
void Port_Init (void);

void SMBus_ISR (void);
void Timer3_ISR (void);

//-----------------------------------------------------------------------------
// MAIN Routine
//-----------------------------------------------------------------------------
//
// Main routine performs all configuration tasks, then waits for SMBus
// communication.
//
void main (void)
{
   PCA0MD &= ~0x40;                    // WDTE = 0 (Disable watchdog
                                       // timer)

   OSCICN |= 0x07;                     // Set internal oscillator to highest
                                       // setting of 24500000

   Port_Init();                        // Initialize Crossbar and GPIO
   Timer1_Init();                      // Configure Timer1 for use
                                       // with SMBus baud rate

   Timer3_Init();                      // Configure Timer3 for use with
                                       // SCL low timeout detect

   SMBus_Init ();                      // Configure and enable SMBus

   EIE1 |= 0x01;                       // Enable the SMBus interrupt

  // LED = 0;

   EA = 1;                             // Global interrupt enable

   //SMB_DATA = 0xFD;                    // Initialize SMBus data holder

   while(1)
   {
      //while(!DATA_READY);              // New SMBus data received?
      //DATA_READY=0;
	  //SMB_DATA = 0x
	  //SMB0CN=SMB_STDB;
      //LED = ~LED;


      //if(rec_byte_counter==4)
	  //{
	     
	  //}
   }
}

//-----------------------------------------------------------------------------
// Initialization Routines
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// SMBus_Init()
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters   : None
//
// SMBus configured as follows:
// - SMBus enabled
// - Slave mode not inhibited
// - Timer1 used as clock source. The maximum SCL frequency will be
//   approximately 1/3 the Timer1 overflow rate
// - Setup and hold time extensions enabled
// - Bus Free and SCL Low timeout detection enabled
//
void SMBus_Init (void)
{
   SMB0CF = 0x1D;                      // Use Timer1 overflows as SMBus clock
                                       // source;
                                       // Enable slave mode;
                                       // Enable setup & hold time
                                       // extensions;
                                       // Enable SMBus Free timeout detect;
                                       // Enable SCL low timeout detect;

   SMB0CF |= 0x80;                     // Enable SMBus;
}

//-----------------------------------------------------------------------------
// Timer1_Init()
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters   : None
//
// Timer1 configured as the SMBus clock source as follows:
// - Timer1 in 8-bit auto-reload mode
// - SYSCLK or SYSCLK / 4 as Timer1 clock source
// - Timer1 overflow rate => 3 * SMB_FREQUENCY
// - The resulting SCL clock rate will be ~1/3 the Timer1 overflow rate
// - Timer1 enabled
//
void Timer1_Init (void)
{

// Make sure the Timer can produce the appropriate frequency in 8-bit mode
// Supported SMBus Frequencies range from 10kHz to 100kHz.  The CKCON register

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频免费在线观看| 欧美色老头old∨ideo| 精品久久国产字幕高潮| 免费看日韩精品| 日韩欧美精品三级| 国产一区二区不卡老阿姨| 精品久久久久香蕉网| 国产夫妻精品视频| 国产精品国产三级国产aⅴ原创 | 久久久精品国产99久久精品芒果| 国产真实乱偷精品视频免| 国产亚洲一区二区三区四区| 粉嫩欧美一区二区三区高清影视 | 欧美一级日韩免费不卡| 麻豆精品一二三| 久久精品在线观看| www.成人在线| 久久精品国产秦先生| 久久九九国产精品| 一本一道综合狠狠老| 日韩电影一二三区| 久久亚洲一区二区三区明星换脸| 成人黄色小视频在线观看| 亚洲六月丁香色婷婷综合久久| 欧美日韩亚洲丝袜制服| 狠狠色狠狠色综合| 一区二区三区国产精品| 日韩免费高清av| eeuss鲁片一区二区三区在线看| 亚洲一区二区三区美女| 精品久久久久av影院 | 激情伊人五月天久久综合| 日本一二三四高清不卡| 欧美日韩一区二区三区高清| 久久99精品久久久久久动态图 | 国产做a爰片久久毛片| 中文字幕一区二区三区不卡 | 国产精品久久久久影院老司| 欧美日韩视频专区在线播放| 国模冰冰炮一区二区| 亚洲国产精品视频| 久久久久久免费毛片精品| 欧美伊人久久久久久午夜久久久久| 久久精品国产99国产精品| 一区二区三区中文在线观看| 精品999在线播放| 欧美亚洲另类激情小说| 国产成a人无v码亚洲福利| 丝袜美腿成人在线| 亚洲黄色免费电影| 国产色婷婷亚洲99精品小说| 欧美日韩一级视频| 99精品视频一区| 国产精品一区二区三区四区| 亚洲v中文字幕| 亚洲女女做受ⅹxx高潮| 久久久久久**毛片大全| 日韩网站在线看片你懂的| 在线精品视频一区二区三四| 成人黄色免费短视频| 国产呦精品一区二区三区网站| 日日夜夜免费精品| 亚洲一区av在线| 亚洲免费色视频| 国产精品福利av| 中国av一区二区三区| 精品乱人伦小说| 日韩欧美高清一区| 欧美性一级生活| 欧美在线免费观看视频| 色诱亚洲精品久久久久久| 9久草视频在线视频精品| 国产白丝精品91爽爽久久 | 从欧美一区二区三区| 国内精品免费**视频| 九九**精品视频免费播放| 日韩av一级电影| 人人爽香蕉精品| 美腿丝袜亚洲色图| 狂野欧美性猛交blacked| 青椒成人免费视频| 蜜臀久久99精品久久久画质超高清 | 91精品国产美女浴室洗澡无遮挡| 欧美视频在线播放| 在线观看91视频| 欧美精选一区二区| 欧美日本乱大交xxxxx| 制服.丝袜.亚洲.中文.综合| 欧美一区二区视频网站| 日韩一区二区在线免费观看| 欧美一二三在线| 欧美mv和日韩mv国产网站| 久久综合精品国产一区二区三区| 精品福利在线导航| 中文字幕精品综合| 亚洲欧美日韩国产一区二区三区| 一区二区三区国产精品| 视频一区欧美日韩| 精品一区二区免费视频| 国产精品自在欧美一区| 成人国产精品免费网站| 色哟哟在线观看一区二区三区| 欧美在线一二三四区| 日韩欧美综合在线| 国产偷v国产偷v亚洲高清| 亚洲私人黄色宅男| 天堂va蜜桃一区二区三区漫画版| 精品亚洲aⅴ乱码一区二区三区| 国产精品资源在线看| 91在线观看一区二区| 欧美日韩高清一区| 久久精品水蜜桃av综合天堂| 国产精品传媒入口麻豆| 五月天一区二区| 国产一区二区三区观看| 91丝袜美女网| 日韩欧美一区中文| 国产精品的网站| 免费人成黄页网站在线一区二区| 国产成人亚洲综合色影视| 欧美亚洲动漫精品| 久久综合狠狠综合久久综合88 | 欧美在线免费播放| 日韩免费观看高清完整版| 中文字幕日本乱码精品影院| 天涯成人国产亚洲精品一区av| 国产精品资源在线看| 欧美日韩综合在线免费观看| 国产偷v国产偷v亚洲高清| 亚洲一二三区不卡| 成人一区二区三区视频在线观看| 欧美日韩中文另类| 国产精品卡一卡二| 看片网站欧美日韩| 欧美在线观看一区| 国产精品免费久久久久| 美女网站在线免费欧美精品| 一本色道久久综合狠狠躁的推荐 | 天涯成人国产亚洲精品一区av| 成人动漫视频在线| 欧美tickling网站挠脚心| 亚洲香肠在线观看| 99视频热这里只有精品免费| 26uuu精品一区二区三区四区在线| 亚洲一区二区三区四区五区中文 | 亚洲欧美日韩在线不卡| 国产精品99久久久久久似苏梦涵| 欧美日韩国产中文| 一区二区三区日韩欧美| 成人sese在线| 国产色婷婷亚洲99精品小说| 久久99国产精品成人| 欧美日本在线观看| 亚洲女同ⅹxx女同tv| 盗摄精品av一区二区三区| 91麻豆精品国产无毒不卡在线观看| 国产精品网站在线播放| 美国毛片一区二区| 欧美福利电影网| 亚洲精品一卡二卡| 国产成人免费视| 欧美视频一区二区在线观看| 亚洲精品国产精华液| 黄色日韩网站视频| 7777精品伊人久久久大香线蕉最新版| 国产精品久久久久影视| 激情文学综合插| 久久蜜桃av一区精品变态类天堂| 肉肉av福利一精品导航| 在线观看www91| 国产精品成人网| 一本一道久久a久久精品| 国产精品情趣视频| 国产精选一区二区三区| 久久精品欧美一区二区三区不卡| 日韩二区在线观看| 欧美日韩黄色影视| 一区二区三区成人| 制服丝袜亚洲色图| 午夜精品aaa| 欧美吻胸吃奶大尺度电影| 91麻豆精品国产91久久久使用方法| 婷婷成人综合网| 欧美日韩精品三区| 一区二区三区精密机械公司| 粉嫩一区二区三区在线看| 亚洲欧美日韩在线| 99久久国产免费看| 国产精品久久久一区麻豆最新章节| 91年精品国产| 亚洲欧美日韩综合aⅴ视频| 91婷婷韩国欧美一区二区| 国产精品国产成人国产三级| 91福利资源站| 亚洲成人在线观看视频| 欧美偷拍一区二区| 麻豆精品蜜桃视频网站| 久久久亚洲高清| 国产成人在线视频网站| 中文字幕一区二区视频|