Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Hardware expansion
Data logging to Flash and RAM chips
Live website search
Enter key words



SST28SF040 is a 512k byte non-volatile Flash-EEPROM chip that goes in the 32-pin socket of the TDS2020F. Unlike a RAM, no back-up battery is needed and the stored data is safer from corruption:


q       Data logging up to 512k bytes

q       Storage of text and menus-can be changed separately from program

q       Images of Part 2 programs for copying to RAM in 28-pin socket

q       Storage of up to 17 full-size program overlays


In using the #28SF040.TDS support file, these additional files might also be useful to you:



for program and overlay storage.


fast moves from extended memory


This software is intended for use with SST28SF040 chip from Silicon Storage Technology Inc. The device can be written byte by byte, but can only be erased (set to hex FF) in either sectors of 256 bytes, or by erasing the whole chip. There is protection by software, which prevents accidental erasure, or byte writes. This is enabled at power-up and must be disabled before you can write to the device. Data retention is quoted by the manufacturer as 100 years minimum and the endurance as 100,000 cycles minimum.

The 32-pin Dual In Line package is placed in the 32-pin socket of the TDS2020F. Links must be changed as follows:


open links


with a sharp scalpel

close links


with a fine pointed soldering iron


The key operations you can undertake are:


q       To unprotect chip for write & erase SFEXPOSE

q       To protect chip from write & erase SFPROTECT

q       To read SST28SF040 chip use commands EC@ E@ 2E@ (unchanged)

q       To write SST28SF040 chip use commands EC! E! 2E! (as redefined in #28SF040.TDS) or for fastest speed use SFC! (53s)

q       To block write from base memory SFMOVE (45s per byte, e.g. for programs)

q       To erase whole SST28SF040 chip use command SFSCRUB (takes 24 seconds)

q       To erase one or more 256 byte sectors SFERASE (takes 12ms per sector)

q       To check write or erase operation SFERROR @ (read variable)


Before any write or erase operation, use SFEXPOSE to allow access. Reprotect the memory with SFPROTECT . The memory is always visible for read operations, and these use the standard extended memory read words.

To collect data to 28SF040 Flash-EEPROM chips, see REGULAR DATA LOGGING, page 264 to choose a collection scheme. Then use the words shown above to do the actual writing to the chip. Binary storage is more efficient than ASCII Comma Separated Variable (CSV) format and is more likely to be needed with chips than with the larger card memories. For example the following word !WORD uses SFC! to write a 16-bit number in binary to the Flash chip, updating a 32-bit pointer ready for the next data. The subsequent word SQUIRT is for recovery of data; it will send all the Flash chip content to the serial port. Note the unusual double exit used in this word, see CONTROL STRUCTURES, page 136.


2VARIABLE POINTER \ Point to next free location,

\ initialise with


\ in word executed at power-up


: !WORD ( u - ) \ Write u in binary format (250us)

DUP >< \ duplicate & swap bytes

POINTER 2@ 2DUP 2>R \ copy 32-bit memory address

SFC! \ store most significant byte

2R@ 1 M+ SFC! \ store least significant byte

2R> 2 M+ \ increment pointer

DUP $10 = \ check for hex 100000

IF 2DROP \ end of Flash chip

ELSE POINTER 2! \ store new pointer



: SQUIRT ( - ) \ Output all Flash chip bytes

\ to serial port

0 8 \ short way to put hex 80000.


DUP $10 <> \ get out at end of Flash chip

\ at hex 100000.


KEY? 0= \ get out on any key


2DUP EC@ EMIT \ read and send one byte

1 M+ \ increment Flash chip address

\ for next time


KEY DROP \ throw away exit keystroke

THEN 2DROP ; \ throw away memory address


You can put 128k or 512k byte RAM chips in the 32-pin socket. A battery can be attached to keep its data even when power is off. See NON-VOLATILE RAM, page 117.

Flash chips are generally to be preferred to RAM, but there are two situations in which you might want to use RAM chips to collect data:


q       The fastest possible speed is required.

q       You must have RAM in the 32-pin socket for other reasons, for example for extended variables, see ACCESSING EXTENDED MEMORY, page 115.


Use file #FASTEST.TDS as a model for very fast data logging when interrupts and Flash chips impose too big a time penalty. The word CAPTURE can collect data at the indicated speeds to RAM in the 32-pin socket.


q       81,933 8-bit samples/s, program in 28-pin socket, internal A-D
(needs external watchdog in inner loop)

q       200,646 8-bit samples/s, program in microprocessor RAM,
internal A-D

q       185,523 8-bit samples/s, program in 28-pin socket, external A-D

q       364,342 8-bit samples/s, program in microprocessor RAM,
external A-D


If the motivation for using RAM is not speed, but that it is already there, use any of the methods previously described. See REGULAR DATA LOGGING, page 264.

Go to Triangle Digital Support Home Page Go to top   Next page