Please go to our new site

PCC program variables, functions, math and reserved words

Selection of measurement channels.


PSYLAB variables are words used to represent numbers. Any variable contains the number 0 when PSYLAB measurement begins unless a program statement deliberately changes it. Variables used in PCC code may use any number of characters to 'describe' them, all of which must be exactly the same each time the variable is used in the program. (Variables used in the PSYLAB processing RFP programs are less positively identified, using only the first and last characters). One exception to this rule, however, is that the system is not 'case sensitive', it does not matter whether the letters in the character description are upper or lower case.

The 'description' characters used to represent a variable may be chosen to help remember what the purpose of the variable is in the particular program. For example, in a program which delivers a number of stimuli, there might be a variable named StimCount, which is increased by one every time a new stimulus is delivered. This variable could just as easily be called variable1 or V1, but then it would be necessary to remember what varaible1 does, as opposed to varaible2 etc. The use of upper case characters to break up the descriptor into its meaningful parts is recommended (e.g. the upper case S and C in StimCount). Spaces or other punctuation characters are not allowed, so this is a useful way to enhance readability of the program.

Any mix of letters and numbers may be used to describe a variable, as long as the first character is not a number. The variable descriptor may not be the same as any of the reserved words used for pre-defined functions.

 For those with knowledge of computer languages, PSYLAB PCC variables are only numeric, floating point (meaning that they may be fractional and have a range in the region of 10 to the power of +/-13).

Examples of use of variables and math.

Variables might be used as in the following examples. These are intended to suggest uses, and demonstrate syntax, but it should not imply limitation of other uses not shown. Notice that all lines in the PCC program except labels must start at least one space from the left.

 variable1 = .5

Value zero point five (0.5) is assigned to 'variable1'. Regardless of whatever value it had before, after execution of this line, it will contain 0.5. Any other value, positive or negtative could have been assigned. It is important to note that with fractional numbers, the leading zero should not be given.

 variable1 = variable1 + 1  

Every time program execution includes this line, 'variable1' will increase by one.

 if variable1 = 10 then gosub SUB1

The value of variable1 is used to determine when a conditional jump will occur. Assuming that varaible1 is changed as measurement continues, perhaps by counting the number of times a stimulus is presented, then only when it becomes ten (in that case, on the tenth stimulus) will the jump to subroutine SUB1 occur (which might perhaps be a UCS which is npresented only once). Notice that the label SUB1 is given in upper case. This is just a convention, which helps to separate the subroutine labels when reading the program. PSYLAB is not case sensitive, it sees upper and lower case letters the same.

 if variable1 = variable2 then gosub SUB1

This is similar to the last example, except that variable1 is compared to another variable, so that the condition under which the jump to SUB1 will occur can be repeated by changing the value of variable2. For example, if variable1 counted the total number of occurrences of the stimulus, but the stimulus sequence was repeated several times, variable2 could be set to some number relative to variable1 (e.g. variable2 = variable1 + 10) so that each time a new stimulus sequence began, the UCS would be delivered on the tenth stimulus in that sequence.

The following are a few examples of more complex math expressions. Parentheses must be used where shown.

 variable1 = variable1 + variable2

 variable1 = variable1 + (variable2 * variable3)

 if (variable1 + variable2) = (variable3 / variable4) then gosub SUB1

In the next example, an expression is calculated separately before the result is used in the specific functions. These functions will not allow use of complex expressions directly for their parameters:

 variable1 = variable2 + variable3

 tone variable1,1

 variable4 = table(variable1)

 print variable1

The last examples demonstrate that the parameters used for 'tone' and 'print' may not be expressions, nor the subscript for 'table'. This is also true for 'noise', 'relay', 'bin8', 'shock', and any function which has a subscript.

Reserved words

PSYLAB measurement PCC language uses a number of reserved words which are recognised by the system and perform specific functions. For example, the word Tone is used to operate the TG2 tone generator. These words must therefore be avoided when choosing descriptions for user variables. The following is a summary of PSYLAB PCC language reserved words. A full description may be found using HELP in the PSYLAB Measurement program editor menu.


------------------------- ----------------------------

BEEP                      Make a sound in the computer

BIN8                      Operate BIN8 TTL outputs

BINARY(..)                Convert numbers from 1-8 to 1-128 for BIN8.

CLS                       Clear the screen

DELAY UNTIL               Wait at this statement until condition is true

EPCUE                     Synchronise averaged EP display with stimulus

$EPMAGNIFY [factor]       Set magnification of on-line EP display

EPSTART                   Start new set of EP trials (zero on-line display)

FORCE [seconds]           Prevent display & disk storage at critical times

GOSUB ... RETURN          Jump program lines and return back

GOTO                      Jump program lines

GROUP                     Group number for subjects (put in results file)

$GROUP                    Cause prompt for group number at exp. start

IF ... THEN ...           If expression after if is true, do ... after then

INPUT                     Read in a number from the keyboard

INT(..)                   Convert fraction to whole number

KEY                       Returns number of function key (also KEY = ..)

LATENCY                   Increases with time resolved to sampling interval

LINE                      Plot a line or draw a box on screen

LOCATE                    Determine position for PRINT

MARK                      Put a vertical mark on graphs

$MC24                     Accommodate MC24 12 bit A-D converter

$MEASURE                  Establish a channel of measurement

MODE [mode no]            Changes graph display format

$MONO                     Force CGA black and white display

NOISE [level] [time]      Operate white noise generator

PARAMETER                 Similar to SUBJECT and GROUP

$PARAMETER                Cause prompt for number at experiment start

PRINT                     Write on the measurement screen (see LOCATE)

RANDOM                    Produce random number between 0 and 255

RATE [samples/sec]        Adjust sample rate (or switch off sampling)

$RATE [samples/sec]       Establish data rate at start of measurement

RELAY                     Operate RL8 relay coupler

RETURN                    ..from GOSUB

RUN [program]             Start another PCC control file

$SAMPLE                   Establish measurement channel for old devices

SHOCK [level] [time]      Operate shock generator

$SPEED [pixels]           Change distance covered  x axis for each point

STORE                     End measurement or processing automatically

SUBJECT                   Returns Subject number

$SUBJECT                  Cause prompt for subject number at experiment start

TABLE(..)                 Array function (set up pseudo random conditions)

$TABLE                    Enter values into table array (like basic 'data')

$TABLESAVE                Retain original measurement table for use in RFP

TIME                      Returns absolute time since recording began

TONE [vol] [freq] [time]  Operate tone generator

Back to PSYLAB Hardware
Back to PSYLAB Software
Back to Home page