Remote Processing CX-10 User Manual
Page 12
![background image](https://www.manualsdir.com/files/858955/content/doc012.png)
SETUP AND OPERATION - MODBUS and BASIC
SECTION 2
Page 2-7
Uploading programs is simply a process of receiving an
ASCII file. You or your program simply need to send
"LIST" to receive the entire program.
Downloading a program requires transmitting an ASCII
file. As you type in (or download) a line, Basic
tokenizes that line. The time to do this depends upon its
complexity and how many lines of code have been
entered.
Basic must finish compiling a line before starting the
next one. When a line is compiled, a ">" character is
sent. This should be your terminal programs pacing
character when downloading a program.
If your communications program (such as
HyperTerminal) cannot look for a pacing prompt, set it
to delay transmission after each line is sent. A 100 ms
delay is usually adequate, but your program may be long
and complex and require more time. A result of a short
transmission time is missing or incomplete program
lines.
Editing programs and programming hints
Files uploaded or downloaded are simply ASCII DOS
text files. No special characters or control codes are
used. You may create and edit programs using your
favorite word processor or editor. Just be sure to save
files in DOS text format.
A technique used to further program documentation and
reduce code space is the use of comments in a
downloaded file. For example, you could have the
following in a file written on your editor:
REM Read charge voltage
REM and convert to volts
2200 a = regread(8) *.007326
The first 2 comments downloaded to the RPC-210
are ignored. Similarly, the empty lines between
comments are also ignored. Line 2200, with its
comment, is a part of the program and could be listed.
The major penalty by writing a program this way is
increased download time.
Notice that you can write a program in lower case
characters. Basic translates them to upper case.
Some programmers put "NEW" as the first line in the
file. During debugging, it is common to insert
"temporary" lines. Putting in “NEW” ensures that these
lines are gone. Downloading time is increased when the
old program is still present. If you like to write programs
in separate modules, you can download them separately.
Modules are assigned blocks of line numbers. Start up
code might be from 1 to 999. Interrupt handling
(keypad, serial ports) might be from lines 1000 to 1499.
Display output might be from 1500 to 2500. The
programmer must determine the number of lines required
for each section.
Basic automatically formats a line for minimum code
space. For example, you could download the following
line of code:
10 fora=0to5
When you listed this line, it would appear as:
10 FOR A=0 TO 5
Spaces are accepted but not stored. The following line:
10 for a
=
0
to
5
is compressed and displayed as in the second example
above. Spaces are removed. However, spaces as part of
a remark or PRINT are not removed.
Downloading Long Programs
The CX-10 has a limited RAM (about 6100 bytes). You
can store much larger programs, however (up to 32K).
To do this, review the program in the Basic Demo
directory under the name “download header.bas” You
can copy this code and put it at the start of yours.
Essentially this program has the start and end of your
program. When you download code, the commands will
automatically take care of housekeeping.
You may have trouble downloading long programs,
depending upon your terminal. Ideally, your terminal
program should recognize a
sending the next line. Terminal programs such as Terra
term or Hyperterm do not do this.
To reliably download long programs, insert a 100 milli-
second delay between each line transmitted. This may or
may not be in your terminal program.
For Terraterm, click on “Setup” in the top banner, then
click on “Serial Port...”. You will get a window
prompting you for port, baud rate (set to19200), parity
(none), stop bits (1), and flow control (none). At the
bottom, set transmit delay to 1 for msec/char and 100 for
msec/line.
A program named “Download core.bas” in the Basic