Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 12 of 25

Attended Workstations (Catalog Nos. 2708-DH5B2L & -DH5B4L) (Series B) User Manual: 11 - The A-B VBASIC CROSS-COMPILER (LXB)

Pages 93 to 96 of 186, from Attended Workstations (Catalog Nos. 2708-DH5B2L & -DH5B4L) (Series B) User Manual

The original document is the PDF (513 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Allen-Bradley 2708

Page 93

Chapter

A–B

11

The A-B VBASIC CROSS-COMPILER (LXB) Overview

The Visual BASIC Development Environment alone will not generate a program for a workstation. Visual BASIC allows the developer to create a program which can execute on a PC, but it is unable to create programs that a 2708-DH5 workstation can understand. To do that, we have developed a cross compiler that accepts an ASCII text file containing valid BASIC statements and creates a file that will execute only on a 2708-DH5 workstation. The extension .LXE is an adaptation of the .EXE name commonly used for executables under MS-DOS. Typically a program is created and tested on a PC compatible computer with Visual BASIC and the application library. Once the program is refined through editing and testing, it can be compiled into an LXE file. The LXE file is also an ASCII text file. However, because it contains pseudo-code it doesn’t look like anything familiar. Even character strings will not be visible in the file. The LXE can therefore be considered an encrypted file. Because it is pure ASCII displayable text, it can be uploaded to other computers without worrying about control codes or binary objects becoming garbled. There should be no problem, for example, uploading an LXE file to an IBM mainframe, which can later download the program to a 2708-DH5 network using its native EBCDIC/ASCII translation tables. Each line of an LXE file begins with a two-character sequence called a Network Directive. These are discussed in detail in Chapter 8. For downloadable files, the two characters are a greater than (>) and a comma (,). When the operating system sees an incoming record prefaced with these two characters, it knows that this is a line from a compiled program and not a line of data. If the file is in PGM format (see next section), it will have an additional network directive appended to the front of each record, and a 2-record header on the file. The next two characters will begin with AA and increment sequentially through ZZ. Any further discussion of the contents of the LXE records is beyond the scope of this document. Since the LXB compiler puts out an entire file, no further information is needed. Following a successful download, the workstation will begin immediately executing the program.

11–1

Page 94

Chapter 11 The A-B VBASIC CROSS-COMPILER (LXB)

Invoking the Compiler

The LXB compiler is executed on a PC by entering the following command. You must be in the right directory, or have the directory containing the LXB.EXE file set in your PATH. Optional parameters are in parentheses: LXB param 1 (,param2) (,param3) (,param4) The parameters are: param1 param2 param3 param4

Source filename (Default extension: .BAS) Download filename (Default extension: .LXE) Listing filename (Default extension: .LST) Secondary download filename (Automatic extension .PGM)

Entering the LXB command without any parameters will cause the compiler to prompt for the source, download, and list file names, offering defaults as appropriate. The default file extensions are in most cases the only allowable ones, and should not be specified or overwritten: A.BAS source file extension is assumed. The source filename must always be specified. The .LXE file is always generated. If the .LXE filename is omitted, it assumes the same name as the source file, and has the extension LXE. If the .LST filename is omitted, the compiler will not generate a listing. Use a comma to hold its place if you want to specify a 4th parameter but don’t want to enter the filename for the .LST file. If the .PGM filename is omitted, the compiler will not generate a secondary download file. If it is specified, LXB will output (in addition to the regular .LXE file) a download file which contains the necessary network directives to cause the program to be stored in RAM and not immediately executed upon download. This feature is used for programs which will be CHAINed to later on. The RAM filename for the CHAIN statement will be the one specified in this parameter. In order for the fourth file to be generated, the .LXE file’s default extension of “.LXE” MUST NOT be overridden.

11–2

Page 95

Chapter 11 The A-B VBASIC CROSS-COMPILER (LXB)

Invoking the Compiler (cont’d)

Examples: LXB In the case above, the operator is prompted for 3 file names. LXB Prog1 In this case, the file Prog1.BAS is read, and Prog1.LXE is the product. (This is the fastest compile option.) LXB Prog1,Prog1,Prog1 File Prog1.BAS is the source, Prog1.LXE and Prog1.LST are generated. LXB Prog1,Download,PRN Generate Download.LXE, and send listing directly to the printer (PRN). LXB Prog1,Startnow,Prog1,Wait Generate Startnow.LXE and Wait.PGM output files, and Prog1.LST as the listing file.

A – Source File Specification The A-B VBASIC compiler requires a plain ASCII text file. By default, the Visual BASIC editor saves the source text in a compacted format. Be sure to use the SAVE AS option in Microsoft’s Visual BASIC to save the source as an ASCII file. LXB cannot recognize the compacted representation. For a tutorial on BASIC programming, please refer to Microsoft’s “Learning and Using Microsoft Visual BASIC”, and “Programming in BASIC”, both of which are supplied with the Application Generator Software (Catalog No. 2708-NAG) and BASIC Language Development Kit Software (Catalog No. 2708-NBD). A list of the STATEMENTS & FUNCTIONS supported by A-B VBASIC can be found in Appendix M of this manual.

11–3

Page 96

Chapter 11 The A-B VBASIC CROSS-COMPILER (LXB)

Invoking the Compiler (cont’d)

B – Downloaded Executable File The usual extension of a file that is produced by most other compilers is “.OBJ”. Those files usually go through a separate LINK step before an executable “.EXE” file is generated. However, the extension of the A-B VBASIC cross compiler output is “.LXE”. The extension “.LXE” is used for two reasons: 1. The file cannot be link edited like a usual PC object file. 2. There is only one useful operation that can be performed on this file: Download it to a workstation. The code portion of the file is checksummed. Except for carriage returns, the entire file is within the printable ASCII character set. Transmission of a download file using modems should be safe since a corrupted file will result in a checksum error instead of program initiation.

C – Listing File If specified, LXB places a listing into a file with the same base name as the source file, with an “.LST” extension. The OFFSET column of the listing shows the location of the pseudo-code corresponding to the BASIC statement. Error messages at run-time provide this offset as an aid in locating errors. Program pseudo-code size is given in the listing file which can be used to gauge how much of the maximum 13,700 bytes of available program space (32K memory workstation) were used. Other statistics provide insight into the free variable space and other elements of memory use.

D – Secondary Download File If the secondary download file parameter is specified, then a .PGM file will be output in addition to the .LXE file. The .PGM file is a special type of download file which will not begin executing immediately, but rather stores itself into RAM for future execution via a CHAIN statement from another program. It does this by appending some additional network directives onto the front of the file, and onto each record.

11–4