banksel I2C_Ctrl
movlw EEPROM_CMD ; Load EEPROM command address @ 0xA0
movwf I2C_Ctrl
movlw 0x00 ; Select EEPROM location at 0x00
movwf I2C_Addr
movlw 0xAA ; Write data 0x5A to location 0x00 of EEPROM
movwf I2C_Data
call EE_Byte_Write
;
Test2 call EE_Ack_Check ; Polling Acknowledge for next access
;
banksel I2C_Data
movlw 0x00 ; Clear I2C data buffer
movwf I2C_Data
;
Test3
banksel I2C_Ctrl
movlw EEPROM_CMD ; Load EEPROM command address @ 0xA0
movwf I2C_Ctrl
movlw 0x00
movwf I2C_Addr
call EE_Random_Read
;
goto $
;
;
;******************************************************
;* Random Read a Byte from EEPROM
;*
;* Input:
;* - I2C_Ctrl : Control Byte of一体电感器 EEPROM
;* - I2C_Addr : Location of EEPROM
;* Output:
;* - I2C_Data : Read Data from EEPROM
;******************************************************
;
; Send Command for RANDOM READ :
; " Start+ 0xA0 + EE_Address + ReStart + 0xA1 + Read_Data + NAck + Stop "
;
EE_Random_Read
call StartI2C ; Set SSPCON2.SEN
;
bcf I2C_Ctrl,0 ; set for write Command
movf I2C_Ctrl,W ; Send Slave Address to I2C Bus
call Send_Byte
;
movf I2C_Addr,W ; Send out the Rendom address of EEPROM
call Send_Byte
;
call RstartI2C ; Send a Repeat Start to I2C
;
bsf I2C_Ctrl,0 ; set for Read Command
movf I2C_Ctrl,W ; Send Slave Address to I2C Bus
call Send_Byte
;
call RecI2C ; Enable I2C Receive
;
BANKSEL SSPBUF
movf SSPBUF,W ; Save to I2C_Data First !!
movwf I2C_Data
call Non_Ack ; Initial NACK Response !!
call StopI2C ; Initial滤波电感器 STOP Condition
return
;
;***************************************************************
;* Sequential Read from EEPROM
;*
;* Input:
;* - I2C_Ctrl : Control Byte of EEPROM
;* - I2C_Addr : Start Location of EEPROM
;* - I2C_Page_Length : How many byte need to read
;* Output:
;* - I2C_SEQU_Buffer : Sequential Read Data buffer
;*
;***************************************************************
;
; Send Command for RANDOM READ :
; " Start+ 0xA0 + EE_Address + ReStart + 0xA1 + Read_Data + NAck + Stop "
;
EE_SEQU_Read
call StartI2C ; Set SSPCON2.SEN
;
bcf I2C_Ctrl,0 ; set for write Command
movf I2C_Ctrl,W ; Send Slave Address to I2C Bus
call Send_Byte
;
movf I2C_Addr,W ; Send out the Rendom address of EEPROM
call Send_Byte
;
call RstartI2C ; Send a Repeat Start to I2C
;
bsf I2C_Ctrl,0 ; set for Read Command
movf I2C_Ctrl,W ; Send Slave Address to I2C Bus
call Send_Byte
;
movlw I2C_SEQU_Buffer
movwf FSR
;
_Sequ_Loop call RecI2C ; Enable I2C Receive
BANKSEL SSPBUF
movf SSPBUF,W ; Save to I2C_Data First !!
movwf INDF
incf FSR,F
decfsz I2C_Page_Length,F
goto _Cont_Read
goto _End_Read
_Cont_Read call An_Ack
goto _Sequ_Loop
;
_End_Read call Non_Ack ; Initial NACK Response !!
call StopI2C ; Initial STOP Condition
return
;
;******************************************************
;* EEPROM Acknowledge Polling
;*
;* -- The routine will polling the ACK
;* respon电感器生产厂家se from EEPROM
;* -- ACK=0 return
;* -- ACK=1 send Restart & loop check
;*
;******************************************************
;
EE_Ack_Check
call StartI2C ; Set SSPCON2.SEN
bcf I2C_Ctrl,0 ; Clear for Write Command
movf I2C_Ctrl,W ; Send Slave Address to I2C Bus
call Send_Byte
_Ack_Polling
BANKSEL SSPCON2
btfss SSPCON2,ACKSTAT ; Check ACKSTAT bit , 0 = ACK , 1 = NACK
goto ACK_Return ; Ack = 0 ; EEPROM is Ready
_Ack_Hi ; Ack = 1 ; EEPROM is Busy for Write
插件电感器
call Delay_mS ; Delay 500uS for next Ack polling
基于微控制器的数字式温度伺服控制系统 摘要:温度伺服控制系统是数码变温空调的一个重要的子系统,是数码变温空调的执行机构。本文根据数码变温空调的工作原理,提出了一种基于ARM微控制器的全数字式温度伺服控制系统。温度伺服系统硬件电路是以基于
蓝牙无线电调制解调器Siw1701原理与应用 摘要:Siw1701无线电调制解调器是用来解决蓝牙无线通信用的单片集成电路。芯片内部包含一个2.4GHz无线电收发器、GFSK调制解调器和数字控制功能电路。Siw1701可与Siw1750/1760
基于XC164CM的汽车电动助力转向系统前言 近年来, 动力转向系统已成为一些轿车的标准设置,全世界约有一半的轿车采用动力转向。随着汽车电子技术的发展,目前一些轿车已经使用电动助力转向系统(EPS),使汽车的经济性、动力性和机动性都有所提高