FC 91 - BASIC Configuration

The BASIC configuration function code defines the amount of NVRAM and RAM memory allocated to the BASIC program.  It also defines BASIC operating modes. This function code provides one output that the BASIC program sets using the BOUT command. The MFC BASIC Programming Language Reference provides complete instructions for programming the module with BASIC. Only one BASIC configuration function block can be configured per module.

 

NOTE: This function code is supported only on the BRC-100 and the IMMFP11/12 controllers.

 

 

Outputs:

Blk

Type

Description

N

R

The BOUT command in the BASIC program sets output N

 

 

Specifications:

Spec

Tune

Default

Type

Range

Description

S1

N

1

I

0 or 1

Action on BASIC error:

0 = trip module

1 = write error data to terminal and suspend BASIC

S2

N

1

I

0 or 1

Load/run flag:

0 = auto startup on restart

1 = manual startup on restart

S3

N

1

I

Note 1

BASIC string space allocation in 1-kbyte increments

(NVRAM)

S4

N

1

I

Note 2

BASIC data space allocation in 1-kbyte increments

(RAM)

S5

N

1

I

0 - 63

BASIC program space allocation in 1-kbyte increments

(NVRAM)

 

NOTES:

1. Maximum value is S3 + S5 < 414.

2. Maximum values is S3 + S4 + S5 < 1530.

 

 

 

91.1 Explanation

 

91.1.1 Specifications

 

S1 – ERROR

Sets the action taken on a BASIC error.

0 = trip module

1 = write error to data terminal and suspend BASIC

 

The error writes to the printer or display screen designated in the BASIC program as the data terminal, and the BASIC program stops.

 

S2 – LRFLAG

Load/run flag. It defines the action to be taken by the BASIC interpreter when an invoke BASIC function block is executed. If zero, then the BASIC program contained in EEROM automatically loads into RAM and executes. If one, then the BASIC interpreter prompts for further action.

0 = auto startup of the invoke BASIC block

1 = manual startup at the invoke BASIC block

 

S3 – STRSPC

BASIC string space allocation defined in one kilobyte increments. BASIC string space is allocated in RAM memory. Estimate the amount of required string space from the program's declarations section.

 

S4 – DATSPC

Sets the BASIC data space allocation defined in one kilobyte increments. Data consists of independent variables and constants. BASIC data space is allocated in RAM memory. Estimate the amount of required data space from the program's declarations section.

 

S5 – PGMSPC

Sets the BASIC program space allocation defined in one kilobyte increments. The program consists of a group of functions that perform specified actions and return values depending on the value of one or more independent variables. BASIC program space is allocated in both NVRAM and RAM memory. The amount of BASIC program space is the BASIC program file size.

 

 

91.1.2 Outputs

 

N

Any value from the BASIC program. The BASIC program specifies output N using the BOUT command.

 

 

 

91.2 Application

 

Figure 91-1 shows a sample of a BASIC program in a module.

 

 

Step 1

Place function code 91 (configure BASIC) in block 30. Placement of this function code is user selected.

S1 = 1

Write any errors to the data terminal and suspend BASIC.

S2 = 1

BASIC interpreter prompts for action before running the program. BASIC provides a ready reply when addressed by a dumb terminal or personal computer. Specification S2 equals one while it is being programmed. After programming is complete, change S2 to zero. When S2 equals zero, the program runs automatically on module power up.

S3 = 1 = 1k of string space allotted.

S4 = 5 = 5k of data space allotted.

S5 = 10 = 10k of program space allotted.

 

Step 2

Place function code 92 (invoke BASIC) in block 500. Placement of this function code is user selected.

S1 = 1

This block invokes BASIC when executed. Control returns to the next numbered block when BASIC exits

 

Step 3

Place the module in execute mode. The ready reply shows on the display. Enter the BASIC statements. Remember to save

the BASIC program before changing S2 in block 30 to zero.