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

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

?? 24c04test.c

?? BTF330實(shí)驗(yàn)程序。針對(duì)c8051f330的大部分外設(shè)的實(shí)驗(yàn)程序
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*------------------------------------------------------------------------------------
插上短路環(huán)J10、J21。斷開短路環(huán)J8.
    P0.6 -> SDA (SMBus)
    P0.7 -> SCL (SMBus)
功能:把寫到EEPROM的值讀出來(lái)。在液晶上顯示 SMBUS 0xCC.如24C02損壞,則顯示24C02 ERROR。
------------------------------------------------------------------------------------*/
// Includes
//------------------------------------------------------------------------------------
#include <c8051f330.h>                       // SFR declarations
#include <intrins.h>
#include "common.h"
//------------------------------------------------------------------------------------
// Global CONSTANTS
//------------------------------------------------------------------------------------

#define  SYSCLK         24500000             // System clock frequency
#define  SMB_FREQUENCY  50000                // Target SCL clock rate

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

                                             // Device addresses (7 bits, lsb is a don't care)
#define  EEPROM_ADDR    0xA0                 // Device address for slave target
                                             // Note: This address is specified
                                             // in the Microchip 24LC02B
                                             // datasheet.
// SMBus Buffer Size
#define  SMB_BUFF_SIZE  0x08                 // Defines the maximum number of bytes
                                             // that can be sent or received in a
                                             // single transfer

// Status vector - top 4 bits only
#define  SMB_MTSTA      0xE0                 // (MT) start transmitted
#define  SMB_MTDB       0xC0                 // (MT) data byte transmitted
#define  SMB_MRDB       0x80                 // (MR) data byte received
// End status vector definition
void YJ_Init(void);
void Write_CHAR(unsigned char yjchar);
//sbit  LED=P1^0;
//------------------------------------------------------------------------------------
// Global VARIABLES
//------------------------------------------------------------------------------------
unsigned char* pSMB_DATA_IN;                 // Global pointer for SMBus data
                                             // All receive data is written here

unsigned char SMB_SINGLEBYTE_OUT;            // Global holder for single byte writes

unsigned char* pSMB_DATA_OUT;                // Global pointer for SMBus data.
 //unsigned long q;                                            // All transmit data is read from here

unsigned char SMB_DATA_LEN;                  // Global holder for number of bytes
                                             // to send or receive in the current
                                             // SMBus transfer

unsigned char WORD_ADDR;                     // Global holder for the EEPROM word
                                             // address that will be accessed in
                                             // the next transfer

unsigned char TARGET;                        // Target SMBus slave address
 unsigned char temp_char;                  // temporary variable

unsigned char retval;  
bit SMB_BUSY = 0;                            // Software flag to indicate when the
                                             // EEPROM_ByteRead() or 
                                             // EEPROM_ByteWrite()
                                             // functions have claimed the SMBus

bit SMB_RW;                                  // Software flag to indicate the
                                             // direction of the current transfer

bit SMB_SENDWORDADDR;                        // When set, this flag causes the ISR
                                             // to send the 8-bit <WORD_ADDR>
                                             // after sending the slave address


bit SMB_RANDOMREAD;                          // When set, this flag causes the ISR
                                             // to send a START signal after 
                                             // sending the word address

bit SMB_ACKPOLL;                             // When set, this flag causes the ISR
                                             // to send a repeated START until the
                                             // slave has acknowledged its address

// 16-bit SFR declarations
sfr16    TMR2RL   = 0xca;                    // Timer2 reload registers
sfr16    TMR2     = 0xcc;                    // Timer2 counter registers
sfr16    TMR3RL   = 0x92;                    // Timer2 reload registers
sfr16    TMR3     = 0x94;                    // Timer3 counter registers

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

void SMBus_Init (void);
void Timer1_Init (void);
void Timer3_Init (void);
void Port1_Init (void);
void SMBus_ISR (void);
void Timer3_ISR (void);

void EEPROM_ByteWrite(unsigned char addr, unsigned char dat);
void EEPROM_WriteArray (unsigned char dest_addr, unsigned char* src_addr,
                        unsigned char len);
unsigned char EEPROM_ByteRead(unsigned char addr);
void EEPROM_ReadArray (unsigned char* dest_addr, unsigned char src_addr,
                       unsigned char len);
unsigned char xdata tabn[10]={0x53,0x4d,0x42,0x55,0x53,0x20,0x30,0x78
,0x43,0x43};
//------------------------------------------------------------------------------------
// MAIN Routine
//------------------------------------------------------------------------------------
//
// Main routine performs all configuration tasks, then loops forever sending and
// receiving SMBus data to the slave F300_SLAVE

void main (void)
{
	int iNum = 0;
	int ii;
   	

	PCA0MD &= ~0x40;                          // WDTE = 0 (disable watchdog timer)

   	OSCICN |= 0x03;                           // Set internal oscillator to highest
                                             // setting (24500000)
   	Port1_Init ();                             // Initialize Crossbar and GPIO

   	Timer1_Init ();                           // Configure Timer1 for use as SMBus
                                             // clock source

   	Timer3_Init ();                           // Configure Timer2 for use with SMBus
                                             // low timeout detect
    
   	SMBus_Init ();                            // Configure and enable SMBus

	EIE1 = 1;                                // SMBus interrupt enable
   	IE = 0x20;                               // Timer2 interrupt enable
   	EA = 1;                                   // Global interrupt enable

   	EEPROM_ByteWrite(0x38, 0xcc);
   	temp_char = EEPROM_ByteRead(0x38);

  	if(temp_char==0xcc)						//有按鍵按下,顯示對(duì)應(yīng)的按鍵
	{
    	YJ_Init();                     //LCD初始化
                                        //準(zhǔn)備送數(shù)據(jù)
		
		for(ii=0;ii<10;ii++){
  			Write_CHAR(tabn[ii]);
  		
		}		                 	//控制LCD	
		mysleep_ms();

	}
	else{	
		YJ_Init();
		Write_CHAR(0x32);
		Write_CHAR(0x34);
		Write_CHAR(0x43);
		Write_CHAR(0x30);
		Write_CHAR(0x34);
		Write_CHAR(0x20);
		Write_CHAR(0x45);
		Write_CHAR(0x52);
		Write_CHAR(0x52);
		Write_CHAR(0x4f);
		Write_CHAR(0x52);
		mysleep_ms();
		
	}

}

//------------------------------------------------------------------------------------
// Functions
//------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------
// EEPROM_Write ()
//------------------------------------------------------------------------------------
//
// This function writes the value in <dat> to location <addr> in the EEPROM then polls
// the EEPROM until the write is complete.
//
void EEPROM_ByteWrite( unsigned char addr, unsigned char dat )
{
   while (SMB_BUSY);
   SMB_BUSY = 1;                             // Claim SMBus (set to busy)

   // Set SMBus ISR parameters
   TARGET = EEPROM_ADDR;                     // Set target slave address
   SMB_RW = WRITE;                           // Mark next transfer as a write
   SMB_SENDWORDADDR = 1;                     // Send Word Address after Slave Address
   SMB_RANDOMREAD = 0;                       // Do not send a START signal after
                                             // the word address
   SMB_ACKPOLL = 1;                          // Enable Acknowledge Polling (The ISR
                                             // will automatically restart the 
                                             // transfer if the slave does not 
                                             // acknowledge its address.

   // Specify the Outgoing Data
   WORD_ADDR = addr;                         // Set the target address in the EEPROM's
                                             // internal memory space

   SMB_SINGLEBYTE_OUT = dat;                 // store dat (local variable) in a global
                                             // variable so the ISR can read it after
                                             // this function exits

   pSMB_DATA_OUT = &SMB_SINGLEBYTE_OUT;      // The outgoing data pointer points to
                                             // the <dat> variable.

   SMB_DATA_LEN = 1;                         // Specify to ISR that the next transfer
                                             // will contain one data byte

   // Initiate SMBus Transfer
   STA = 1;

}



//------------------------------------------------------------------------------------
// EEPROM_ByteRead ()
//------------------------------------------------------------------------------------
//
// This function returns a single byte from location <addr> in the EEPROM then 
// polls the <SMB_BUSY> flag until the read is complete.
//
unsigned char EEPROM_ByteRead( unsigned char addr)
{
  // unsigned char retval;                     // Holds the return value

	int iLim1 = 100;
	int iLim2 = 25000;
	int  iNum1 = 0;
	int iNum2 = 0;
   	while (SMB_BUSY && iNum1 <iLim1 )
   	{
		while(SMB_BUSY && iNum2 < iLim2)
		{
			iNum2++;
		}
		iNum2 = 0;
		iNum1++;
   	}                         // Wait for SMBus to be free.
	if( iNum1 >= iLim1)
	{
		return 0xcb;			
	}
   SMB_BUSY = 1;                             // Claim SMBus (set to busy)

   // Set SMBus ISR parameters
   TARGET = EEPROM_ADDR;                     // Set target slave address
   SMB_RW = WRITE;                           // A random read starts as a write
                                             // then changes to a read after
                                             // the repeated start is sent. The
                                             // ISR handles this switchover if
                                             // the <SMB_RANDOMREAD> bit is set.
   SMB_SENDWORDADDR = 1;                     // Send Word Address after Slave Address
   SMB_RANDOMREAD = 1;                       // Send a START after the word address
   SMB_ACKPOLL = 1;                          // Enable Acknowledge Polling

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色涩在线第一页| 国产精品久久久久久久第一福利 | 九色综合狠狠综合久久| 亚洲免费观看高清| 国产精品免费丝袜| 国产精品视频一区二区三区不卡| 久久久蜜臀国产一区二区| 欧美r级电影在线观看| 欧美成人精品二区三区99精品| 91精品国产一区二区三区| 91精品福利在线一区二区三区| 欧美一区二区视频网站| 成人黄色免费短视频| www.欧美色图| 欧美在线free| 91麻豆精品国产91久久久久久| 3751色影院一区二区三区| 91.com在线观看| 日韩精品一区国产麻豆| 2020日本不卡一区二区视频| 中文字幕精品在线不卡| 亚洲日本韩国一区| 亚洲国产sm捆绑调教视频| 日韩电影一区二区三区四区| 久久精品999| 国产成人在线视频免费播放| 成人性色生活片免费看爆迷你毛片| 成人黄色在线网站| 欧美午夜影院一区| 欧美va在线播放| 中文幕一区二区三区久久蜜桃| 亚洲色图.com| 亚洲成人精品影院| 国产精品亚洲午夜一区二区三区| 91在线小视频| 欧美高清激情brazzers| 国产天堂亚洲国产碰碰| 亚洲精品国产无套在线观| 日韩成人一区二区| 国产伦精品一区二区三区免费迷| eeuss鲁片一区二区三区| 欧美亚洲一区二区三区四区| 日韩欧美国产综合一区| 国产精品久久久久久亚洲毛片| 一区二区三区日本| 国内精品伊人久久久久av影院| av在线播放成人| 欧美一级日韩免费不卡| 国产免费观看久久| 肉色丝袜一区二区| 国产成人精品影视| 欧美色网站导航| 国产欧美一区二区精品婷婷| 亚洲一区二区在线视频| 精品中文av资源站在线观看| 91丝袜国产在线播放| 日韩免费高清视频| 一区二区在线观看免费| 国产精品中文字幕日韩精品 | 欧美色倩网站大全免费| 久久久久9999亚洲精品| 天天射综合影视| 成人免费视频播放| 日韩午夜av电影| 伊人色综合久久天天| 国产另类ts人妖一区二区| 欧美丝袜丝nylons| 国产精品久久久久久久久免费樱桃| 男女视频一区二区| 欧美亚一区二区| 国产精品国产自产拍高清av| 美女性感视频久久| 欧美手机在线视频| 亚洲婷婷在线视频| 国产成人免费xxxxxxxx| 精品国产乱子伦一区| 亚洲成av人片观看| 欧美在线影院一区二区| 国产精品三级久久久久三级| 韩国v欧美v亚洲v日本v| 欧美一区二区人人喊爽| 亚洲一区二区三区自拍| av一区二区不卡| 欧美高清在线一区二区| 久久99这里只有精品| 69堂精品视频| 亚洲成人免费视| 91国偷自产一区二区三区观看| 亚洲国产高清在线| 国产精品一区一区三区| 精品蜜桃在线看| 青青草97国产精品免费观看 | 91在线观看地址| 国产网站一区二区| 国产美女视频91| 久久久亚洲国产美女国产盗摄| 美女视频免费一区| 日韩一区二区三区四区五区六区| 香蕉av福利精品导航| 精品视频一区二区三区免费| 有码一区二区三区| 色先锋资源久久综合| 亚洲免费av高清| 91麻豆免费视频| 日韩美女啊v在线免费观看| av中文字幕不卡| 国产精品国产三级国产专播品爱网 | 午夜视频一区二区三区| 欧美色视频在线| 天天影视涩香欲综合网| 日韩一区二区三区电影| 久久精品免费观看| 久久久五月婷婷| 成人激情动漫在线观看| 亚洲欧洲99久久| 色婷婷av久久久久久久| 一区二区免费在线播放| 欧美三级电影在线看| 亚洲成人tv网| 欧美一个色资源| 国产一区二区三区四区五区美女| 久久精品一级爱片| 97se亚洲国产综合在线| 亚洲国产精品自拍| 日韩三级在线免费观看| 国产精品综合二区| 中文字幕中文乱码欧美一区二区| 色呦呦国产精品| 手机精品视频在线观看| 精品国产网站在线观看| 国产毛片精品视频| 亚洲欧洲www| 91精品国产综合久久蜜臀| 六月婷婷色综合| 国产精品欧美精品| 在线观看av不卡| 久久国产尿小便嘘嘘| 国产欧美日韩三级| 色呦呦一区二区三区| 日日摸夜夜添夜夜添国产精品 | 五月天一区二区三区| 欧美videos大乳护士334| av午夜精品一区二区三区| 亚洲电影一区二区| 2024国产精品| 99re热这里只有精品视频| 亚洲国产成人tv| 久久网站最新地址| 欧美性生活久久| 国精产品一区一区三区mba视频| 国产精品成人免费在线| 欧美高清视频在线高清观看mv色露露十八 | 天堂一区二区在线| 久久亚洲影视婷婷| 欧美无砖砖区免费| 国产乱妇无码大片在线观看| 亚洲国产精品一区二区久久| 久久日韩粉嫩一区二区三区| 在线观看91视频| 粉嫩蜜臀av国产精品网站| 午夜av一区二区三区| 国产欧美精品区一区二区三区 | 欧美日韩精品一区视频| 国产精品18久久久久久久久| 一区二区三区四区乱视频| 久久综合九色综合97_久久久| 91蝌蚪porny| 国产一区二区免费在线| 亚洲va在线va天堂| 国产精品国产自产拍高清av王其 | 亚洲在线一区二区三区| 欧美激情在线一区二区| 日韩精品影音先锋| 精品视频色一区| 91在线视频网址| 国产综合色产在线精品| 视频一区国产视频| 亚洲美女电影在线| 国产亚洲人成网站| 91麻豆精品国产91久久久久久久久 | 美女视频黄免费的久久 | 成人免费高清视频在线观看| 蜜桃精品视频在线| 午夜一区二区三区视频| 亚洲欧美激情一区二区| 欧美激情综合五月色丁香小说| 精品久久一区二区| 91精品欧美综合在线观看最新| 色综合久久六月婷婷中文字幕| 懂色av中文一区二区三区| 精品无人码麻豆乱码1区2区 | 色欧美片视频在线观看| 成人理论电影网| 成人永久aaa| 国产成人精品免费在线| 国产酒店精品激情| 久久99精品国产麻豆不卡| 日韩国产欧美一区二区三区| 亚洲福中文字幕伊人影院| 一区二区三区在线视频观看58|