projects:430eforth:start
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
projects:430eforth:start [2020-06-10 17:59] – [The "39 Steps" to see HELLO WORLD on your display] mka | projects:430eforth:start [2022-01-14 04:49] (aktuell) – [TI Launchpad] mka | ||
---|---|---|---|
Zeile 32: | Zeile 32: | ||
{{ : | {{ : | ||
{{ : | {{ : | ||
+ | |||
+ | Und hier ist Ting's Quelle: {{ : | ||
Zeile 43: | Zeile 45: | ||
**( This part is in English, as the link to this location is shared )** | **( This part is in English, as the link to this location is shared )** | ||
- | How can you simply carry out a few Forth instructions? | + | ===== How can you simply carry out a few Forth instructions? |
- | And understand how Forth works?\\ | + | |
- | OK, the execution of commands online without additional hardware has already been shown elsewhere in this Wiki, in the **A Start With Forth** documentation, | + | And understand how Forth works? |
- | : https:// | + | |
- | and in English\\ | + | OK, the execution of commands online without additional hardware has already been shown elsewhere in this Wiki, in the **A Start With Forth** documentation, |
- | https:// | + | in [[projects: |
+ | [[en: | ||
Zeile 75: | Zeile 78: | ||
And you will end by programming the '' | And you will end by programming the '' | ||
{{publication2.jpg}} | {{publication2.jpg}} | ||
+ | |||
+ | [[https:// | ||
We soldered the headers on a nano pointing downwards, | We soldered the headers on a nano pointing downwards, | ||
Zeile 80: | Zeile 85: | ||
{{arduino_nano_on_breadboard.jpg? | {{arduino_nano_on_breadboard.jpg? | ||
- | |||
- | For example [[https:// | ||
Zeile 95: | Zeile 98: | ||
Download and install a terminal program, if you do not have one already, | Download and install a terminal program, if you do not have one already, | ||
- | e.g. Teraterm or termite, | + | e.g. [[https:// |
and then you are ready to go. | and then you are ready to go. | ||
Set to 115k baud rate. | Set to 115k baud rate. | ||
- | ** https:// | ||
Enter (**CR)** | Enter (**CR)** | ||
Zeile 117: | Zeile 119: | ||
{{some_examples_part_1.pdf|Here are some examples.}} | {{some_examples_part_1.pdf|Here are some examples.}} | ||
- | + | ||
- | **And the additional information | + | [[https:// |
- | https:// | + | |
===== Some small Examples ===== | ===== Some small Examples ===== | ||
- | The terminal display shows | + | The terminal display shows: |
+ | 0 0 0 0 ok> | ||
+ | These four zeros show the top 4 values of the Data stack.\\ | ||
- | 0 0 0 0 ok> These four zeros show the top 4 values of the Data stack. | + | With((< |
- | with | + | 1 <CR> |
- | 1 (CR) | + | 2 <CR> |
- | 2 (CR) | + | 3 <CR> |
- | 3 (CR) | + | 4 <CR> |
- | 4 CR) | + | it changes to: |
- | it changes to | + | 1 2 3 4 ok> |
- | 1 2 3 4 | + | |
- | now try | + | |
- | . (CR) | + | |
- | . (CR) | + | |
- | . (CR) | + | |
- | . (CR) | + | |
- | and the 4 values are displayed and disappear from the stack and back to 0 0 0 0 | + | |
- | **The usual HELLO WORLD we can achieve like this:** | + | Now try |
+ | . < | ||
+ | . < | ||
+ | . < | ||
+ | . < | ||
+ | and the 4 values are displayed and disappear from the stack which is back to: | ||
+ | 0 0 0 0 ok> | ||
- | Define a new Forth Word | ||
- | : | ||
- | : start a new Word definition | ||
- | HELLO1 the name of the new Word | ||
- | ." | ||
- | HELLO WORLD the text to be printed | ||
- | " | ||
- | ; end of new Word definition | ||
- | And try it out: | + | ==== The usual HELLO WORLD we can achieve like this: ==== |
- | hello1 (CR)HELLO WORLD | ||
- | and format the output | + | Define |
+ | : | ||
+ | '':'' | ||
+ | '' | ||
+ | '' | ||
+ | And ''"'' | ||
+ | Finaly '';'' | ||
- | : HELLO2 | + | And try it out: |
- | a few additional CRs will make it better readable | + | |
- | hello2 (CR) | + | hello1 <CR> HELLO WORLD |
- | HELLO WORLD | + | and format the output a bit. A few additional CRs will make it better readable: |
+ | : HELLO2 | ||
+ | |||
+ | hello2 < | ||
+ | |||
+ | HELLO WORLD | ||
+ | |||
+ | ==== And now let us control one Bit in the IO. Here the on-board LED ==== | ||
- | **And now let us control one Bit in the IO. Here the on-board LED** | + | |
- | + | \ Will set bit 5 of the port to OUTPUT in the Data Direction Register | |
- | + | \ 20 is the data bit to be stored, and 24 is the DDR Register address in hex | |
- | 20 24 POKE (CR) | + | |
- | \ will set bit 5 of the port to OUTPUT in the Data Direction Register | + | 20 25 POKE (CR) |
- | \ 20 is the data bit to be stored, and 24 is the DDR Register address in hex | + | \ Will set Bit 5 in the OUTPUT Register to HIGH - LED is on 0 0 1 0 0 0 0 0 |
- | + | \ 20 is the OUTPUT bit to be stored and 25 in hex is the Output Port Register | |
- | 20 25 POKE (CR) | + | |
- | \ Will set Bit 5 in the OUTPUT Register to HIGH - LED is on 0 0 1 0 0 0 0 0 | + | 00 25 POKE (CR) |
- | \ 20 is the OUTPUT bit to be stored and 25 in hex is the Output Port Register | + | \ Will set Bit 5 in the OUTPUT Register to LOW - LED is off |
- | + | \ here 00 is stored in the Output Register | |
- | 00 25 POKE (CR) | + | |
- | \ Will set Bit 5 in the OUTPUT Register to LOW - LED is off | + | |
- | \ here 00 is stored in the Output Register | + | |
- | + | ||
- | The data sheet I used is http:// | + | |
+ | I used this [[http:// | ||
+ | |ATmega328P Datasheet]]. | ||
And for now only page 280 is important, which shows the addresses for the ports, | And for now only page 280 is important, which shows the addresses for the ports, | ||
- | especially here now Port B: \\ | + | especially here now those two Port-B-addresses: |
- | 24 HEX is the DDR (DDR = Data Direction Register) to set bits to OUTPUT and | + | *24 HEX is the DDR (DDR = Data Direction Register) to set bits to OUTPUT and |
- | 25 HEX for the OUTPUT Register to set bits to 1 or 0 HIGH or LOW. | + | *25 HEX for the OUTPUT Register to set bits to 1 or 0 HIGH or LOW. |
**And the relevant file of these examples** | **And the relevant file of these examples** | ||
Zeile 199: | Zeile 201: | ||
With Forth we can poke around in all internals using the Forth commands, read and write IOs - even mess up the CPU – so please be careful as you might have to restart the Forth and loose the work done before. | With Forth we can poke around in all internals using the Forth commands, read and write IOs - even mess up the CPU – so please be careful as you might have to restart the Forth and loose the work done before. | ||
And this is done using only 2 commands, added especially to this eForth version: | And this is done using only 2 commands, added especially to this eForth version: | ||
- | **PEEK** | + | |
- | **POKE** | + | *POKE - Overwrite contents at memory location xx with new data yy. |
And if you have now licked blood and have the appropriate know-how and tools, you can flash in the extended version of this eForth - but then the bootloader will be overwritten. | And if you have now licked blood and have the appropriate know-how and tools, you can flash in the extended version of this eForth - but then the bootloader will be overwritten. | ||
Zeile 215: | Zeile 217: | ||
or as well as book at | or as well as book at | ||
- | https:// | + | [[https:// |
\\ | \\ | ||
\\ | \\ |
projects/430eforth/start.1591804798.txt.gz · Zuletzt geändert: 2020-06-10 17:59 von mka