PDA

View Full Version : Downloading Forth code to RAM??


eds
06-16-00, 12:03 PM
Hello,<br>I am new to the Forth language and the NMIX/T-0022 board, but I am familiar with programming the HC11 in assembly language. So far, I have understood some of the ways to perform certain operations in Forth, however they have only been entered line by line using Hyperterminal. <br>My problem lies in the process of downloading a very simple pre-written code to a location in the RAM and then running it. I have used the ALT-D command in MaxTerm but the only thing that comes up on the terminal screen is the first line of my code and the task in not executed. <br>I am guessing my error lies either in the format of my code, or that I don't know how to specify the locations in RAM to where to download the code. <p>I am looking for a step-by-step process to successfully write, download, and run a very simple Forth program, such as outputting a number to one of the D/A outs, so I can go on further to acccomplish my goals. <p>I thank anyone who can help me understand this Forth based process.<p>Ed Seng<br><p>----------<br>Ed Seng<br>

nmitech
06-16-00, 02:40 PM
I don't know if anyone has any luck to download FORTH code with the HYPER TERMINAL program. That is why i only recommend MAXTERM program that comes on disk with the purchase of a NMIX/T-0020/21/22/23. <p>Always enter complete path of the file you want to download. Ie,<br>&lt;drive:&gt;\&lt;directory&gt;\&lt;or sub-directory&gt;\&lt;filename.4TH&gt;<p>If your NMIX-0022 Memory has a default configuration then you can start your code as,<p>COLD<br>HEX<br>200 DP ! ( beginning of external ram )<p>( --- place you code here --- )<p><br>

nmitech
06-16-00, 02:52 PM
Sorry, The Path on the previous post should look like this,<br>[drive:]\[directory]\[... sub directory]\[filenam.4TH]<p>

eds
06-19-00, 12:48 PM
I have gone from making it work to it not working again. At first, I realized I already had a connection with the board using hyperterminal. So when I only had a connection using Maxterm, it worked; I then realized I could type line by line if I wanted in the Maxterm terminal and also download code that worked!!! Today, I attempted to download the scanning A/D input channel code given in your manual. It had a few errors in download (such as not accepting single 0's to represent 00, and the 'AND U' line didn't work until i changed it to 'AND U.'), but I fixed them and the whole thing downloaded. Then, I went on to retest the simple code I used the day before, and when I downloaded it, it again just printed the first line, then a space, and that was it. I could no longer type anything, but the Alt commands still worked. I decided to exit Maxterm, reload it and then try the simple code download again; but again, just the first line (DP 1000 !). I also tried loading Maxterm from Dos, because I heard that windows might introduce errors; but the same result again. <p>Could this be a spefic glitch in my Maxterm?<br>Could it be that I downloaded an incorrect code that temporarily confused the chip?--if so, how can I clear it. The fact that I had a succesful download of a simple program at one time and then unsuccesfull at another tells me it is not the code, but something else. So you know, the simple code is as follows:<p>DP 1000 !<p>HEX<p><br>FFF BD00 !<br>FFF BD02 !<br>FFF BD04 !<br>FFF BD06 !<p>Again, thanks for any help you may be able to provide me.<br><p>----------<br>Ed Seng<br>

nmitech
06-19-00, 01:50 PM
Here is the correct parameter setup for DP word,<p>1000 DP !

devink
07-18-00, 03:08 PM
I have found that the ancient Win311 version of the accessory application &quot;terminal.exe&quot; works best for downloading Forth into RAM.<br>It's compatible with Win98, but probably not WinNT because of the HAL interface.<p>Set the &quot;Text Transfers...&quot; menu setting to &quot;Line at a time&quot;, then select &quot;Wait for promt string:&quot;, and enter &quot;^M&quot; in the text box without the quotes.

devink
07-18-00, 03:50 PM
Here is a more complete set of commands to download into external RAM with the goal of moving your code into PROM at some point.<p>Be aware! VARIABLEs and USER VARIABLES (like DP) do not work well when left inside a PROM. NMI has some examples of how to deal with this. My next message will be my version of their ideas.<p>( This example has a 32Kx8 NVRAM @ $0200-$7FFF and 8Kx8 SRAM @ $8000-$9FFF )<br>( Needs NMI's $B7FF Autostart jump to SlowStart code in EEPROM for the NVRAM )<br>( Also shows some other USER variable tweeks you may want )<p>COLD<p>HEX<p>( CLEAR BATRAM & SRAM. )<br>0200 9E00 ERASE<p>( CLEAR OLD DICTIONARY WORD LINK IN RAM )<br>FORGET TASK<p>( move DP to NVRAM (future PROM) storage location<br>0200 DP !<p>( Do NVRAM/PROM application words here<br>: TASK ; ( Now located in external PROM/BATRAM )<p>( move FP stack -&gt; allows 136 TIB input chars per line )<br>01FC 74 ! ( FPS -NEW FP STACK RANGE = $0128 - $01FF )<br>01FC 76 ! ( FPS0 -NEW FP STACK BASE = $01FC )<p>( new TIB base = $00A0. Makes room for the following 2 changes )<br>00A0 1C !<p>( $1E = C/L -&gt; TIB chars per line = 136. $00A0-$0127 )<br>( Allows for verbose comments or dense one-line code compulsiveness )<br>0088 1E !<p>( PAD -&gt; moved input buffer allows 38 PAD chars. $007A-$00BF )<br>00A0 22 !<p>( move RET & DATA stack, allows FP stack for 36 FP values )<br>9FEF R0 ! ( NEW RETURN STACK LOCATION $9E00 - $9FFF, 120 values )<br>9DF0 S0 ! ( NEW DATA STACK LOCATION $9D00 - $9DFF, 120 values )<p>( ACTIVATE STACK CHANGES )<br>ABORT<br>

devink
07-18-00, 04:19 PM
( Do PROM/SRAM separation. )<br>( $200-$7FFF = PROM, $8000-$9FFF = SRAM )<p>8000 CONSTANT SRAM ( 1st SRAM location is ptr to next free storage space. )<br>8002 SRAM ! ( Initialize start of SRAM storage. )<p>( redefine VARIABLE, 2VARIABLE, FVARIABLE words )<br>: VAR SRAM @ 2 SRAM +! CONSTANT ; ( VAR MY.WORD )<br>: 2VAR SRAM @ 4 SRAM +! CONSTANT ; ( 2VAR MY.DOUBLE )<br>: FVAR SRAM @ 6 SRAM +! CONSTANT ; ( FVAR MY.FLOAT )<p>( If you want parametric CONSTANT's value in EEPROM. )<br>: EEC.CONST CONSTANT DOES&gt; @ C@ ; ( B600 EEC.CONST MY.BYTE )<br>: EEW.CONST CONSTANT DOES&gt; @ @ ; ( B600 EEC.CONST MY.WORD )<br>: EEF.CONST CONSTANT DOES&gt; @ F@ ; ( B600 EEC.CONST MY.FLOAT )<p>( Then set EEPROM values in a downloadable config file )<br>( or through a PROM'd word to load default values. )<br>( These values can be modified by hand or PROM'd word to update )<br>( the values to meet changing system conditions. )<br>12 B600 EEC!<br>34 B601 EEC!<br>56 B602 EEC!<br>78 B603 EEC!<br>( etc. )<br>