13.07.2015 Views

X25640_8Kb_Serial_EE.. - ISL

X25640_8Kb_Serial_EE.. - ISL

X25640_8Kb_Serial_EE.. - ISL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Using the Xicor <strong>X25640</strong> 8kB <strong>EE</strong>PROMBASIC Stamp I and Ver. D Program Listing (cont.)' ==================================================================' The subroutines for reading and writing the <strong>EE</strong>PROM.' ==================================================================' Shift data into Shreg.Shin:input DATA_Nlet Shreg=0for i = 1 to 8low CLKlet Shreg=Shreg*2let bit8=DATAhigh CLKnext ioutput DATA_Nreturn' Shift data out of Shreg.Shout:for i = 1 to 8low CLKlet DATA=bit15let Shreg=Shreg*2high CLKnext ireturn' Write <strong>EE</strong>data to <strong>EE</strong>addr.<strong>EE</strong>write:let Shreg = Write<strong>EE</strong>gosub Send_addrlet Shreg = <strong>EE</strong>datagosub Shouthigh CSreturn' Change the data line to input.' Clear data byte.' Prepare to get 8 bits.' Data valid on falling edge.' Shift Shreg to the left.' Move data to lsb of variable.' End of clock pulse.' Get another bit.' Restore data line to output.' Shift out 8 bits.' Clear clock bit.' Get bit 7 of Shreg.' Shift register to the left.' Data valid on rising edge of clock.' Send another bit.' Set up the write opcode.' Send it and the address.' Now send the data.' Deactivate the <strong>EE</strong>PROM.' Read data at <strong>EE</strong>addr and put it into <strong>EE</strong>data.<strong>EE</strong>read:let Shreg = Read<strong>EE</strong> ' Set up the read opcode.gosub Send_addr ' Send it and the address.gosub Shin' Now get the data.let <strong>EE</strong>data = Shreg ' Transfer from Shreg to <strong>EE</strong>data.high CS' Deactivate the <strong>EE</strong>PROM.returnsales / technical support (916) 624-8333 • fax (916) 624-8003pictech@parallainc.com • stamptech@parallaxinc.com Page 8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!