Hi; Here is a set of sub-routines that I've use on a 16C57 and 16C62 to operate a 93LC46 or 93AA46 (8 bit data word not 16 bit). They have been cut from working code and were adapted from a Parallax ap-note and converted to MPASM. You should just have to change the number of clocks required to send the address data. ;*************************************************************** ; 93XX46 8 bit routines ; adapted from Parallax ap-note for 93LC56 ; converted to MPASM for PIC16C57 ;*************************************************************** ;Register Equates clocks equ 0x08 ;number of clock s for ee tima equ 0x09 ;timer i nner loop timb equ 0x0a ;timer o uter loop temp equ 0x0b ;general temp register ee_addr equ 0x0c ;ee addres ee_data equ 0x0d ;ee data ;Pin equates #define D portc,0 ;Pins DI and DO of the EEPROM #define CLK portc,1 ;Clock pin--data valid rising edge #define CS portc,2 ;Chip se lect--high = active ;pin DI of eeprom connected to portc,0 ;pin DO is connected through a 2.2K to portc,0 ;*************************************************************** ;Serial output routine for eerom ;*************************************************************** Shout rlf temp,1 ;Rotate bit7 of temp into carry btfss status,0 ;Move carry bit to input of EEPROM bcf d btfsc status,0 bsf d bsf CLK ;Clock the bit into EEPROM nop ;Clock must be high > 500 ns bcf CLK decfsz clocks,1 goto shout retlw 0x00 ;*************************************************************** ;EE Read, byte in ee_addr into ee_data. ;*************************************************************** EEread movlw RROP ;Move the read opcode into temp movwf temp movlw 0x03 movwf clocks ;Number of bits to shift out (op+1) bsf CS rshout rlf temp,1 ;Rotate bit7 of temp into carry btfss status,0 ;Move carry bit to input of EEPROM bcf d btfsc status,0 bsf d bsf CLK ;Clock the bit i nto EEPROM nop ;Clock must be h igh > 500 ns bcf CLK decfsz clocks,1 goto rshout movlw 0x07 movwf clocks movf ee_addr,0 movwf temp rlf temp,1 ;added RK rshout1 rlf temp,1 ;Rotate bit7 of temp into carry btfss status,0 ;Move carry bit to input of EEPROM bcf d btfsc status,0 bsf d bsf CLK ;Clock the bit i nto EEPROM nop ;Clock must be h igh > 500 ns bcf CLK decfsz clocks,1 goto rshout1 movlw 0x31 tris portc movlw 0x08 movwf clocks rshout2 bsf CLK btfss d bcf status,0 btfsc d bsf status,0 rlf temp,1 bcf CLK decfsz clocks,1 goto rshout2 movf temp,0 movwf ee_data movlw 0x30 tris portc bcf CS retlw 0x00 ;*************************************************************** ;Enabel ee writes ;*************************************************************** EEnable bsf CS movlw 0x0a movwf clocks movlw ewen movwf temp call Shout bcf CS retlw 0x00 ;*************************************************************** ;Write ee byte, writes the byte in ee_data to ee_addr. ;*************************************************************** EEwrite movlw wrop movwf temp movlw 0x03 movwf clocks bsf CS call Shout movlw 0x07 movwf clocks movf ee_addr,0 movwf temp rlf temp,1 ;added R K call Shout movlw 0x08 movwf clocks movf ee_data,0 movwf temp call Shout bcf CS retlw 0x00 ;*************************************************************** ;EE Busy ;*************************************************************** Busy nop movlw 0x31 tris portc bsf CS busy1 btfss D goto busy1 bcf CS movlw 0x30 tris portc retlw 0x00 ;*************************************************************** ;Disable ee writes ;*************************************************************** EEdisbl bsf CS movlw 0x0a movwf clocks movlw ewds movwf temp call Shout bcf CS retlw 0x00 ;*************************************************************** ;EE Write, byte in EE_data to every address of the EEPROM. ;*************************************************************** EEwrall bsf CS movlw wral movwf temp movlw 0x0a movwf clocks call shout movlw 0x08 movwf clocks movf ee_data,0 movwf temp call shout bcf cs retlw 0x00 At 11:55 AM 11/25/98 -0800, you wrote: >I am looking for both information and code if available. I am currently >using a 17C series part to interface to a Microchip 93AA66 EEPROM >(trying to anyway). The data book timing waveforms show different >clocking than the descriptions. For example, the timing diagrams show >that when Reading, data bits are clocked in on the negative edge >(falling) while the description specifically says that "Opcode, address, >and data bits are clocked in on the positive edge fo the CLK. Data bits >are also clocked out on the positive edge of the CLK." >Huh???? The same problem comes up when Writing to the EEPROM as well. > >So..., does anyone have code to read and write to a 93AA46/56/66 part? >Can I have a look at it? > >Comments please. > >John Bellini > ****************************** Richard Katezansky Tangent Electronics Ltd. Montreal, Canada ******************************