PIC单片机的I2C读写程序
PIC单片机的I2C读写程序
****************************************
* PIC的I2C读写程序 *
****************************************
TITLE " TWO WIRE/I2C BUS INTERFACE WITH PIC16C5x "
;
LIST P=16C54
;
;*****************************************************************************
;** Two wire/I2C Bus READ/WRITE Sample Routines of Microchip's
;** 24Cxx / 85Cxx serial CMOS EEPROM interfacing to a
;** PIC16C54 8-bit CMOS single chip microcomputer
;** Revsied Version 2.0 (4/2/92).
;**
;** Part use = PIC16C54-XT/JW
;** Note: 1) All timings are based on a reference crystal frequency of 2MHz
;** which is equivalent to an instruction cycle time of 2 usec.
;** 2) Address and literal values are read in octal unless otherwise
;** specified.
;
;
; Program: I2CBUS.ASM
; Revision Date:
; 12-12-95 Compatibility with MPASMWIN 1.30
;
;**********************************************************************
;
;*****************************************************************************
;
;-----------------------------------------------------------------------------
; Files Assignment
;-----------------------------------------------------------------------------
;
PC EQU 2 ; Program counter
STAT EQU 3 ; PIC status byte
FSR EQU 4 ; File Select Register
RA EQU 5 ; Port A use to select device address
RB EQU 6 ; RB7 = SDA, RB6 = SCL
;
STATUS EQU 08 ; Status register
FLAG EQU 09 ; Common flag bits register
EEPROM EQU 0A ; Bit buffer
ERCODE EQU 0B ; Error code (to indicate bus status)
ADDR EQU 10 ; Address register
DATAI EQU 11 ; Stored data input register
DATAO EQU 12 ; Stored data output register
SLAVE EQU 13 ; Device address (1010xxx0)
TXBUF EQU 14 ; TX buffer
RXBUF EQU 15 ; RX buffer
COUNT EQU 16 ; Bit counter
;
TIMER0 EQU 18 ; Delay timer0
TIMER1 EQU 19 ; Delay timer1
;
;
;-----------------------------------------------------------------------------
; Bit Assignments
;-----------------------------------------------------------------------------
;
; Status bits
;
Z EQU 2
C EQU 0
;
; FLAG Bits
;
ERR1 EQU 0 ; Error flag
;
; Instruction Destination Bits
;
F EQU 1
W EQU 0
;
; EEPROM Bits
;
DI EQU 7 ; EEPROM input
DO EQU 6
; EEPROM output
;
; I2C Device Bits
;
SDA EQU 7 ; RB7, data in/out
SCL EQU 6 ; RB
你可能喜欢
- PIC单片机C语言编程实例
- 模拟I2C程序
- 中文资料
- SPI总线
- PIC单片机C语言编程实例一12页
- PIC单片机C语言编程实例——液晶显示模块编程4页
- PIC单片机C语言编程实例——液晶显示模块编程11页
- PIC单片机C语言编程实例一12页
- PIC单片机C语言编程实例24页
- PIC单片机C语言编程实例12页
- PIC单片机的模拟I2C通信的源程序5页
- 非常实用的模拟I2C程序8页
- C51单片机模拟I2C总线驱动程序设计8页
- STM32_ADS1110的通讯程序IO口模拟I2C5页
- PIC单片机模拟I2C接口程序6页
- 单片机模拟I2C总线汇编程序软件包8页
- 7407中文资料2页
- LCD12864中文资料5页
- at89c1051中文资料12页
- LCD1602中文资料6页
- 595中文资料5页
- 最全的L298中文资料14页
- SPI总线协议及SPI时序图详解7页
- SPI总线协议27页
- SPI总线4页
- SPI总线解剖详解7页
- SPI总线协议及SPI时序图详解5页
- IIC和SPI总线5页


