I2C duty cycle register setting problem

Publisher:dandan666Latest update time:2016-07-18 Source: eefocusKeywords:I2C Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
doubt:

-----------------------------------------------------------------------
I2C0SCLH = (Fpclk/fi2c + 1) / 2; 
I2C0SCLL = (Fpclk/fi2c)/2;
In I2C0SCLH = (Fpclk/fi2c+ 1) / 2;,

Why is it Fpclk/fi2c+1 instead of Fpclk/fi2c?
-----------------------------------------------------------------------

Answer:
**************************************************************************
According to the formula: I2SCLH + I2SCLL = Fpclk / Fbit (0) Original formula

In computer number crunching, we do this:

I2SCLH = (Fpclk/Fbit + 1)/2(1)

I2SCLL = (Fpclk/Fbit)/2(2)

Then I2SCLH + I2SCLL = (Fpclk / Fbit + 1) / 2 + (Fpclk / Fbit) / 2 (3) In computer digital operations, the two items cannot be combined.

To prove that there is no problem with this, here we give an example:

Assume I2SCLH + I2SCLL = Fpclk / Fbit = 5

Only by doing this:

I2SCLH = (Fpclk / Fbit + 1) / 2 = 3

I2SCLL = (Fpclk/Fbit)/2 = 2

To ensure:

I2SCLH + I2SCLL = 5 which matches the original formula (0).

If, as stated in the question, I2SCLH + I2SCLL = (Fpclk / Fbit) / 2 + (Fpclk / Fbit) / 2 = 4, then it does not match the original formula (0)!

Keywords:I2C Reference address:I2C duty cycle register setting problem

Previous article:ARM Learning 1-LED Flowing Light
Next article:SPI host experiment---7-segment digital tube display

Recommended ReadingLatest update time:2024-11-16 16:22

I2C bus signal timing summary
Bus Idle State    When the SDA and SCL signal lines of the I2C bus are both at high level, it is defined as the idle state of the bus. At this time, the output stage field effect transistors of each device are in the cut-off state, that is, the bus is released, and the level is pulled up by the pull-up resistors of t
[Microcontroller]
MAXQ2000 Microcontroller Software I2C Driver
introduction I2C (Inter-Integrated Circuit) is a 2-wire interface that enables bidirectional communication between integrated circuits. This application note describes the maxqi2c library, a software I2C driver for the MAXQ2000 microcontroller (µC). The maxqi2c library is written in extended C and compiled
[Microcontroller]
MAXQ2000 Microcontroller Software I2C Driver
I2C bus PTZ motor control design in high-definition video surveillance
  1 Introduction   In recent years, with the development of video technology, the stability of the network has been rapidly improved, the demand for video surveillance has been increasing, and its application areas have become more and more extensive. With the development of society, the number of cars has continued t
[Microcontroller]
I2C bus PTZ motor control design in high-definition video surveillance
Application of I2C interface ZLG7289 in digital control signal source
In addition to being able to output conventional waveforms such as sine waves, square waves, and sawtooth waves, the CNC signal source is also required to be able to output arbitrary waveforms with adjustable frequency, adjustable amplitude, and adjustable phase. Therefore, in the CNC signal source, the frequency, a
[Industrial Control]
Application of I2C interface ZLG7289 in digital control signal source
STM32F0 Slave I2C configuration
The I2C of F0 is different from that of F103. The Slave I2C interface protocol adopts the format of register access. (1) I2C initialization void IIC_Slavemode_Init(u8 debug, u8 addr) {     GPIO_InitTypeDef GPIO_InitStructure;     NVIC_InitTypeDef NVIC_InitStructure;     I2C_InitTypeDef I2C_InitStructure;     if
[Microcontroller]
STM8 AT24CXX uses I2C interface to read and write
software design /********************************************************************* Purpose: To build AT24CXX operation library Target system: Based on STM8 microcontroller  Application software: Cosmic CxSTM8   *********************************************************************/ #define WD_DADR 0xa0 #define RD
[Microcontroller]
51 MCU——I2C bus
UART is an asynchronous communication. For example, when a computer sends data to a microcontroller, the computer is only responsible for sending the data through TXD, and receiving the data is the responsibility of the microcontroller. I2C is a synchronous communication. The SCL clock line is responsible for the cloc
[Microcontroller]
51 MCU——I2C bus
Design and Application Examples of DSP Virtual I2C Bus Software Package
introduction Digital signal processors (DSP) are increasingly used in various fields, among which TI (TEXAS INSTRUMENT)'s TMS320 series chips have taken a leading position. TMS320F206 (F206 for short) is favored in the development of mid-to-high-end instruments because it has 32K words of Flash on the chip,
[Embedded]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号