Positron Compiler Documentation

Parameters

Positron8 · Revision 4.0.6.5 · PDF page 454

A procedure may have up to 10 parameters. Each parameter must be given a unique name and a variable type. The parameter name must consist of more than one character. The types supported as parameters are:

Bit, Pin, Byte, SByte, Word, SWord, Long, Dword, SDword, Float, and String.

A parameter can be passed by value or by reference. By value will copy the contents into the parameter variable, while by reference will copy the address of the original RAM variable, or flash memory address into the parameter variable. By default, a parameter is passed by value. In order to pass a parameter by RAM reference, so that it can be accessed by one of the PtrX commands, the parameter name must be preceded by the text ByRef. In order to pass the address of a flash (code) memory label or quoted string of characters, so it can be accessed by the cPtrX commands, the parameter's name must be preceded by the text BycRef. For clarification, the text ByValue may precede a parameter name to illustrate that the variable is passed by value. For example:

Proc MyProc(ByRef pWordin as Word, ByValue pDwordin as Dword)
  HRsout  Dec pWordin, " : ", Dec pDwordin, 13
EndProc

The syntax for creating parameters is the same as when they are created using Dim. String and Array variables must be given lengths. For example, to create a 10 character String parameter use:

Proc MyProc(pMyString as String * 10)

To create a 10 element unsigned Word array parameter, use:

Proc MyProc(pMyArray[10] as Word)
View original PDF page 454Open page in PDFOriginal PDF page 454