这是适用I/O口模拟的 I2C 程序,直接适用所有Microchip PIC 系列单片机,
稍作改动即可移植到其他单片机上-This is applicable to I/O port simulation I2C procedures, directly applicable to all Microchip PIC MCU with slight modification to transplant to other single-chip on
本方法的基本思想就是利用单片机具有的PWM端口,在不改变PWM方波周期的前提下,通过软件的方法调整单片机的PWM控制寄存器来调整PWM的占空比,从而控制充电电流-The basic idea of this method is the use of microcontroller has the PWM ports, without changing the PWM square wave cycle, under the premise of the method to adjust by software MCU PWM control registers to adjust the PWM duty cycle and thus control the charge current
I2C串行总线元器件标准驱动程序的编写,可自己定义串行时钟线和串行数据线所在口-I2C serial bus driver standard components of the preparation, may own definition serial clock line and serial data line I