Содержание

4E4th

4E4th это маленький Форт, запущеный на плате LaunchPad (от Texas Instruments), внутри контроллера MSP430G2553.

Взаимодействие с 4E4th осуществляется редактором, запущеным через эмулятор терминала.

4E4th основан на MSP430 CamelForth версии 0.3, написанной B. J. Rodriguez для платы MSP430F1611Tini430. http://www.camelforth.com/

Это подмножество ANSI Forth, для установки требуется 6K памяти MSP430G2553 (0xE000-0xFFFF). Для ваших экспериментов остаётся свободных 8K памяти (0xC000-0xDFFF).

4E4th , также как и CamelForth , является свободным программным обеспечением (GNU General Public License).

Все ссылки на аппаратную часть относятся к LaunchPad MSP-EXP430G2 Rev.1.5

Bootstrap Loading

Начиная с Rev1.5 TI's LaunchPad имеет джамперы для переключения пинов Rx и Tx между программным UART и аппаратным UART. The LaunchPad TXD and RXD jumpers on J3 at the LaunchPad board are in SW UART position when delivered by TI. Для 4E4th нужен аппаратный UART, so position the TXD and RXD jumpers on J3 as shown with the image of the MSP-EXP430G2 LaunchPad Quick Start Guide (SLAC432) to ensure that the Rx and Tx pins are properly configured for the HW UART. http://www.forth-ev.de/images/articles/20120315002611249_1.jpg

В случае, если вы используете 4E4th с устаревшей версией LaunchPad, уберите джамперы TXD и RXD и подсоедините пины TXD и RXD крест-накрест.

What Terminal is the right one?

Adjust your terminal to 9600 8N1. This is the fixed speed with which 4E4TH's RS232 communicates with the USB interface. However Linux, talking to USB, seems to ignore all settings that make no sense for USB and still work.

 9600 Baud 

 8N1: 8 data bits, no parity bit, 1 stop bit 
 
Hardware flow control: OFF 

 
Windows XP

LaunchPad Windows USB Drivers have to be installed.

Further information is found at TI's document slau278h.pdf, page 139, Hardware Installation Guide. 

Source: http://www.ti.com/lit/ug/slau278h/slau278h.pdf

LaunchPad OSX USB driver (CDC /VCP) must be installed.

MSP430LPCDC 1.0.3b.pkg - starting with Mac OSX Version 1.5 
See at http://code.google.com/p/msp430lpcdc/downloads/detail?name=MSP430LPCDC%201.0.3b.pkg&can=2&q= 
More information at 
http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_Mac_OS_X 
Settings>Modem Preferences...  Serial Port (choose uart-40FF42C59D89223A or similar) 
Settings>Connection... Data Rate 9600 
 
% kermit 
kermit> set line /dev/tty.uart-40FF42C59D89223A  or similar 
kermit> set speed 9600 
kermit> connect 
Linux

Seems to be working without special drivers. Disconnecting and reconnecting USB is an almost foolproof way to make the connection.

 Debian squeeze, on i386 and on PPC (Gerald).
 Ubuntu 10.04 LTS - Lucid Lynx i686 Desktop PC (Martin)
 Ubuntu 10.04 LTS - AMD 64 bit (Albert)
 Ubuntu 11.04 - Natty Narwhal i386 Laptop HP Compaq 615 (Martin)


Kermit 
 % kermit 
 kermit> set line /dev/ttyACM0  # or similar 
 kermit> connect 

Запуск 4E4th

Начните с подключения LaunchPad к вашему ПК или ноутбуку, используя USB-кабель. The USB connection is the LaunchPad's power supply and the serial Interface to your Terminal emulator.

As soon as the LaunchPad is connected, Forth is started (оба светодиода включены) - assuming your Laptop or PC is switched on. For testing and to start Forth again, use the LaunchPad's Reset button.

4E4th starts with its latest saved status. To get back to the status at delivery, push and hold LaunchPad's button S2 and push the Reset button while holding S2. ReFlashing is done over the USB cable, too.

Внимание: The USB connection sometimes may be tricky. It is important that your PC recognizes the USB connection. Windows makes a special sound every time a new USB connection is recognized, and it makes a special sound in case the USB connector is pulled out. If you don't listen to these sounds, it may happen that the USB connection doesn't work, and the Terminal software doesn't recognize the LaunchPad's USB port. This is equally important when using TI's MSP-FET430UIF. Please do this: Switch on your speaker and listen to this special sound coming up when connecting the LaunchPad to USB, and start your Terminal after this. Please always first connect the USB cable at the LaunchPad board side, then to your computer.

Communication with the 4E4th

Terminal settings are 9600Baud 8N1. To be sure that communication is started, push <Enter> several times. 4E4th answers with ok. By the way, every input ends with pushing <Enter> to be executed.

To become familiar with 4E4th, try this: Type

  red cclr
  red cset  

or

  green cclr 
  green cset

and <Enter>, of course. The red or the green LED will be lit, respectively.

Type

    11 22 33 

The answer «ok» tells you that these numbers are on the data stack now - as soon as you have pressed <Enter>.

Type .S (a dot and a capital «S») and <Enter>. 4E4th answers with the quantity of the typed values and shows the typed values which are on the stack. You may repeat the .S command several times. You should always get the same result.

4E4th is capable of different number bases. 4E4th starts in DECIMAL mode and then accepts only decimal numbers. To make Embedded Systems programming easier, you may switch to HEX mode, and 4E4th only accepts hex numbers then. Typing DECIMAL switches back to decimal mode.

Here another Test. Type this text:

: TEST .« I am here » ;

4E4th answers with «ok», as usual, to show that your input is accepted. You just created a new command, and this command has just been added to the 4E4th system.

Now type

 TEST <Enter> 

and look what this command does. You just learned that for creating of a new command you first type a colon «:», and at the end of this definition you type a semicolon «;».

More examples you will find in Forth Tutorials - look at «Starting Forth online edition» which you will find at http://www.forth.com/starting-forth/

All Forth words in the examples are written in CAPITAL letters. The 4e4th does not care whether you type CAPITAL or small letters uses. This behavior is called case insensitive. You can toggle this behavior: With 0 CAPS ! 4et4h will be case sensitive, and with -1 CAPS ! 4e4th will be case insensitive.