| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
following routines used interfacing EEPROM easily adapted many differe
Top Searches for this datasheetInterfacing Xicor's X84641/129 MPSEEPROMs following routines used interfacing EEPROM easily adapted many different hardware platforms. Figure shows typical interface circuit. Depending position jumpers EEPROM memorymapped into address banks determined jumper J2). Jumper determines exact address within bank. This allows address chosen following ranges: 301h-307h, 309h-30Fh, 311h-317h, 319h-31Fh. single unused address AN95 selected bank (i.e. 300h, 308h, 310h, 318h) reserved flip-flop used toggle pin. This glue logic only necessary provide generic interface EEPROM. such applications, much this logic already exist target card eliminated with user supplied strobe (i.e. jumper J3). This code obtained from www.xicor.com. Figure Circuitry used interface with X84641 X84129. June, 2000 www.xicor.com Code Xicor's X84641/129 family EEPROMs (for example, save these routines file called "xicor.c") following subroutines provided interface with Xicor's family high density EEPROMs. This code written perform with X84641 (64K bits) X84129 (128K bits) devices. This code should also compatible with future devices this family with only trivial changes. This code tested using XK84 development system hardware, which consists standard interface card with address decoding logic shown Figure This software interfaces device that been memory mapped into this compatible space. With these subroutines, designer read multiple data bytes from X84641/129 using simple function call: read_X84MPS(int no_bytes,int addr,int io_port,unsigned char *bytes) number bytes (no_bytes) read sequentially from starting address (addr) X84641/129 mapped into given address (io_port). results passed back sequentially series system locations pointed (bytes). Care should taken provide enough locations each data byte read. Additionally, either byte write page write X84641/129 initiated with following call: write_X84MPS(int no_bytes,int addr,int io_port,unsigned char *bytes) bytes specified no_bytes) written X84641/129 address (io_port) beginning memory address (addr). Sending more than bytes will cause "wrap-around" data chosen page. data written contained array (pointed *bytes). These routines appended other ANSI code with following similar) compiler directive: #include "c:\xicor.c" Note that source code should have #include <dos.h> statement since code (xicor.c) needs access inportb() outportb() functions. AN95 Sends RESET sequence X84641/129 io_port void x84reset(int io_port) inportb(io_port);/* read from io_port June, 2000 www.xicor.com outportb(io_port,0x00);/* write io_port inportb(io_port);/* read from io_port Writes X84641/129 io_port void x84write_one(int io_port) outportb(io_port,0xff);/* write HIGH io_port Writes zero X84641/129 io_port void x84write_zero(int io_port) outportb(io_port,0x00);/* write io_port*/ Reads from X84641/129 io_port x84read(int io_port) bit_val; bit_val inportb(io_port) 1;/* read from io_port return(bit_val);/* return value calling routine Polls early completion nonvolatile write cycle X84641/129 io_port void x84poll(int io_port) bit_temp; bit_temp=x84read(io_port);/* continuously read bits until HIGH while (bit_temp Initiates completes nonvolatile write cycle X84641/129 io_port void x84write_start(int io_port) x84read(io_port);/* read from io_port x84write_one(io_port);/* write HIGH io_port x84read(io_port);/* read from io_port x84poll(io_port);/* poll completion write cycle Sends required address bits, including unused upper address bits, X84641/129 io_port void x84addr_send(int unused_bits,int io_port,int addr) addr_bit,mask_addr,addr_temp; (addr_bit addr_bit unused_bits; addr_bit++) AN95 June, 2000 www.xicor.com x84write_zero(io_port);/* loop send unused bits mask_addr 4096;/* mask isolate address mask_addr 4096 X84641 mask_addr 8192 X84129 mask_addr 1024 X84161 (addr_bit addr_bit (16-unused_bits); addr_bit++) loop through address bits addr_temp addr mask_addr;/* mask determine next required address (addr_temp 0)/* address LOW, then x84write_zero(io_port);/* write io_port else x84write_one(io_port);/* otherwise, write HIGH io_port mask_addr mask_addr 1;/* shift mask right next Sends data bits X84641/129 io_port void x84data_send(int io_port,int data) mask_data,data_temp,data_bit; mask_data 128;/* mask isolate data (data_bit data_bit data_bit++) loop through data bits data_temp data mask_data;/* mask determine next required data (data_temp 0)/* data LOW, then x84write_zero(io_port);/* write io_port else x84write_one(io_port);/* otherwise, write HIGH io_port mask_data mask_data 1;/* shift mask right next AN95 Reads data bits from X84641/129 io_port reconstructs databyte x84data_get(int io_port) n,bit_temp[9]; bit_temp[0]=0;/* clear array position resetting previous (n=1;n<9;n++) loop through data bits*/ bit_temp[n] current position, shift previous data bits left, read next bit, previous sum, store result return(bit_temp[8]);/* return data byte value June, 2000 www.xicor.com calling routine General READ master routine that called user order read number bytes from X84641/129 io_port void read_X84MPS(int no_bytes,int addr,int io_port,unsigned char *bytes) density; density 3;/* density X84641*/ density X84129 density X84161 x84reset(io_port);/* reset X84161/641/129 send address bits (n=0;n<no_bytes;n++) loop through bytes read (no_bytes) receive each byte store sequentially General WRITE master routine that called user order write number bytes X84641/129 io_port void write_X84MPS(int no_bytes,int addr,int io_port,unsigned char *bytes) density; density 3;/* density X84641 density X84129 density X84161 x84reset(io_port);/* reset X84161/641/129 send address bits for(n=0;n<no_bytes;n++) loop through bytes written (no_bytes) sequentially send each byte }x84write_start(io_port); initiate nonvolatile write cycle Main listing example utilize these functions When used larger program, following include directives must included prior compilation. example shows page write length bytes being initiated address 0x021 X84641 memory mapped address 0x303. Data written stored sequentially send_buffer. Similarly, consecutive bytes read from this X84641 starting address 0x01F stored receive_buffer. loading send_buffer[] explicitly shown. AN95 June, 2000 www.xicor.com #include <dos.h> #include <c:\xicor.c> unsigned char send_buffer[32];/* worst case buffer sizes needed unsigned char receive_buffer[8192];/* X84641/129 protocol receive_buffer[8192] receive_buffer[16384] X84129 receive_buffer[2048] main outportb(0x300,0xff);/* only used setting HIGH XK84 AN95 June, 2000 www.xicor.com Other recent searchesLCM12232B - LCM12232B LCM12232B Datasheet D65ZOV321RA160 - D65ZOV321RA160 D65ZOV321RA160 Datasheet CP-88-2 - CP-88-2 CP-88-2 Datasheet AN3025 - AN3025 AN3025 Datasheet 3KP22AS - 3KP22AS 3KP22AS Datasheet
Privacy Policy | Disclaimer |