Mar 242019
 

 

 

How to Install amForth on the Arduino Uno

This is a detailed technical article that describes how to set up an Arduino Uno microcontroller board with a version of the Forth programming language called amForth. My regular readers should ignore this post. Stay tuned though loyal readers, I will be posting more on this topic latter for a general audience.

I recently went through the process of installing amForth on my Arduino Uno. I wasn’t able to find a simple, easy to follow explanation of how to do it. I had to piece together information from a variety of sources and make a number of mistakes before I could make it work. I decided to write this article to make it easier for someone else who wants to avoid the headaches.

The method I am going to describe uses two Arduino Unos: one as the target board that you will install amForth on, and the other as the programmer. There are many other devices that can be used to program the Arduino’s microcontroller, but this is the only one I will describe. Also, the process I will follow uses a Mac. There will obviously be some differences if you are using Windows. I assume you have no knowledge of microcontroller programming, which was the case with me.

Here are the detailed steps:

Install CrossPack on your Mac

CrossPack is a developer environment that works on the Mac for programming Atmel’s AVR line of microcontrollers. The Arduino Uno uses Atmel’s m328p chip. Download CrossPack here. (See Figure 1 below.)

CrossPack

Figure 1: You should see this when you follow the link. Click the Download button.

Download amForth

Next, download the latest version of amForth here. You will see a list of folders with version names on them. (See Figure 2 below.) Above the list of folders are the words “Looking for the latest version?” followed by a highlighted link to a file ending with .tar.gz. Click on that link. The file will download to your Mac and be placed in your Downloads folder. Create a folder on your desktop called Forthduino and drag the .tag.gz file into that folder.

amForth download

Figure 2: Download amForth files.

Open the Forthduino folder you created on your desktop and click on the .tag.gz file to open it. You should see a new folder appear with the name “amforth” followed by the version number. Now you need to look inside the amforth folder to find the files uno.hex and uno.eep.hex. They can be found in amforth/appl/arduino/ (See Figure 3 below.) Copy the two files into the Forthduino folder.

find hex files

Figure 3: Find uno.hex and uno.eep.hex.

Set up the Arduino Programmer

As I said at the start of this article, you are going to program one Arduino Uno with another. Connect the Arduino Uno that will serve as the programmer to your Mac’s USB port now. Then start up the Arduino software on your Mac. Under the File menu look in Examples and find the sketch called ArduinoISP. Click on this sketch and upload it to your Arduino. Make sure that you have selected Arduino Uno as the Board under the Tools menu and you have your USB port selected under the Port heading of the Tools menu. The programmer is now ready. Keep your Arduino software open.

The next task is to connect the target Arduino Uno to the Arduino Uno serving as the programmer. Figure 4 below shows how this should be done. You can power the target Arduino Uno by running two wires from the +5V and Ground pins of the programmer Arduino as shown in Figure 4. Or you can power it separately with a battery pack. Pick one. Don’t do both!

Wire up the two Arduino Uno's as shown in the picture above.

Figure 4: Wire up the two Arduino Unos as shown in the picture above. Source: arduino.cc

Now you are ready to flash amForth to the Arduino…

Flash amForth to the target Arduino Uno

Before you perform the actually flashing process, go back to your Arduino software and look under the Tools menus. The Programmer selected should be Arduino as ISP. If not, change it. Also open up the Arduino Serial Monitor and select a BAUD rate of 19200.

Next, open up the Terminal program on your Mac. First thing you need to do is change Terminal’s directory to the Forthduino folder that has all your amForth files. The easiest way to do this is to type “cd” in the Terminal program follow by a space and then using the mouse pointer drag the Forthduino folder into the Terminal window. You should see the path typed out after the “cd” as in the second line of figure 5 below. If you’ve got that, press the RETURN key now.

Now the fun part. Type the following line in your Terminal window:

avrdude -P /dev/tty.usb* -c avrisp -b 19200 -p m328p -e -U flash:w:uno.hex:i -U eeprom:w:uno.eep.hex:i -U efuse:w:0x05:m -U hfuse:w:0xD9:m -U lfuse:w:0xFF:m

Terminal avrdude

Figure 5: Avrdude command entered into Terminal.

Type the above in one continuous line. Figure 5, above, shows what it should look like. Now press the RETURN key. You should see a readout of the flashing process. If everything worked it will look like the screen pictured below in Figure 6:

Figure 7: This is what you should see if everything has worked correctly.

Figure 6: This is what you should see if the avrdude command has worked correctly.

If you want to understand what this avrdude command with all its obscure add-ons does, I recommend reading this explanation from Limor Fried of Adafruit.

Connect to your Forthduino

Now that amForth is installed on your Arduino Uno, you can disconnect all the jumper wires between the two Arduinos and put the Arduino programmer aside. Plug your new Forthduino directly into your Mac’s USB port. Then, open the Mac’s Terminal program once more. Type this line and hit RETURN:

screen /dev/tty.usb* 38400

You should now see the amForth welcome screen as pictured here:

And that’s all there is to it. If you have any questions or comments add them below this article and I will be sure to respond to you.

 Posted by at 8:41 pm
Mar 192019
 

file:///C:/ti/430eforth-ide/lessons/lesson12.html

( Example 12.      Sines and Cosines )

\ Sines and cosines of angles are among the most often encountered
\ transdential functions, useful in drawing circles and many other
\ different applications.  They are usually computed using floating
\ numbers for accuracy and dynamic range.  However, for graphics
\ applications in digital systems, single integers in the range from
\ -32768 to 32767 are sufficient for most purposes.  We shall
\ study the computation of sines and cosines using the single
\ integers.

\ The value of sine or cosine of an angle lies between -1.0 and +1.0.
\ We choose to use the integer 10000 in decimal to represent 1.0
\ in the computation so that the sines and cosines can be represented
\ with enough precision for most applications.  Pi is therefore
\ 31416, and 90 degree angle is represented by 15708.  Angles
\ are first reduced in to the range from -90 to +90 degrees,
\ and then converted to radians in the ranges from -15708 to
\ +15708.  From the radians we compute the values of sine and
\ cosine.

\ The sines and cosines thus computed are accurate to 1 part in
\ 10000.  This algorithm was first published by John Bumgarner
\ in Forth Dimensions, Volume IV, No. 1, p. 7.

DECIMAL
31415 CONSTANT PI
10000 CONSTANT 10K 

VARIABLE XS                             ( square of scaled angle )

: KN ( n1 n2 -- n3, n3=10000-n1*x*x/n2 where x is the angle )
        XS @ SWAP /                     ( x*x/n2 )
        NEGATE 10K */                   ( -n1*x*x/n2 )
        10K +                           ( 10000-n1*x*x/n2 )
        ;

: (SIN) ( x -- sine*10K, x in radian*10K )
        DUP DUP 10K */                  ( x*x scaled by 10K )
        XS !                            ( save it in XS )
        10K 72 KN                       ( last term )
        42 KN 20 KN 6 KN                ( terms 3, 2, and 1 )
        10K */                          ( times x )
        ;

: (COS) ( x -- cosine*10K, x in radian*10K )
        DUP 10K */ XS !                 ( compute and save x*x )
        10K 56 KN 30 KN 12 KN 2 KN      ( serial expansion )
        ;

: SIN ( degree -- sine*10K )
        PI 180 */                       ( convert to radian )
        (SIN)                           ( compute sine )
        ;

: COS ( degree -- cosine*10K )
        PI 180 */
        (COS)
        ;

\ To test the routines, type:

\        90 SIN .                        10000 
\        45 SIN .                         7070 
\        30 SIN .                         4999 
\         0 SIN .                            0 
\        90 COS .                            0 
\        45 COS .                         7072 
\         0 COS .                         10000 

flush
 Posted by at 6:43 am
Mar 182019
 

http://genesisradio.com.au/VK2DX/time_signals.html

Receiving, identifying and decoding LF/HF radio time signalsReceiving, identifying and decoding time signals is an interesting and sometimes challenging aspect of amateur radio.
Time signals have unique spectral ‘foot print’ which makes them very special!

List of active time signal transmitters, received in Australia (except for MSF, TDF and BBC which were received and decoded in Europe):

ID Location Website
JJY-40 Mount Ootakadoya, Japan JJY-40 Website
JJY-60 Mount Hogane, Japan JJY-60 Website
MSF Anthorn, Cumbria, England MSF Radio Time Signal
WWVB Fort Collins, Colorado NIST – WWVB Website
RBU Moscow RBU Wikipedia page
BPC Shangqui City, Henan Province NTSC – BPC Information
HGB Prangins, Switzerland UTS – HGB Information
DCF 77 Mainflingen, Germany DCF 77 Wikipedia Page
TDF Allouis, France TDF Website
BBC Droitwich, Worcestershire, England Droitwich BBC Transmission Gallery
BPM Puchech County, China NTSC – BPM Information
WWV Fort Collins, Colorado NIST – WWV Website
WWVH Kekaha, Kauai, Hawaii NIST – WWVH Website
CHU Ottawa, Ontario, Canada NRC – CHU Website
HD2IOA Guayaquil, Ecuador HD2IOA Wikipedia Page
RWM Moscow, Russia RWM Wikipedia Page
HLA Daejeon, South Korea KRISS – HLA Website
YVTO Caracas, Venezuela YVTO Wikipedia page
PYT Brazil

———————————-

ID Frequency Location
Website
Snapshot
Decode
QSL
RJH77 25 KHz Generalniy Shtab Voenno-morskogo Flota RF (Russian Navy). St.Petersburg, Russia

Arkhangelsk, Russia

RJH77 Website Recording of RJH77
RAB99 25 KHz Generalniy Shtab Voenno-morskogo Flota RF (Russian Navy). St.Petersburg, Russia

Khabarovsk, Russia

RAB99 Website
 Posted by at 6:58 am
Mar 162019
 

https://skilldrick.github.io/easyforth/

Easy Forth

 

by Nick Morgan

View on GitHub

Introduction

This small ebook is here to teach you a programming language called Forth. Forth is a language unlike most others. It’s not functional or object oriented, it doesn’t have type-checking, and it basically has zero syntax. It was written in the 70s, but is still used today for certain applications.

Why would you want to learn such an odd language? Every new programming language you learn helps you think about problems in new ways. Forth is very easy to learn, but it requires you to think in a different way than you’re used to. That makes it a perfect language to broaden your coding horizons.

This book includes a simple implementation of Forth I wrote in JavaScript. It’s by no means perfect, and is missing a lot of the functionality you’d expect in a real Forth system. It’s just here to give you an easy way to try out the examples. (If you’re a Forth expert, please contribute here and make it better!)

I’m going to assume that you know at least one other programming language, and have a basic idea of how stacks work as a data structure.

Adding Some Numbers

 Posted by at 10:07 am
Mar 142019
 
  1. https://www.forth-ev.de/
Forth-Gesellschaft e.V.

Forth-Gesellschaft e.V.

Wir programmieren Forth
Home  :  Mitmachen  :  Erweiterte Suche  :  Statistik  :  Verzeichnis  :  Datenschutzerklärung  :  Forth Büro  :  Impressum  :  Photos  :  Redaktion  :  Download  :  Links  : Umfragen  :  Kalender  :  Wiki
Willkommen bei Forth-Gesellschaft e.V.
Donnerstag, 14. März 2019 @ 08:47 CET

Mitmachen! – Participate please!

Es ist sehr einfach. Der Artikel-Editor hilft dabei. “Plain old text” genügt.
Gib deinem Artikel eine Überschrift, eine *kurze* Einleitung in der du sagst um was es geht, und im Hauptteil folgt dann alles andere. So bleiben die Nachrichtenseiten übersichtlich. Dein Artikel wird dann von einem Admin gelesen, freigegeben, und du erhältst Bescheid per E-Mail. (mehr…)

It is very easy. The Article Editor helps. “Plain old text” is sufficient. Define a heading for your article, a * short please * Introduction about what it is you want to say, and then everything else follows as a text block. Done this way our news site remains easy to read. Your article will be read by an administrator, then released, and you will receive a notification via e-mail. (jp) (more…)

 Posted by at 7:48 am
Mar 102019
 

https://github.com/TG9541/stm8ef/wiki/Board-W1209

Board W1209

Thomas edited this page on 23 Dec 2018 · 75 revisions

W1209 Thermostat Board

The W1209 thermostat module has a STM8S controller, a sensor input, keys, LED display, and a relay. It can be reprogrammed for control, timing, or counting. At a price below $1.50 it can be used for “set and forget” applications.

Note: there have been reports of more or less compatible W1209 clones. Please refer to the identifying W1209 boards page for more information!

GitHub project for a W1209 Data-Logging Thermostat provides an alternative firmware: it’s based on STM8 eForth, and interactively programming other control applications, e.g. using level, pressure, or light sensors, is easy!

XH-W1209

The W1209 module (also XH-W1209) from SmartClima or XINHE/SINHE) has the following features:

  • STM8S003F3P6 (8K Flash, 1K RAM, 128 bytes EEPROM), 5V operation, no crystal
  • ICP (In Circuit Programming) pads. PD1/SWIM shared w/ 7S-LED segment “E”.
  • User interface: 3 keys, and 3 digits 7S-LED display
  • Relay (12V operation, NO, 5A) with red status LED
  • Sensor input with a XH2.54 2p male connector and 20k pull-up to 5V
  • 10k NTC temperature sensor, typically with 50 cm cable and XH2.54 2p female connector

Instead of the NTC temperature sensor other types of resistive transducers can be used (e.g. for measuring light, pressure, strain, or angle). Hardware details and schematics are discussed in technical description.

W1209 Forth Support

The W1209 thermostat was one of the first STM8S Value Line Gadgets supported by TG9541/stm8ef. The W1209 runs its own interactive programming system, which allows code to be compiled into RAM or Flash ROM, and tested, directly on the target!

If you’re new to STM8 or to Forth, please refer to the following sections

A HEX file for the W1209, optimized for embedded control tasks, is part of the binary release. The default configuration provides a complete interactive Forth system with sufficient free memory for typical control applications (special configurations provide more free memory). The binary can be programmed to the W1209 board using an inexpensive ST-LINK adapter.

STM8EF v2.2.13 provides a full-duplex interface through the pushbutton pins. Alternatively, with the help of a simple hardware modificatio, the sensor header can be turned into a half-duplex serial interface.

 Posted by at 8:09 pm
Mar 102019
 

Hacking DTM0660L Based Multimeters

Hacking DTM0660L Based Multimeters

In my previous post, I did a review of the 6000 counts ennoLogic eM860T true RMS multimeter. This meter is based on a signal chip design using the versatile DTM0660L DMM chip. Besides the ennoLogic eM860T, several other multimeters such as UNI-T 139C, Velleman DV4100, Tekpower TP40 etc. are also based on the same chip.

One key feature of this chip is that most of the configurable parameters as well as the calibration data are all stored in an external EEPROM. This means that we could potentially change certain settings and enable certain settings (e.g. enabling UART communication, backlight duration, auto power off duration, etc.) by just changing values in the configuration EEPROM without having to do any hardware modifications. We will take a look at how to make these configuration changes in this post.

Since sigrok (a cross-platform signal analysis software suite) already added support for the DTM0660 chip, we can use the sigrok-cli command line utility to talk to the meter via UART/RS232 once we have the functionality enabled .

 Posted by at 6:54 pm
Mar 022019
 

https://www.grappendorf.net/projects/analog-computer/

ANALOG COMPUTER

A modular Analog Computer Kit

Inspired by Dr. Vogels Home Brew Analog Computer , this kit consists of various 100×60 cm PCB cards which can be connected together with 2.54 mm jumpers. Each board implements a specific section of the analog computer by Dr. Vogel. Connect the various input and outputs of generators, adders, integrators and multipliers to compute different mathematical functions.

Integrator

Analog Computer Integrator

Read more…

Open Amplifier

 Posted by at 9:26 pm
Mar 022019
 

https://joldosh.blogspot.com/

Sunday, February 3, 2019

Tiny Calculator: improved CORDIC

Since my last post I have made a lot of changes to the CORDIC routines I was working on. As you can see in the chart above, the new version fits in less than the 4.1k of the last version even after adding in logarithms. The change came after I found an article about how the HP-35 did CORDIC calculations. Unlike the other descriptions of the method I have used, this version uses an atan table of powers of 10 instead of powers of 2. This lets you shift the arguments by whole decimal places, which is much faster with BCD numbers than powers of 2 . Before, I had wondered if this would be more efficient, but I don’t understand the math behind it well enough to modify the routine myself. My implementation of the method the HP-35 uses only takes 90k cycles, compared to the 1.18 million of the last version. The X and Y that the calculation produces, however, cannot be scaled to produce sine and cosine directly. The scale factor depends on the number of rotations, which is easy to precalculate when the angle is halved every iteration, but not possible to know in advance when you use powers of 10 since each iteration requires up to 9 calculations with each affecting the scale factor. As a result, the ratio of X and Y provides the tangent and the HP-35 used identities involving multiplication, division, and square root to generate sine and cosine from tangent. In addition to the 90k cycles for the CORDIC calculation, I would need at least another 140k cycles for these identities. This is 5 times faster than how I was doing it before, although I’m afraid the accuracy would suffer from the added calculations.

 Posted by at 2:04 pm
Mar 022019
 

https://www.electronicdesign.com/analog/what-s-all-spicey-stuff-anyhow-part-25

bob

What’s All This Spicey Stuff, Anyhow? (Part 2.5)

Bob Pease | Sep 07, 2012

Bob Pease, published October 10, 1991

pease168x140retroFirst, Let’s have an esaeP’s Fable: A person (when I tell the story, I always say it was a Harvard graduate, but you can insult anybody you think is appropriate…) had died and was wandering through Limbo and Purgatory. He came to two paths with two signs. One sign pointed “To Heaven.” The other sign said “To a Lecture On Heaven.” So of course he decided to go to the Lecture On Heaven. End of Fable.

 Posted by at 8:46 am
Mar 022019
 

 

  
JUN APR OCT
Previous capture 23 Next capture
1998 1999 2000
37 captures

30 Jun 1998 – 19 May 2018

Welcome to Columns



Pease Porridge | Walt’s Tools And Tips

Pease Porridge 


Walt’s Tools And Tips

Copyright© 1998, Electronic Design, Penton Media, Inc.
1100 Superior Avenue, Cleveland, OH 44114 USA.
All Rights Reserved


News | Technology Lab | Current Issue | Recent Issues |

 Posted by at 8:21 am