Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Forth word list
S" to SWAP,
Live website search
Enter key words
 

S"                    ANS

 

COMPILATION:   'ccc<quote>' -

Parse ccc delimited by double quote. Append the run-time action below to the current definition.

 

RUN-TIME:   - ca u

Return ca and u describing string ccc. A program may not change the string-it might be addressed in a locked Flash-EEPROM or PROM.

 

S1BYTE

 

b -

 

For I2C bus peripherals. Sends one byte to an I2C device. Sets both clock and data to be output. It then issues 8 positive-going clock pulses, setting an appropriate level on the data output (from the input byte) before each one. See I2C! .

 

S>D                    ANS

 

n - d

 

Convert 16-bit number n to 32-bit d.

 

SAVE-INPUT                    ANS

 

- File #ANS.TDS needed -

 

- xn.x1 n

 

x1 to xn describe the current input source for later use by RESTORE-INPUT .

 

SCAN

 

- File #EXTEND.TDS needed -

 

ca1 u1 char - ca2 u2

 

Shorten character string at ca1. The resulting string, specified by ca2 u2, begins at the first character in the first string that is equal to char. See also SKIP .

 

SCB/EQ,

 

-

 

Assembler instruction, see assembler section and SCB in Programming Manual. This syntax example is TDS2020F coding of an example in the Programming Manual under SCB:

VARIABLE TEMP

CODE TEST \ ( addr1 - addr2 )

 \ Search for ASCII A in a

 \ block 9 bytes long

 \ starting with addr 1.

 \ addr2 is position if found

@R7+ R4 MOVI, \ start addr

              \ of string

9 ## R3 MOVI, \ length of

              \ string

HERE TEMP !   \ keep start

              \ of loop

B @R4+ "A ## CMPIM, \ look

              \ for ASCII A

TEMP @ R3 SCB/EQ, \ loop if

              \ not A AND not

              \ end of string

@-R7 R4 MOVO, \ push

        \ position+1 or end+1

END-CODE

Note: Most loops should use BEGIN, . UNTIL, but the above is faster.

 

SCB/F,

 

-

 

Assembler instruction, see assembler section and SCB in Programming Manual. Note: Most loops should use BEGIN, . UNTIL, . Syntax example:

CODE REST ( u - ) \ Short

                  \ delay

@R7+ R3 MOVI, HERE R3 SCB/F,

END-CODE

 

SCB/NE,

 

-

 

Assembler instruction, see assembler section and SCB in Programming Manual. Note: Most loops should use BEGIN, . UNTIL, . See SCB/F SCB/EQ .

 

SEARCH                    ANS

 

- File #ANS.TDS needed -

 

ca1 u1 ca2 u2 - ca3 u3 flag

 

Search the string specified by ca1 u1 for the string ca2 u2. If flag is true a match was found at address ca3 with u3 characters remaining. If flag is false there was no match and ca3 is ca1 and u3 is u1.

 

SECONDS

 

n -

 

Set up a Non-Masked Interrupt to occur after n seconds. n is 1 to 99. Use it to get out of the low-power standby mode. E.g.

 HEX

: TEST

 10 0 DO 0 A-D

        80000. I M+ E!

        2 SECONDS STANDBY

      2 +LOOP ;

On execution of TEST 5 samples of A to D converter channel 0 will be taken, one every two seconds and stored to address pairs in a RAM in the 32-pin socket starting at hex 80000. Power will be low most of the time since the loop rests inside STANDBY . See library files #TIMED.TDS and #ALARMS.TDS for better low-power loops.

 

SET

 

-

 

Use once, interactively after compilation. It sets up cold-start parameters to turn the system into a stand-alone one-i.e. so that it will power-up into your application program instead of the Forth interpreter. Ensure you don't have SET WORK in your source code, it should be typed interactively (here WORK is the word to be executed at power�-up. When using a Flash-EEPROM the program starts to execute at once. The Flash-EEPROM has now been protected-it is locked against accidental writes. See SUMMARY PROCEDURE, page 232.

 

SHAL,

 

-

 

Assembler instruction, see assembler section and SHAL in Programming Manual. Syntax example:

B $FF00 SHAL, \ Shift byte at

 \ hex FF00 left into carry

 \ with bit 0 set to 0

 

SHAR,

 

-

 

Assembler instruction, see assembler section and SHAR in Programming Manual. Syntax example:

$FF00 SHAR, \ Shift word at

 \ hex FF00 right into carry

 \ with bit 15 set to same

 \ as 14

 

SHIFT

 

r/l s/c -

 

Moves a message and/or cursor left or right on an alphanumeric LCD display. s/c = 1 to shift both message and cursor or 0 for cursor only. r/l = 1 for right or 0 for left. SHIFT is useful for showing a long message on a short display. The message can be made to move left along the display, or (with extra software) to rotate continuously.

 

SHLL,

 

-

 

Assembler instruction, see assembler section and SHLL in Programming Manual. Same as SHAL, but status bit V set to 0.

 

SHLR,

 

-

 

Assembler instruction, see assembler section and SHLR in Programming Manual. Syntax example:

$FF00 SHLR, \ Shift word at

 \ hex FF00 right into carry

 \ with bit 15 set to 0

 

SIGN                    ANS

 

n -

 

SYNTAX: <# . SIGN . #>

If n is negative, add a minus sign to the beginning of the pictured numeric output string. Must be used within a <# . SIGN . #> structure.

 

SKIP

 

- File #EXTEND.TDS needed -

 

ca1 u1 char - ca2 u2

 

Shorten character string at ca1. The resulting string, specified by ca2 u2, begins at the first character in the first string that is not equal to char. See also SCAN .

 

SLEEP,

 

-

 

Assembler instruction, see assembler section and SLEEP in Programming Manual. Often better to use the high-level Forth word STANDBY . Syntax example:

SLEEP, \ Enter power-down

 \ mode until exception

 \ request is made

 

SLITERAL                    ANS

 

- File #ANS.TDS needed -

 

COMPILATION:   ca1 u -

Append the run-time action below to the current definition.

 

RUN-TIME:   - ca2 u

Return ca2 u describing a string defined by ca1 u during compilation. A program must not alter the returned string-it might be addressed in a locked Flash-EEPROM or PROM.

 

SM/REM                    ANS

 

d1 n1 - n2 n3

 

Divide 32-bit signed number d1 by 16-bit signed number n1 giving 16-bit signed quotient n3 and 16-bit signed remainder n2. Symmetric division.

 

SMH>

 

secs mins hrs - d

 

Converts three numbers on the stack representing hours, minutes and seconds to a double number. This is the equivalent number of 'ticks' since midnight, where one 'tick' is either 53.3333ms (1125 per minute) or one second (60 per minute). See TICKS for details. The hours range is 0 to 23. No range checking is done on any of the inputs.

 

SMUDGE

 

-

 

Toggle the findable/not findable flag in the last defined word (unless unnamed).

 

SOURCE                    ANS

 

- ca u

 

ca is the address of, and u is the number of characters in, the input buffer. At power-up SOURCE is vectored through 'SOURCE to execute <SOURCE> .

 

SOURCE-ID                    ANS

 

- File #ANS.TDS needed -

 

- 0 or

- -1

 

Identify input source.
  -1 from a string by use of
EVALUATE
  0 from user input device by use of QUIT .

 

SP!

 

aa -

 

Set stack pointer to address aa.

 

SP0

 

- aa

 

Address containing base of stack.

 

SP@

 

- aa

 

Get stack pointer address aa.

 

SPACE                    ANS

 

-

 

Display one space.

 

SPACES                    ANS

 

n -

 

If n is greater than zero, display n spaces.

 

SPAN                    ANS

 

- aa

 

aa is the address of a cell containing the count of chars from last EXPECT .

 

SR

 

-

 

An assembler word. Indicates the Status Register.

 

STANDBY

 

-

 

Puts the microprocessor into low-power standby mode and turns off the power to the RS232 serial driver chip. The TDS2020F now takes only 155�A typically (without any external serial or parallel port loads). By default, the NMI coming from the PCF8583 clock chip will within 1 second cause recovery. However this can be reprogrammed before STANDBY is executed so that recovery is delayed from 30ms to up to a year, see files #TIMED.TDS and #ALARMS.TDS and SECONDS . Execution continues with the Forth word after STANDBY and power is restored to the RS232 driver.

 

START

 

?1 -   R:  ?2 -

 

Entry to interactive Forth. Sets up system variables, clears stacks and screen and indicates version number before entering the QUIT interactive loop.

 

STARTI2C

 

-

 

For I2C bus peripherals. Issued at the start of an I2C command. Sets both I2C ports to output. Pulls data, then clock to logic 0. See I2C! .

 

STATE                    ANS

 

- aa

 

aa is the address of a cell containing the compilation state flag. STATE is true when in the compilation state, false otherwise. The true value of STATE is hex C0 in the TDS2020F. Only the following words alter the value in STATE :

 :  ;  ABORT QUIT  

 :NONAME  [  ] ;CODE

 

STATUS

 

- aa

 

Returns address of the first byte of the current user area. Here there are 6 free bytes for use by the multitasker followed by USER variables.

 

STC,

 

-

 

Assembler instruction, see assembler section and STC in Programming Manual. Syntax examples:

@-R7 SR STC, \ Push status

 \ register to stack

CODE PRIORITY ( n - )

       \ Set priority level n

 R3 SR STC,  \ status

             \ register to R3

 F8FF ## R3 AND, \ priority

             \ bits to 000

 B R3 SWAP,  \ swap R3 bytes

 @R7+ R3 OR, \ merge SR &

             \ priority

 R3 SWAP,    \ swap bytes

             \ again

 R3 SR LDC,  \ put back to

             \ status register

END-CODE

 

STM,

 

-

 

Assembler instruction, see assembler section and STM in Programming Manual. Syntax example:

B $19 STM, \ Store registers

  \ 0 3 and 4 to stack.

  \ Appropriate bits are set

  \ in the operand byte

 

STOPI2C

 

-

 

For I2C bus peripherals. Issued at the end of an I2C command. Sets both I2C ports to output. Pulls clock then data to logic 1. See I2C! .

 

SUB,

 

-

 

Assembler instruction, See assembler section and SUB in Programming Manual. Syntax examples:

B R2 R3 SUB, \ Take R2 from

  \ R3, lower bytes only

$FF00 )) R3 SUB, \ Subtract

  \ word at FF00 from R3

 

SUBS,

 

-

 

Assembler instruction, see assembler section and SUBS in Programming Manual. Syntax example:

B R2 R3 SUBS, \ Subtract

 \ lower byte of R2 with sign

 \ extension from word in R3

 

SUBX,

 

-

 

Assembler instruction, see assembler section and SUBX in Programming Manual. Syntax example:

W $FF00 )) R3 SUBX,

 \ Subtract word at hex FF00

 \ and carry bit from word

 \ in R3

 

SWAP                    ANS

 

x1 x2 - x2 x1

 

Exchange the top two stack items.

 

SWAP,

 

-

 

Assembler instruction, see assembler section and SWAP in Programming Manual. Syntax example:

B R3 SWAP, \ Swap the two

  \ bytes of register R3

 

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