The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

Gray Creager, 1996 following code intended provide generic routines th


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Interfacing X24F128 2-Wire SerialFlash Memory
Gray Creager, 1996 following code intended provide generic routines that used with Xicor's 3-byte protocol C-compatible memory devices. This code written (and tested with) X24F128 SerialFlash memory, will also compatible with future 3byte protocol SerialFlash memories. Figure shows circuit used test debug this code from Centronics parallel printer port generic code implements complete operations device, including ability independently access PEL, RPEL, WPEN, BL1, bits Program Protect Register (PPR). allow compatibility with future devices, write routine implemented assuming variable sector size. This allows same routine handle sector writes
AN84
bytes each memory array, simply passing sector size variable during routine call. correct each these routines explained demonstrated within attached code. Downloadable code from this application notes obtained from Xicor's BBS, which reached toll free 1-800-258-8864, (408) area code internationally 1-408-943-0655. Xicor's will support 19.2K baud rate modem parity, words, stop bit, local echo). These listings found MISC (Special Interest Group). Xicor application notes also available through Xicor's FaxBack system (408) 954-1627 World Wide URL, http://www.xicor.com).
Connector DB25
74LS07
Figure Simple interface between 2-wire serial memories parallel printer port
SerialFlash
trademark Xicor, Inc.
Xicor, Inc. 1511 Buckeye Drive Milpitas, 95035 (408) 432-8888
AN84-1
Xicor Software Xicor's X24F128 Two-Wire SerialFlash memory This code written tested with port diagram given this application note. Because capacitive port delays test computer, delays have been added guarantee that setup times met. These deleted systems without this problem. This code contains routines necessary implement this interface. #include <stdio.h> #include <stdlib.h> data_port 0x3bc; status_port 0x3bd; unsigned char control 0xff; unsigned char slave_w 0xa0; unsigned char slave_r 0xa1;
AN84
test computer printer port output address test computer printer port input address slave address writes (S2,S1,S0=0) slave address reads (S2,S1,S0=0)
void SCL_high(){ control control 0x04; port outportb(data_port, control); delay(1); compensate high capacitance void SCL_low(){ control control 0xfb; reset port outportb(data_port, control); delay(1); compensate high capacitance void SDA_high(){ control control 0x02; outportb(data_port,control); delay(1); void SDA_low(){ control control 0xfd; outportb(data_port,control); delay(1); void start(){ SDA_high(); SCL_high(); SDA_low(); SCL_low();
port compensate high capacitance
reset port compensate high capacitance
generate start condition
AN84-2
Xicor void stop(){ SDA_low(); SCL_high(); SDA_high(); unsigned char clock(){ unsigned char SDA_value; generate stop condition
AN84
generate clock pulse read
SCL_high(); SDA_value inportb(status_port); SDA_value SDA_value 0x80; SCL_low(); SDA_value SDA_value return(SDA_value); void ack(){ SDA_low(); clock(); void nack(){ SDA_high(); clock(); void out_byte(unsigned char byte){ char count;
read parallel port isolate shift return data
master sends acknowledge
master receives acknowledge
master sends byte
(count count count++){ send data byte device ((byte 0x80) time SDA_low(); else SDA_high(); byte byte shift next clock(); unsigned char get_byte(){ count; unsigned char byte,temp; master receives byte
byte (count count count++){ read data byte from device byte byte time SDA_high(); temp clock(); input from port (temp byte byte 0x01; return(byte); return data byte
AN84-3
Xicor void ack_poll(){ unsigned char poll; start(); out_byte(slave_w); SDA_high(); poll clock(); while (poll stop(); void dummy_write(int addr){ temp; start(); out_byte(slave_w); nack(); (addr 0xffff) check acknowledge from slave
AN84
polling loop slave address check level repeat while HIGH stop
slave address writes accessing program protect register? construct first address byte
temp ((addr 0x3f00) out_byte(temp); nack(); temp addr 0xff; out_byte(temp); else out_byte(0xff); nack(); out_byte(0xff); nack();
construct second address byte
send program protect register address
Sequential read routine that handles read operations. current address reads, current addr don't care when calling routine, otherwise addr starting address *bytes points buffer where data stored later use. no_bytes number bytes sequentially read from SerialFlash. void seq_read(int current,int no_bytes,int addr,unsigned char *bytes){ temp; (current dummy_write(addr); start(); random read? yes, send address
AN84-4
Xicor out_byte(slave_r); nack(); no_bytes n++){ bytes[n] get_byte(); ack(); bytes[no_bytes get_byte(); stop(); Sequential write routine handles write operations. no_bytes number bytes write, starting address (addr), takes data from buffer pointed *bytes. This routine written allow variable sector sizes ensure compatibility with future devices with minimum changes. When writing X24F128 SerialFlash memory array, no_bytes should always void seq_write(int no_bytes,int addr,unsigned char *bytes){ unsigned char temp; dummy_write(addr); no_bytes; n++){ out_byte(bytes[n]); nack(); stop(); ack_poll(); write routine allows reset. this bit, call this routine write_PEL(1) reset this call this routine write_PEL(0) void write_PEL(int state) dummy_write(0xffff); (state out_byte(0x02); else out_byte(0x00); nack(); stop(); send address loop send data bytes slave address read sequentially read data loop send acknowledges
AN84
last databyte, don't send acknowledge
begin nonvolatile write cycle poll cycle completion
write program protect register state then reset
AN84-5
Xicor RPEL write routine allows RPEL reset. this bit, call this routine write_RPEL(1); reset this call this routine write_RPEL(0); unlikely that need reset RPEL will arise, however possibility provided routine. void write_RPEL(int state) dummy_write(0xffff); (state out_byte(0x06); else out_byte(0x02);
AN84
write program protect register state then RPEL RPEL reset RPEL note that call this routine with state then you'll setting PEL!
nack(); stop(); program routine allows PPEN, BL0, bits program protect register. This routine will have effect unless RPEL bits when called. PPEN HIGH, this routine will have effect because status register will locked. program_PPR(PPEN,BL1,BL0); bit, its' position reset bit, its' position call this routine, substitute desired values each register this example: program_PPR(0,1,1); resets PPEN sets both void program_PPR(int PPEN, BL1, BL0){ temp; dummy_write(0xffff); temp (PPEN temp temp 0x80; (BL1 temp temp 0x10; write program protect register necessary bits
AN84-6
Xicor (BL0 temp temp 0x08; out_byte(temp 0x02); nack(); stop(); ack_poll(); Simple program demonstrate these routines. main(){ unsigned char data1[] unsigned char data2[] unsigned char data3[512]; unsigned char data4[1]; write_PEL(1); write_RPEL(1); program_PPR(0,0,0); seq_read(0,1,0xffff,&data4); seq_write(32,0,&data1); seq_write(32,32,&data2); seq_read(0,64,0,&data3); seq_write(32,0,&data2); seq_read(0,32,0,&data3); write_RPEL(1); program_PPR(0,1,1); seq_read(0,1,0xffff,&data4); seq_write(32,32,&data1); seq_read(0,32,32,&data3); write_RPEL(1); program_PPR(0,0,0); seq_read(0,1,0xffff,&data4); seq_read(0,32,0,&data3); seq_read(1,32,0,&data3); seq_write(32,0,&data1); seq_read(0,32,0,&data3);
AN84
write PPEN, BL1, bits, reset RPEL, leave
poll cycle completion
buffer store bytes from SerialFlash
RPEL write (PPEN,BL1,BL0)*/ read write first sector write second sector random read sectors verification writes sector write verify sector RPEL write BlockLock entire array read verify attempt sector write verify sector changed RPEL write turn BlockLock read random read sector current address read sector sector write random read sector
AN84-7

Other recent searches


Unit-12s - Unit-12s   Unit-12s Datasheet
S1C17706 - S1C17706   S1C17706 Datasheet
MRF8S9260H - MRF8S9260H   MRF8S9260H Datasheet
ICS8316 - ICS8316   ICS8316 Datasheet
DTC125TUA - DTC125TUA   DTC125TUA Datasheet
CY53120 - CY53120   CY53120 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive