资源简介
c8051f单片机资料
例程,原理图。
keil C教程。
代码片段和文件信息
/*
==================================================================================================
SMBus hardware operations
This file contains some operations of C8051Fxxxx serials MCU. It afford several functions. It use
the internal Timer1 to generate the clock source of SMbus. So you can not use the TIMER1 in the
other files.
Author : LiYong
Date : 2008.09.20
Compiler: Keil C51 V8.02
Version : 1.0
Resource: SMBus Timer-1
Support MCU:
C8051F340 C8051F320
==================================================================================================
*/
#define _C8051F_SMBUS_C_
#include “C8051F_SMBus.H“
static void Delay( unsigned char x );
static void Timer1Init( char sw ) ;
SMBUS_STATE SMbusAccessSlaver( unsigned char ChipAddr unsigned char Dir );
/*
==================================================================================================
Delay : Delay some time to finish some operations
InPut : x
Output : None
Note : None
==================================================================================================
*/
static void Delay( unsigned int x )
{
while( --x );
}
/*
==================================================================================================
WaitFlag_SI: Wait the SMbus finish the current operation.
InPut : None
Output : 1:successful 0:time out
Note : None
==================================================================================================
*/
static unsigned char WaitFlag_SI( void )
{
unsigned int count = 50000;
while( !SI )
{
Delay( 1000 );
if( --count == 0 )
{
return 0;
}
}
return 1;
}
/*
==================================================================================================
Timer1Init: Initialize the timer1 This is the clock source of the SMbus
InPut : -sw : 0: turn off else turn on
Output : None
Note : None
==================================================================================================
*/
static void Timer1Init( char sw )
{
unsigned char clock = ( SMBUS_CLOCK > 10 ) ? 10 : SMBUS_CLOCK;
if( sw == SMBUS_ON )
{
CKCON &= ~( 1<<3 );//clock source : Fsys/12 = 4MHz:
TMOD &= 0x0f;
TMOD |= 0x20;
TH1 = ( clock ^ 0xFF ) + 1;
TR1 = 1;
// ET1 = 1;//do not enter the interrupt handler
}
else if( sw == SMBUS_OFF )
{
TMOD &= 0x0f;
TR1 = 0;
}
}
/*
==================================================================================================
SMBusInit: Initialize the SMbus of C8051Fxxxx serial MCU
InPut : -sw : turn on or off the SMBus turn off to reduce the power consumption
Output : None
Note : None
==================================================================================================
*/
void SMBusInit( unsigned char sw )
{
i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2009-07-17 20:46 新建文件夹
目录 0 2009-07-17 20:46 新建文件夹\Datasheet
文件 189883 2009-04-01 21:50 新建文件夹\Datasheet\AMS1117-3[1].3.pdf
文件 455784 2009-06-27 19:12 新建文件夹\Datasheet\AT24C02.pdf
文件 4252385 2006-07-29 17:13 新建文件夹\Datasheet\c8051f32x.pdf
文件 430549 2006-11-18 08:35 新建文件夹\Datasheet\max232.pdf
文件 101399 2008-02-28 22:47 新建文件夹\Datasheet\USB-HID-KEYBOARD.pdf
文件 279647 2008-12-08 20:50 新建文件夹\Datasheet\USB枚举过程图解.pdf
文件 1605099 2009-05-18 20:10 新建文件夹\Datasheet\W25X10_W25X20_W25X40_W25X80.pdf
目录 0 2009-07-17 20:46 新建文件夹\Examples
目录 0 2009-07-17 20:45 新建文件夹\Examples\24c02
文件 16194 2008-07-22 09:55 新建文件夹\Examples\24c02\c8051F320.h
文件 11099 2009-07-07 18:27 新建文件夹\Examples\24c02\C8051F_SMbus.c
文件 5780 2009-07-05 14:36 新建文件夹\Examples\24c02\C8051F_SMbus.H
文件 21186 2009-07-05 17:31 新建文件夹\Examples\24c02\C8051F_SMbus.LST
文件 15506 2009-07-05 17:31 新建文件夹\Examples\24c02\C8051F_SMbus.OBJ
文件 41948 2009-07-05 17:31 新建文件夹\Examples\24c02\EEPROM
文件 5038 2009-06-27 22:30 新建文件夹\Examples\24c02\eeprom.c
文件 3257 2009-07-05 15:33 新建文件夹\Examples\24c02\eeprom.H
文件 4446 2009-07-05 17:31 新建文件夹\Examples\24c02\EEPROM.hex
文件 94 2009-07-05 17:31 新建文件夹\Examples\24c02\EEPROM.lnp
文件 8505 2009-07-05 17:31 新建文件夹\Examples\24c02\eeprom.LST
文件 29833 2009-07-05 17:31 新建文件夹\Examples\24c02\EEPROM.M51
文件 15712 2009-07-05 17:31 新建文件夹\Examples\24c02\eeprom.OBJ
文件 3302 2009-07-12 00:37 新建文件夹\Examples\24c02\EEPROM.Opt
文件 188 2009-07-12 00:45 新建文件夹\Examples\24c02\EEPROM.plg
文件 2336 2009-07-05 15:33 新建文件夹\Examples\24c02\EEPROM.Uv2
文件 3275 2009-07-11 23:47 新建文件夹\Examples\24c02\EEPROM_Opt.Bak
文件 0 2009-07-05 14:34 新建文件夹\Examples\24c02\EEPROM_Uv2.Bak
文件 19 2009-07-11 23:47 新建文件夹\Examples\24c02\ExtDll.iex
............此处省略379个文件信息
- 上一篇:GBVS视觉显著性代码
- 下一篇:雷达成像技术_刘永坦
相关资源
- DeviceNet协议第I/II部分与简介(绝对完
- keil MDK s3c2440 按键 中断 led 蜂鸣器
- myexclipse的SVN site-1.6.5
- c3550-ipservicesk9-mz.122-55.SE9.bin
- T-REC-H.265-201410-I!!PDF-E.pdf
- Flight stability and automatic control
- qt-vsaddin-msvc2017-2.2.0.vsix
- ARM SoC体系结构(中文版).pdf
- Cuvc 解码器
- halcon算子实现视频显示和处理的
- VText 1.37.unitypackage
- 计算理论导引第三版(Introduction to
- 微波雷达 KU5526微波雷达pcb
- CMOS VLSI Design: A Circuits and Systems Pers
- Introduction to Time Series and Forecasting.pd
- pdf转换需要的字体-AdobeSongStd-Light-Ac
- FreeRTOS操作详细系统教程
- Gaussian Markov Random Fields:Theory and App
- 算法竞赛入门经典第2版.刘汝佳(带书
- 前端架构设计.[美Micah Godbolt(带书签
- Spring Boot实战.[美]Craig Walls(带书签高
- Designing for Cisco Network Service Architectu
- STM32F429操作两片AD7689
- SCItranslate7 好用
- Spoken Language Processing-A Guide黄学东
- c1140-k9w7-tar.152-2.JB
- gocode.exe、guru.exe、godef.exe
- PicoBlaze软核例程
- 2019年CCNA题库
- windchill安装手册
评论
共有 条评论