INTRODUCTION TO TDS2020F
ABOUT THIS MANUAL
This manual helps you use the TDS2020F Forth computer, a small (100 x 80mm) board for dedicated applications. You write your application software and compile it into a Flash-EEPROM, a non-volatile memory chip. The board is embedded in the equipment you are making and when power is applied, your software starts to run.
The manual does not cover the Forth language. If Forth is new to you it would help to get 'Forth Programmer's Handbook', the manual carries on where the book leaves off. We include a list of Forth words used and most of the manual is concerned with aspects particular to this computer such as interrupts, assembler routines, and multitasking. Creating a stand-alone system and off-card hardware and software extensions are covered. There are many examples such as use of Liquid Crystal Displays, keypads and PCMCIA data logging.
In the manual Forth words are printed LIKE THIS and PC commands and responses are shown LIKE THIS. Many Forth words are included twice; the WORD LIST, page 356 has a full description and sections such as LIQUID CRYSTAL DISPLAYS group words with related application. In Forth word definitions, the parentheses show the stack conditions before and after the word. When there are more than two parameters the one on the right is on the top of the stack and is the most accessible. E.g. ( a1 n a2 - f ).
Immediately following is a FAST START GUIDE. However, we ask you to read all of the rest of this introduction before commencing work with the TDS2020F. The remainder of the book can then be used for reference when needed.
Included in this manual and in the software library are application examples that we believe work correctly. We can take no responsibility for any faults in this or other information, which is offered in good faith to users of TDS2020F computers. Under all circumstances, liability is limited to the cost of your purchase from us. If you are unable to accept this condition for whatever reason, please return the goods for full credit or refund.
In HARDWARE EXPANSION, page 250, you will find data on other boards and software compatible with the TDS2020F. Delivery of all items is usually from stock but please call or fax for current price and delivery.
FAST START GUIDE
HARDWARE FOR TDS2020F
This guide assumes you are using a TDS2020F-SP Starter Pack. If you bought an earlier type, please contact us for the appropriate manual.
To make the TDS2020F work you must plug a 32k-byte RAM chip into the smaller (28-pin) socket. Pin 1 is marked; it goes in with the notch towards the edge of the TDS2020F. Links F and W should already be made on delivery. Now plug the TDS2020F into the wire-wrap sockets provided in the Starter Pack.
Alternatively you can use a Xicor 28HC256 32k-byte Flash-EEPROM instead of the RAM chip, both are in the Starter Pack. However, the Flash-EEPROM has a limit of 100,000 write cycles and it is possible to inadvertently apply a software lock on the device. Although the Flash-EEPROM chip will be used for final compilation, for these reasons we suggest you use RAM for initial tests and during most of the development.
Note: If you have a TDS2020 board earlier than revision F you may upgrade it, see UPGRADING AN OLDER TDS2020, page 236.
The power supply connections are as follows. No negative supply for the RS232 serial link is needed-it is generated on the board. In particular, make sure you use pin a32 for power and c32 for ground, not the other end of the connector-that will destroy the board. On the other hand, reversal of the power supply will not harm the TDS2020F since it has an on-board series diode. The pin numbers are clearly marked.
Connections to a PC
The PC is connected via a serial port-any hardware RS232 serial port connector can be used-but note that the software (by default) will choose the lowest available COM port. For instance COM2 if a mouse occupies COM1. The serial connections are:
ABOUT THE CD
All files have been checked with an updated version of Norton AntiVirus. On the CD are:
q A copy of the Web site www.TriangleDigital.com, plus other material such as circuit diagrams. To access it, click cdindex.htm in the root directory of the CD. No installation is involved, nothing will be written to your hard disk. The site will be viewed using your installed browser.
q TDS-PC for Windows, the PC development environment for TDS2020F and TDS9092 card computers. To install, click setup.exe in the root directory of the CD. As well as the user interface of editor screens and interactive window, current library files for both computers will be placed on your hard disk.
q Items useful to developers, including the draft ANS Forth standard. They are in the directory \essentials.
INSTALLATION OF TDS-PC FOR WINDOWS
q Close all running Windows applications.
q Place the CD in its drive and run setup.exe in the CD's root directory.
q A small setup window will transfer system files to update your computer if necessary.
q A dialog box suggesting c:\tdswin\ as the default TDS-PC for Windows directory appears-alter if you want the software placed elsewhere.
q Click the big button to start installation.
q Files are now transferred and a new program group created.
q A desktop icon is not automatically made; you can make a shortcut there, pointing it at file c:\tdswin\tds305.exe (or later version as appropriate).
All users should look at file #updates.tds. This contains information on updates to the Forth kernel. It is also important to see file readme.hlp for the latest information and corrections to the Technical Manual.
If you need the PC support software on more than one machine, do not set up on one and then copy the files to the other. Install twice from the CD so that the tds-pc.ini configuration file automatically created on first use (in your \windows or \winnt subdirectory) will be appropriate for each computer.
For full details of use and customisation see TDS-PC DEVELOPMENT SOFTWARE, page 208, but if you are in a hurry start TDS-PC for Windows from the 'Start' button menu. You are presented with the Computer board selection window and should ensure that 'TDS2020F ANS Forth' is selected.
If the set up is successful, there'll be a short delay while the PC checks for the presence of a TDS2020F. Date and time are also set from the PC clock. The Interactive window at the bottom will clear and the TDS2020F's start-up message will appear at the top of the window. Communication with the Forth computer is now established. You can type Forth words and after pressing return, they will be interactively executed.
If the PC does not have a CD drive, you can make a set of 1.44MB floppy disks from the CD in another machine. Open the directory \tds-pc and run makedisk.bat.
If setup.exe in the root directory of the CD does not work on your PC, try setup.bat in the root directory and then the setup.exe in the \tds-pc\disk1 subdirectory.
If you don't see the banner coming from the TDS2020F, select the Interactive window with the mouse (caption band at the top goes darker than other windows) and then press return a few times. If you see the 'ok' prompt, type COLD and return to reinitialise the remote computer.
If the TDS2020F does not reply, and you see the 'not responding' message:
q You may not have switched on the TDS2020F.
q Its power supply may be bad, check that the voltage used is +6 to +16V. Do not use a small battery.
q You may have a faulty cable or wrongly wired connectors.
q You may be connected to the wrong COM port on the PC. To change it see COM PORT, page 228.
Correct the fault and first disconnect the TDS2020F from both the power supply and PC so that you can try a proper cold start again. Select the black Interactive Window then 'Options', then 'TDS Computer' to bring you back to where you were. Select OK to try to again to connect to the remote computer.
If you get the message 'Serial Error', see SERIAL ERROR, page 212.
Some notebooks have problems with communications programs like TDS-PC for Windows-they may turn off the serial port when not receiving or transmitting. If you get this problem, look into the hardware configuration options for the machine.
Also, try pressing the reset button on the TDS2020F. Another possibility is that the computer is in its standby mode, by software or because the STBY* pin is held low for some reason. If still unsuccessful there may be a hardware problem.
Before requesting assistance please look at the readme.hlp file because it may have instructions which are more up to date. Also read the updates to the Forth system in #updates.tds. When you contact us, please be sure to state:
q Which computer (TDS2020F or TDS9092) and connected accessories you are using
q Version number on the Forth ROM
q Version number of the development software on your PC (click 'About').
To get personal help see CONTACTS, page 4. If you leave a message by email or telephone, we'll usually get back to you within 24 hours, often much faster. News and updates, including the latest files for downloading, can be found on Web site www.TriangleDigital.com.
TDS-PC FOR WINDOWS ON A MAC
We have no direct experience ourselves, but here is information from a user:
"I'm running Windows XP Pro using "Virtual PC v.7.0" (VPC), which is much faster and more stable than previous versions, on a Mac Mini working with Mac OSX "Tiger" (v.10.4).
"Mac's don't have serial ports, so I've bought a cheap USB-Serial Converter, ATEN International Model no. UC-232A (available from Matt's Computer Solutions - www.mcsx.co.uk - for 12 quid ($22)!). The device is installed (under VPC) as COM3, but can also be installed under Mac OSX.
"Mac OSX uses function keys as shortcuts, and F9 has to be disabled, so that it can be used in TDS-PC to open files. F1, F2, F3 and F8 are available anyway. With the previous Mac OS v.10.3 ("Panther"), the use of the F9 key shortcut was implemented, but not documented and not disable-able, so F9 couldn't be used within TDS-PC for Windows.
"There is one slightly annoying feature using this Converter:- If TDS-PC for Windows is started without ensuring that the USB port is properly enabled under XP Pro Preferences, then line 3 of tds-pc.ini gets corrupted during start-up to read 'Communications port=COM16', causing an abort. It is then necessary to find tds-pc.ini and edit it back to ' ... COM3' . The simple solution seems to be to make file \windows\tds-pc.ini read-only. The same happens on my PC running Win98, so this is presumably a bug in the USB-Serial Converter software. But what do you expect for 12 quid ($22)?!
"Apart from that, everything works perfectly and as quickly (with intercharacter delay = 0) as on a PC.
"By the way, the Mac Mini is a very nice piece of engineering. Only 16.5 x 16.5 x 5cm (6.5 x 6.5 x 2 inches), with 80 Gb hard disc, Super-drive DVD slot, Airport & Bluetooth. Mac OSX 10.4 is some way ahead of XP, too."
(by Keith Maries)
A complete TDS2020F manual set comprises the following:
q TDS2020TM Technical Manual, April 2000
q TDS2020HM Hitachi's H8/532 Hardware Manual (available on CD)
q TDS2020PM Hitachi's H8/500 Series Programming Manual (now out of print)
Newcomers to Forth should definitely have 'Forth Programmer's Handbook'.
TDS2020HM-H8/532 Hardware Manual
This is Hitachi's book on the hardware of the H8/532 microprocessor (on-line version). The sections are: Overview; MCU operating modes and address space; CPU, Exception handling; Interrupt controller; Data transfer controller; Wait-state controller; Clock pulse generator; I/O ports; 16-bit free-running timers; 8-bit timer; PWM timer; Watchdog timer; Serial communications interface; A/D converter; RAM; ROM; Power-down state; E clock interface; Electrical specifications; Instruction set; Register field; I/O port schematic diagrams; Memory map; Pin state; Package dimensions. This item is now only available on CD.
TDS2020PM-H8/500 Series Programming Manual
This is Hitachi's book on the assembly language of the H8/500 series of microprocessors (now out of print). The sections are: CPU, Instruction set: Detailed descriptions, State transitions, Basic operation timing.
TDS2020TM-TDS2020F Technical Manual
FORTH PROGRAMMER'S HANDBOOK-by E.K. Conklin and Elizabeth Rather
This provides a detailed technical reference for programmers and engineers who are developing software using American National Standard Forth (ANS Forth). It assumes the reader has a general knowledge of programming principles and practices, and a general familiarity with computer hardware and software systems.
OVERVIEW OF THE METHOD OF DEVELOPMENT
In developing a stand-alone application, from experience we suggest you start by putting the hardware of a prototype together. When this is ready, software development can start.
HARDWARE OF THE PROTOTYPE
First the TDS2020F computer is built into the prototype of the product, and is connected to whatever special input or output is required. The only necessary addition is to put a RAM or Flash-EEPROM in the 28-pin socket. This is where the compiled code will go.
Put a 512k or 128k byte extended RAM or Flash chip in the 32-bit socket if that will be needed. The decoding on the board may be used to add multiple serial channels or more parallel access lines to LEDs or other peripherals. The system can easily be interfaced to LCDs, triacs, printers, keypads, switches, displays or motors. Add a Compact Flash card, PCMCIA card, CAN network adapter or other peripherals as needed by the application. This manual gives many examples.
Physically mount the TDS2020F as needed, perhaps in a box or as a plug-in 'component' computer on a larger motherboard. There are four mounting holes for screws. A prototype can use the set of pin-sockets provided with the TDS2020F Starter Pack. They can be soldered or wire-wrapped. For an alternative mounting arrangement, the TDS2020F is also available with a DIN41612 connector (rows a & c) for use in an equipment rack.
Often a product will consist of two boards; one the TDS2020F, the other made to carry keypad, display, and whatever other special logic, input/output or memory is required by the application. Use the mounting holes to connect the two together as a sandwich. The second board can go either under or over the TDS2020F because it has sockets on top as well as underneath.
Build an RS232 connector into the prototype going to serial Port 1 of the Forth computer. The umbilical cord connecting the prototype to the host computer can be taken away once the software is developed and working. You can also use the serial link as part of the equipment you are building, the PC emulating a system the TDS2020F will connect to in the end application, or to allow diagnostic interruption to your program loop.
The interactive mode is used during debugging. Just typing the Forth commands and then return causes the action to be done. For example:
HEX FF8E CONSTANT DATA \ address of Port 7
DATA C@ \ fetch and display a
\ byte input from Port 7
New definitions that extend the dictionary can be added in a similar way. The second line above could be converted to:
: GET DATA C@ . ;
This adds the new 'word' GET to the dictionary. The action now doesn't happen until you type GET and then return. At this point, the byte present on Port 7 will be read, converted to characters and sent to the serial link (your PC during development). In this way, direct access to your TDS2020F attachments will help debug prototype hardware before you start writing the real program.
A second mode is not interactive. In the TDS-PC for Windows program, the yellow screens are word-processors. Code is laid out as you wish, preferably with lots of comments and indents to bring out the structured nature of Forth programming. The plain ASCII file produced is compiled on the TDS2020F by the function key F8. If compilation stops on error, the appropriate edit window is brought to the front and the line highlighted where the fault was found. See TDS-PC DEVELOPMENT SOFTWARE, page 208, for full details.
Using either the interactive mode or F8 from an edit window, the on-board compiler reduces your source code to executable Forth dictionary format. Since this is compiled code, it runs an order of magnitude faster than the equivalent interpreted BASIC and so is more suitable for use in products. It also has enhanced interrupt, assembler and multitasking capabilities.
The built-in H8/532 microprocessor assembler enables some of your program to be written in machine code for the ultimate in speed. Code definitions and high level Forth can be freely intermixed. The assembler also gives the possibility of using machine code or Forth interrupts if required.
The dictionary builds up in the 32k byte RAM or Flash-EEPROM. If you need more dictionary space the empty half of the H8 processor can be used to extend the application to about 45k bytes of compiled code. Remember there are also 16k bytes of Forth and additional applications support code built into the first half of the microprocessor.
At the end of the development cycle, the program consisting of compiled code is actually working in the prototype. It remains to make this code permanent.
THE STAND-ALONE SYSTEM
The TDS2020F computer has to power up directly into your program. Since the final compilation is done into non-volatile Flash-EEPROM memory, the procedure is very simple and no PROM blowing is needed. Once compiled, type SET WORK interactively and the program starts to run (here we assume WORK to be the infinite loop into which you want the board to go on application of power). Switch the power back on and the system should start with execution of the word WORK . The job is complete.
The procedure and alternatives are fully detailed in STAND-ALONE SYSTEMS, page 232, and you should be familiar with everything there when completing an application. You end up with a system that is not dependent on the computer used during development. It powers up into your application.