Professional Documents
Culture Documents
After you have successfully assembled your CB2 micro KIT, you should use this manual to get
started with the CB2 micro. This manual describes the basic operation of the computer and some
of the features available into it. New features can be added by loading and running new programs
of course, as well as making your own BASIC programs.
2. The keyboard
The CB2 micro KIT, comes preprogrammed and ready to be used. However, if you wish to re-program the
micro, note that the present version of the firmware requires initially a keyboard with German layout. But
the keyboard layout can be changed by means of a binary program afterwards. The current layout is
displayed in the main menu at the bottom of the screen.
For quicker access to the different options, there are 5 colored fields at the bottom menu of the screen
with functions that correspond to the keys ESC, F1, F2, F3 and F4. If you like, you can use colored
stickers on your keyboard so that these keys can be found more quickly.
Apart from these 5 keys, there are a few more keyboard shortcuts, some of which are similar to the PC
shortcuts:
CTRL+ALT+DEL restarts the system completely, deleting all variables and also the array
CTRL+C interrupts any program running (abort)
F12 interrupts the program and calls the monitor, works ONLY in video modes 0 and 5
When the running program is stopped or interrupted (abort or error), the color of the screen changes to a
red and white stripe pattern. The ESC key then returns you to the editor or to the main menu. At this point
it is also possible to send a screenshot.
In the "window" of the main screen, the 8 programs and 3 additional functions are arranged as symbols, including
the name or the program name. Use the cursor keys to move and hilight the programs fields (slots), then press the
Enter key to start the program under the hilighted field or to call the corresponding function. The color of the symbol
indicates the type of program. On binary programs, the icon of the program file is displayed.
Cyan Library
Magenta Video driver, can only be used on program slot 8
The 3 symbols in the third line, show the Flashmanager, the Config-Page and the info program. For
details on them, see the relevant sections in this manual. Underneath there is an indicator for the system
status. On the far left line is the MCU type, either 644 for the ATMega644 or 644P for the ATMega644P.
In addition, the current active video system (PAL or NTSC) is displayed. On the right, there is the short
name of the active keyboard layout. To change the keyboard layout, a corresponding (binary)
program must be loaded and started. For example, with the program "kbd_us.bin" (provided) the
keyboard layout can be changed to US-English. For this purpose, the program is either transmitted via
XMODEM or loaded from the disk module. After the program has been executed with the F4 key, the
display changes accordingly in the system status. However, as the CB2 micro comes pre-programmed,
you do not need to worry about the keyboard layout at all, unless you have a German keyboard layout.
The bottom line menu contains the possible commands, the colors correspond to the keys ESC and
F1...F4 and have the following functions:
No function
The keys F1...F4 have a secondary function if the left or the right CTRL key is pressed additionally. The texts in the
5 color fields change accordingly:
4. The Flashmanager
The Flash Manager (DFLASH icon in the main menu) only works if a Dataflash external module is plugged in.
Otherwise there is only the option to rescan and cancel. The CB2 micro KIT does not include an external dataflash,
so this option cannot be used, unless you connect one yourself.
If however a Dataflash module is present (only 4 and 8 MBit AT45 series devices are recognized) it is tested for
valid formatting. In addition to the block status, things such as the write counter are created. The bottom line
contains the possible commands. The colors correspond to the keys ESC and F1...F4 and have the following
functions:
It should be noted that files can be written only on empty slots or on BUP files. The operation can be
canceled with the ESC key. Before a file is overwritten, this must be confirmed again with "Y". During
backup, all programs are written to a BUP file. In the Fileselect box, the program name of the first
program of the 8 slots is always displayed for BUP files.
Deletes a file
The BASIC programs are written with a simple fullscreen editor. The current cursor position is saved in the
EEPROM when leaving the editor, separately for each of the 8 programs. As a result, after a system update
(relaunching the controller), the cursor may be somewhere within the text area. With left or right CTRL and Home
however, it can be quickly put back to the starting position (first character of the first line). If the computer is
switched on or if the program is loaded from the Dataflash or copied from another program location, the cursor
coordinates are set to the beginning of the program. If the program name begins with an underscore, the program is
saved as plain text. Although such a program can not be executed, this function can be used to save pure text files.
These texts can then be accessed, for example, by means of EPEEK from address 3072. At the top of the editor the
program number (1-8) and program name is displayed. As soon as the text in the program is changed, a star symbol
appears in the upper left corner, to indicate an unsaved program. Underneath there is a colored status line in which,
for example, errors are displayed. The position of the cursor is indicated by an inverse flashing character. In the
program text area, as characters are typed in, the cursor moves to the right. The cursor keys move the cursor in the
text field, the page up/down keys move the cursor up/down 8 lines. If necessary, the text is scrolled. The bottom line
shows 5 color fields. These correspond to the keys ESC and F1...F4 and have the following functions:
Reloads the program in the current slot from the internal flash
The keys F1 to F4 have a secondary function if the left or right CTRL key is additionally pressed. The text
in the 5 color fields changes accordingly:
For most functions, a confirmation prompt appears in the status line, which must be answered either with
(Y)es or (N)o (alternatively with ENTER or ESC).
Cursor keys Move the text cursor within the lines (horizontal) or between the lines (vertical).
Page Up Moves the text cursor up 8 lines or all the way up to the top line 1 if keep pressed.
Page Down Moves the text cursor down 8 lines or all the way down to the bottom line 95 if keep
pressed.
Home Sets the cursor to the first character of the current line.
CTRL
Sets the cursor to the first character of the first line.
+ Home
End Sets the cursor to the last character of the current line.
CTRL + End Sets the cursor to the first character of the last line.
Deletes the character under the cursor, characters to the right of the cursor are shifted to
DEL
the left.
Deletes characters to the left of the cursor, characters to the right of the cursor are shifted to
Backspace
the left.
Spaces are inserted so that the cursor moves in the editor by 3 characters. Useful for
TAB
indents in the program text.
A line is inserted at the current cursor position. All lines from the cursor position move
ALT + Insert
downwards, the last line in the program (95) is lost!
The line of the current cursor position is deleted. All lines below the cursor position move
ALT + Delete
up, an empty line is added at the bottom of the program (95).
The current line is copied to the buffer. This is indicated by a BUF=line number in the upper
CTRL + C
right corner of the screen.
The current line is moved to the buffer and deleted. This is indicated by a BUF=line number
CTRL + X
in the upper right corner of the screen.
The buffer is copied to the current line. This line will be overwritten. The buffer indicator on
CTRL + V
the top right disappears.
With the ESC key the search is aborted, an abort occurs even if the search string has a length of 0. After
typing the search string, the search can be initiated with the Enter key. The search starts from the current
cursor position. After line 95, the search continues back from line 1. If the search string is found, it is
displayed inverted in the program text and the cursor is placed at the beginning of the found string.
The ESC key can be used to abort the search; the Enter key is used to start a new search beginning from
the current cursor position. As long as you keep pressing the Enter key, the search for the current string
continues.
3. The program is displayed on the editor, the transfer status is displayed on the PC
1. Start the transfer on the PC with ./chiptrans.pl -r file name or from the Hyperterminal (or other
terminal program) in Windows.
2. Select SEND (CTRL+F2) in the EDITOR and confirm with "Y"
In addition to the program transfer from within the editor, in which plain text is transmitted, there is also
the possibility in the main menu to transfer programs in binary format. The transmission takes place via X-
modem protocol. This way, native AVR programs can also be sent and received, which can not be edited
with the editor after all.
5. The CB2 micro screen is periodically switched off during transmission, the status of the transfer is
displayed on the PC
By default, the 16-color mode (default on the CB2 micro) is set to be compatible with the 8-color output,
but this must be specified before the file name as a parameter -c8. The screenshot in video mode 7 is
implemented as a bulk transfer, where the driver ID, the palette and the entire video memory are
transferred. By default, settings are set to 2400 bps and /dev/ttyS0 as interface, if necessary, the Perl
script must be changed accordingly. For the extended interface of the Mega644P, the script
screenshot38.pl is provided, the interface settings correspond to the transfer settings for this interface.
An alternative is the program konvert.pl. For example, this converts captured screenshots into image
files using a terminal program. The operation is similar to the screenshot program, but the first parameter
is the file to be converted.
Separated by columns on the top right is the program, the program line and the statement just processed. Including
the currently active program line in the source text. Since only 30 characters per line can be displayed, the last 2
characters of the source line may be missing.
This is followed by the display of all variable values in the left part of the screen and the stack to the right of it. Each
FOR loop and GOSUB creates an entry on the stack. Under the variable list, the status of the parallel interface is
displayed. First the pin numbers (1 corresponds to D0), below that the data direction (I or O) and at the very bottom
the current level.
The bottom line contains the possible commands, the colors correspond to the keys ESC and F1...F4 and have the
following functions in video modes 0 and 5:
Ends the monitor and triggers a break (exits the program)
Displays the current output screen, each press of the button returns to the
monitor display
When the monitor is called, the entire image memory must be saved. However, this works only in the
video modes 0 and 5, this is simply because the image memory in the other video modes is larger and
thus can not be temporarily backed up. Therefore, in all other video modes the keys F1...F3 are locked:
Button is locked
Button is locked
Button is locked
In contrast, both the received and sent characters are displayed in dialog mode. The sent characters are
green and the received characters red. So this mode can be used as a simple chat between two serial
devices.
9.1.3 Send (F2)
With this function, programs can be sent using the X-mode protocol. First, a selection box appears in
which the program to be sent can be selected.
Use the cursor keys up and down to select the program slot to be sent, the ENTER key starts the
transmission, which is indicated by a small message box. During program selection as well as before the
transmission is initiated on the receiver, the process can be aborted with the ESC key.
0x08 Backspace Deletes last character, but only until the beginning of the current line
0x0a ENTER Linefeed (depending on the "Line end" setting in the configuration page)
In Colterm, text and pseudographics are drawn on the screen in a 22 lines x 30 columns canvas. The
communication protocol allows for individual characters to be transferred at every YX position on the
screen, no matter if they are transferred in order or not. This property allows for individual characters to
be updated (for example during a networked game), without the need to refresh the whole screen by
retransmitting the whole screen characters. So despite Colterm has slower data rate, due to the extra
information being transferred, this is very much depended on how you reftesh the screen and in fact it
might be much quicker in some aspect.
The last remaining line in the canvas, is used for user text input or keystrokes input (~, left, right, up and
down arrow keys), when the server expects a user input. If you reach the end of this line when typing, you
automatically continue to the beginning of the line again. Characters are sent serially one after the other,
as you type them. Backspace, sends a backspace character. You may type as much text as you like, but
backspace is valid only for the current line you type in. So for example you cannot erase a character in
the previously typed line (which you cannot see). You may terminate the user text input at any time, using
the ENTER character. For arrow keystrokes or the character "~", you do not need to terminate each
keystroke with ENTER, as this character is set to be transferred automatically after each keystroke. Make
sure your server program handles this, based on the section "10.4 Handling transmit/receive priority"
below.
BASIC
Communication
commands used Server sent data format Notes
mode
for transfer
[=Start of graphics
transmission (91)
Y=Yposition (0-21)
X=X position (0-29)
F=foreground color (0-15)
Graphics SPUT, SGET [YXFBCYXFBC...ENTER B=background color (0-15)
C=transfered character
(in HEX or numerical
ASCII value)
ENTER=Stop of
transmission (234)
Colterm assumes communication in 1200 baud and this setting is hardcoded with the BAUD 0 command
in the program. You may change this to BAUD 1 if you want to communicate on 2400 baud. However, for
compatibility reasons with server programs written by other users for Colterm, it is advised not to do so.
The 1200 baud has been chosen as default, because data can be transferred through modems or HAM
radio, with simple data-to-tone FSK converters.
[ Y X F B C ENTER
The second character Y, is the Y position of the character to be transmitted (C) onto the screen.
The third character X, is the X position of the character C onto the screen.
The fourth character F, is the foreground color that the character C will have.
The fifth character B, is the background color that the character C will have.
The sixth character C, is the character that will be transmitted (in HEX or numerical ASCII value).
Once the transmission has been initiated with the [ character (ASCII value 91), the five points above, can
be repeated for every character to be sent. After the transmission has been initiated, you can terminate it
at any point using the end transmission character "ENTER" (ASCII value 234). No character will be
printed at the client end if the YXFBC sequence has not been completed, or if it has been terminated at
any point with the ENTER character. The SPUT command is used to transmit data and the SGET to
receive.
01 SPUT 91,10,15,12,15,$2B,2,14,2,15,$3A,234
This sends two characters, one after the other. The first character is "+" ($2B) at the position Y=10 and
X=15 and the color of the character will be lime (12) in white background (15). The second character is ":"
($3A) at the position Y=2 and X=14 and the color of the character will be red (2) in white background (15).
Number 91 begins the graphics transmission and number 234 ends it.
Note that since Colterm uses the BASIC, it is slower in handling and processing the received characters
than native AVR programs. Depended on how your BASIC server application code has been written when
transmitting data, you might be forced to use a few SYNC statements in your transmit code or in between
the [YXFBCENTER characters transmission, to give some time for the BASIC code of the Colterm at the
receive end to process the characters correctly. There is no strict rule, it is all try and see. If you receive
garbage at the Colterm, then use some SYNC statements on your server transmit code, to slow down the
transmission.
For example:
SPUT [ Y X F B C ENTER
SPUT [
SPUT Y
SPUT X
SPUT F
SPUT B
SPUT C
SPUT 234
Or maybe:
SPUT [
SYNC 1
SPUT Y
SYNC 1
SPUT X
SYNC 1
SPUT F
SYNC 1
SPUT B
SYNC 1
SPUT C
SYNC 1
SPUT 234
SPUT [ Y X F B C ENTER
SPUT [ Y X F B C ] S ENTER
SPUT [ Y X F B C ] S S ENTER
SPUT [ Y X F B C Y X F B C ] S S S ENTER
The sound transmission is initiated (within the graphics data sequence) with the ] character (ASCII value
93). After the sound transmission has been initiated, you can terminate it at any point using the end
transmission character "ENTER" (ASCII value 234). This will also terminate the corresponding graphics
transmission. No note will be sound at the receiver end, and no graphics will be printed if the SS...
sequence has not been terminated with the ENTER character. The SPUT command is used to transmit
data and the SGET to receive. Note that "pauses" between notes, can be achieved by delaying the note
sending at the server with WAIT or SYNC commands. Of course everything, including graphics, is
delayed until the note sequence is completed.
01 SPUT 91,2,9,12,8,$2B,2,10,12,8,$2B,93,50,60,234
This sends the note with number 50 and afterwards the note with number 60 to the receiver end, after the
two $2B charactes. Number 93 (]) begins the sound transmission and number 234 ends it, which also
ends the graphics data transmission.
01 SPUT 91,2,9,12,8,$2B,2,10,12,8,$2B,93,50
02 WAIT 10
03 SPUT 60,234
This sends the note with number 50 to the receiver end, after the two $2B charactes. Then it pauses for
some time and afterwards it sends a second note with number 60 to the receiver end. Number 93 (])
begins the sound transmission and number 234 ends it, which also ends the graphics data transmission.
1. One end is the client and the other is the server. The server must be running already, if the client is to
be connected to it, not the other way round.
2. At the very first run of the client, the client automatically sends ENTER to server and switches to listen
mode.
3. The server receives ENTER and switches to send mode. Only then it must send data to client. At the
end of the data sending, the server sends ENTER to the client and switches to listen mode.
4. The client receives ENTER and switches to send mode. Only then it must send data to server. At the
end of the data sending, the client sends ENTER to the server and switches to listen mode.
Note, client sent data is text characters, strings or keystrokes (~, left, right, up and down arrows), but
server sent data is graphics and sound, according to communication protocol (section 10.1).
The server processes the client sent data, then it decides what to do with it (your server program
procedure, game, etc.), and then it sends the appropriate changes to the graphics grid of the client and
sends the appropriate sounds to the client. When text or single characters is to be sent to the server, the
characters or text must be terminated with an ENTER, which indicates to the server the end of the client
transmission. However when arrow keystrokes or "~" are sent to the server, the ENTER character is
automatically appended to these keystrokes and sent to the server.