Description: Simulate the I2C protocol with single-chip I/O port
I2C IO was used to simulate program online example is 51, the accuracy of any of the sample without doubt. But if directly to it based on AVR is changed, it is a not careful, will have a little problem.
It shall be from the I2C hardware specification and AVR and 51 MCU IO mouths speak up. The I2C require SCL, SDA has function of line and second line, namely the I2C driver mouth should be drain open circuit, the maintenance of its high level is accomplished by pull-up resistors, low level requires strong drive at the mouth of the drop-down.
51 microcontroller IO port completely accords with the feature. Just write the I2C driver is handy. But the AVR IO mouth is powerful, it outputs high level is real high level, rather than rely on what pull-up resistor to provide, only 10 ma is less than the current! So if use PORTB_Bit0 = 1 such operations directly, cannot satisfy the I2C line and function, if there are other devices to pull SCL or SDA is low, so the result is two IO mouth fighting, who is winning is unknown, time grew, mostly both; chip fever.
Of course, the IO port of AVR naturally has the means to satisfy the electrical characteristics of I2C, not just can't output 1, so it can be used with its high impedance status (DDRB_Bit0=0,PORTB_Bit0= 0), to output 0 (DDRB_Bit0=1,PORTB_Bit0=0).
- [51I2C] - 51 microcontroller simulation I2C Bus C
- [i2c111] - this procedure is used IO simulation I2C
- [ATmega16_code] - AVR procedures, including timers, watchd
- [i2c] - 51 single-chip analog i2c complete sourc
- [I2C] - Verilog I2C bus procedures, very useful,
- [uCOS-II_example] - uCOS transplanted some applications, for
- [I2C] - I2C Bus C language allehanda including,
- [AVR-I2C] - On the AVR an I/O simulation I2C source
- [RTC] - A rtc used ISL12022
- [RTC] - Week Ligong FM3130 chip clock part of th
File list (Check if you may need any files):