COMGENIUS TLM
  SoftPLC    Font size:      

Configuration Basics

Module Editor

Use TOPDOC NexGen's PLC » Module Editor to load and configure the COMGENIUS.TLM for use with SoftPLC, as shown in the figure below. Clicking Configure opens the configuration text editor. Then press Fetch if remote editing, or Load if local editing to call up the respective copy of COMGENIUS.LST for editing.

module editor

Below is a sample COMGENIUS.LST file

; The SoftPLC COMGENIUS.LST configuration file consist of 3 sections:
; [DRIVER], [PORTS], and [STRINGS].  Lines beginning with a semi-colon
; are considered comments and are ignored.  Anything after a semi-colon
; is a comment, unless it occurs in the [STRINGS] section.
; Each line in the [STRINGS] section is a format string, and must be 
; bracketed in double quotes.  The first format string is considered 
; index 1, the second format string is considered index 2, etc.

[DRIVER]
; Global, driver-wide settings
DEBUG=0

[PORTS]
; [PORTS] should include one line for each serial port you want active.
; The LOGICAL PORT value is what you give to the COMPRINT 
; instruction's "Port" parameter.

; LOGICAL PORT
; |     PHYSICAL COMPORT COM1-COM32
; |     |      Encoding, usually "ISO-8859-1"
; |     |      |               Baudrate: 9600 or 19200 or 38400
; |     |      |               |       Databits: 8
; |     |      |               |       |  Parity: N or E or O
; |     |      |               |       |  |  Stopbits: 1 or 2
; |     |      |               |       |  |  |  Timeout milliseconds
; |     |      |               |       |  |  |  |   
; |     |      |               |       |  |  |  |   
  0,    COM1,  ISO-8859-1,     38400,  8, N, 1, 1200 
 
[STRINGS]
"string C5:0.ACC=%04X F8:0=%g\n"
"HELLO Mr. %s, This is your favorite PLC calling.\n"
"%.7s"

Configuration File

The following subsections describe the format of the configuration file COMGENIUS.LST

[DRIVER]

The [DRIVER] section holds driver wide configuration variables. Currently, only DEBUG is supported. Set it to zero to turn off debugging. Setting it to 1 or 2 will turn on debugging to varying degrees and cause COMGENIUS to print diagnostic information to the console as it operates.

[PORTS]

Each row of text in the [PORTS] section which is not a comment gives a port definition. A separate definition is needed for each port that will be used with COMGENIUS. There are 8 fields per row, described below:

FieldMeaning
LOGICAL PORTEach port definition should use a unique number in the range 0-31, normally starting at zero. The LOGICAL PORT value is what will be needed when a COMPRINT or COMSCAN instruction is entered and you are asked for the port parameter.
PHYSICAL COMPORTThe is COM1 to COM31. Physical com ports on a SoftPLC runtime have a prefix of COM and are numbered starting at 1.
EncodingSet this to ISO-8859-1 if you are working with 8 bit characters like ASCII or Latin-1. Otherwise if you are working with characters outside the range of 0-255, see here.
BaudrateNormally 9600 or 19200 or 38400
DatabitsMay be 5, 6, 7, or 8. 8 is standard.
Parity
  • N = none
  • O = odd
  • E = even
TimeoutThe time to wait for a COMSCAN instruction to complete, in milliseconds. COMSCAN gives up after this time duration.

[STRINGS]

The string table is a read-only array of strings. As read-only, the strings may not be modified at run time. Strings from the string table are used solely as format specifications. The string table is edited with the same configuration text editor as is used for the other configuration file sections.

Note
The stringss you add to the string table are numbered from 1. COMGENIUS supplies string number 0 itself, and it is the empty string: "" . Remember, your first string is numbered 1.

A string table may contain up to 32,000 strings, or up to the limits of available RAM memory in the runtime, whichever comes first. A single string may not exceed 255 characters in length.

When loading the RAM resident string table from the COMGENIUS.LST file, each line of text within the file is scanned for a string delineated with a starting and ending double quote character. Text which is not enclosed in double quotes is ignored. Text outside double quotes may be used to document or comment the associated string. If no double quotes are found on a given line of text, then that string will be equivalent to the null string at runtime. The null string is the same thing as "".


Escape Sequences

If a string needs to make use of the " character itself, it should be preceded with the escape delineation character \. The \ character is also used to specify non-ASCII (extended) bytes and control codes. If the \ character itself is needed within a string, it must be preceded with another instance of \. The full list of supported escape sequences is given in the following table. All escape sequences are translated to 1 character at the time of string table load. In other words, these sequences look like multiple characters, but represent only one.

In addition, an arbitrary character value can be specified by \ooo, where ooo is one to three octal digits (0...7) or by \xHH, where HH is one or two hexadecimal digits (0...9, a...f, A...F), or by \uHHHH, where HH is one to four hexadecimal digits.


Escape SequenceMeaning
\aalert (bell character), same as \x07
\bbackspace, same as \x08
\fformfeed, same as \x0C
\nline feed, same as \x0A
\rcarriage return, same as \x0D
\thorizontal tab, same as \x09
\vvertical tab, same as \x0B
\\backslash
\"double quote
\ooooctal escape sequence which is an 8 bit character value given in octal, where each 'o' is a different octal digit, 0-7. For example \02
\xHHhex escape sequence which is an 8 bit character value given in hexadecimal
\uHHHHunicode escape sequence which is a 16 bit character value given in hexadecimal
Note
Strings in the string table are stored as a sequence of 16 bit characters. The only way to set the most significant byte of any character is to use the \uHHHH form for each such character whose upper byte is not zero. For ASCII characters, the upper byte will be zero. The first and last double quotes encountered on each line define the string that will be retained in the RAM resident string table, enclosing double quotes will be stripped off.

Here is a sample string table which is shown with its [STRINGS] section identifier.

[STRINGS]
1  "Enter your \"name:\""               prompt the user for his name
2  "Enter your access code:\a"          prompt user for access code and beep (\a).
3  Tell user thank you.                 "Thank you for being there."
4  "\x1B[%d;%dH"                        ANSI terminal cursor position code,
5  which is ESC [#;#H
6  "\x10\x06"                           Data Highway DLE ACK control codes.
7  "NK %S\0"                            Tool Coordinator Not Acknowledge
8  "HM %3d %d %S\0"                     Tool Positioner Home command.
"\b\b\b"                     9          3 backspaces to erase last input.
"First line\r\nsecond line"    10       Output two lines using \r\n.
"Here is a unicode character: \u124F"

The [STRINGS] section file will generate 11 strings, numbered 1 to 11 in the RAM resident string table. String 5 will be the null string, since line 5 has no double quoted text (line 5 was used as a continuation of a comment relating to string 4).

The above example shows how COMGENIUS looks only for the first and last set of double quotes to define the bounds of each string. (See lines 3, 9 and 10).