Positron Compiler Documentation

Compiler commands and directives — quick reference

Positron16 · Revision 1.1.3.5 · PDF pages 131–134

Compiler Commands and Directives

Peripheral and Interfacing Commands

ADinRead the on-board analogue to digital converter.
BstartSend a Start condition to the I2C bus.
BstopSend a Stop condition to the I2C bus.
BrestartSend a Restart condition to the I2C bus.
BusAckSend an Acknowledge condition to the I2C bus.
BusNackSend an Not Acknowledge condition to the I2C bus.
BusinRead bytes from an I2C device using a bit-bashed interface.
BusoutWrite bytes to an I2C device using a bit-bashed interface.
ButtonDetect and debounce a key press.
PinClearPull a pin low using a variable as the pin number.
CounterCount the number of pulses occurring on a pin.
DTMFoutProduce a DTMF Touch Tone note.
FreqoutGenerate one or two tones, of differing or the same frequencies.
PinGetRead a pin from a port using a variable as the index
HbStartSend a Start condition to the I2C bus using the MSSP1 peripheral.
HbStopSend a Stop condition to the I2C bus using the MSSP1 peripheral.
HbRestartSend a Restart condition to the I2C bus using the MSSP1 peripheral.
HbusAckSend an Ack condition to the I2C bus using the MSSP1 peripheral.
HbusNackSend a Not Ack condition to the I2C bus using the MSSP1 peripheral.
HbusinRead from an I2C device using the MSSP1 peripheral.
HbusoutWrite to an I2C device using the MSSP1 peripheral.
HbStart2Send a Start condition to the I2C bus using the MSSP2 peripheral.
HbStop 2Send a Stop condition to the I2C bus using the MSSP2 peripheral.
HbRestart 2Send a Restart condition to the I2C bus using the MSSP2 peripheral.
HbusAck2Send an Ack condition to the I2C bus using the MSSP2 peripheral.
HbusNack2Send a Not Ack condition to the I2C bus using the MSSP2 peripheral.
Hbusin 2Read from an I2C device using the MSSP2 peripheral.
Hbusout2Write to an I2C device using the MSSP2 peripheral.
High (PinHigh)Make a Port or a Port’s pin output high.
HpwmGenerate a PWM signal using one of the CCP peripherals.
I2CinRead bytes from an I2C device with user definable SDA\SCL lines.
I2CoutWrite bytes to an I2C device with user definable SDA\SCL lines.
InkeyScan a matrix keypad.
Input (PinInput)Make a Port or a Port’s pin an input.
Low (PinLow)Make a Port or a Port’s pin output low.

Output (PinOutput) Make a Port or a Port’s pin an output.

OreadReceive data from a device using the Dallas 1-wire protocol.
OwriteSend data to a device using the Dallas 1-wire protocol.
PinModeMake a specified Pin an input, output.
PotRead a potentiometer on specified pin.
PulseInMeasure the pulse width on a pin.
PulseOutGenerate a pulse from a pin.
PWMOutput a Pulse Width Modulated pulse train to pin.
RCinMeasure a pulse width on a pin.
ServoControl a servo motor.
PinSetSet a pin high using a variable as the pin number.
ShinSynchronous serial input.
ShoutSynchronous serial output.
SoundGenerate a tone or white-noise on a specified pin.
ToggleReverse the state of a port's bit.
View original PDF page 131Open page in PDFOriginal PDF page 131
Touch_ActiveDetect if the touch screen is being touched.
Touch_ReadRead the X and Y coordinates from the touch screen

Touch_HotSpot Detect a touch within a user defined window on the touch screen.

LCD Commands

BoxDraw a square on a graphic LCD.
CircleDraw a circle on a graphic LCD.
ClsClear an LCD.
CursorPosition the cursor on the LCD.
LCDreadRead a single byte from a Graphic LCD.
LCDwriteWrite bytes to a Graphic LCD.
LineDraw a line in any direction on a graphic LCD.
LineToDraw a straight line in any direction on a graphic LCD, starting from the

previous Line command's end position.

PixelRead a single pixel from a Graphic LCD.
PlotSet a single pixel on a Graphic LCD.
PrintDisplay characters on an LCD.
Toshiba_CommandSend a command to a Toshiba T6963 graphic LCD.
Toshiba_UDGCreate User Defined Graphics for Toshiba T6963 graphic LCD.
UnPlotClear a single pixel on a Graphic LCD.

Async Serial Commands

HrsinReceive data from the serial port on devices that contain a USART.
HrsoutTransmit data from the serial port on devices that contain a USART.
HrsoutLnTransmit data from the serial port on devices that contain a USART

and transmit a terminator value or values.

HserinReceive data from the serial port on devices that contain a USART.
HseroutTransmit data from the serial port on devices that contain a USART.
HseroutLnTransmit data from the serial port on devices that contain a USART

and transmit a terminator value or values.

Hrsin2Same as Hrsin but using a 2nd USART if available.
Hrsout2Same as Hrsout but using a 2nd USART if available.
Hrsout2LnSame as HrsoutLn but using a 2nd USART if available.
Hserin2Same as Hserin but using a 2nd USART if available.
Hserout2Same as Hserout but using a 2nd USART if available.
Hserout2LnSame as HseroutLn but using a 2nd USART if available.
Hrsin3Same as Hrsin but using a 3rd USART if available.
Hrsout3Same as Hrsout but using a 3rd USART if available.
Hrsout3LnSame as HrsoutLn but using a 3rd USART if available.
Hserin3Same as Hserin but using a 3rd USART if available.
Hserout3Same as Hserout but using a 3rd USART if available.
Hserout3LnSame as HseroutLn but using a 3rd USART if available.
Hrsin4Same as Hrsin but using a 4th USART if available.
Hrsout4Same as Hrsout but using a 4th USART if available.
Hrsout4LnSame as HrsoutLn but using a 4th USART if available.
Hserin4Same as Hserin but using a 4th USART if available.
Hserout4Same as Hserout but using a 4th USART if available.
Hserout4LnSame as HseroutLn but using a 4th USART if available.
RsinAsynchronous serial input from a fixed pin and Baud rate.
RsoutAsynchronous serial output to a fixed pin and Baud rate.
RsoutLnAsynchronous serial output to a fixed pin and Baud rate,

and transmit a terminator value or values.

View original PDF page 132Open page in PDFOriginal PDF page 132
SerinReceive asynchronous serial data (i.e. RS232 data).
SeroutTransmit asynchronous serial data (i.e. RS232 data).

Comparison and Loop Commands

BranchComputed GoTo (equiv. to On..GoTo).
BranchLBranch out of page (long Branch).
BreakExit a loop prematurely.
ContinueCause the next iteration of the enclosing loop to begin.
Do...LoopExecute a block of instructions until a condition is true.

For…to…Next…Step Repeatedly execute statements. If..Then..ElseIf..Else..EndIf Conditionally execute statements.

On GosubCall a Subroutine based on an Index value.
On GoToJump to an address in code memory based on an Index value.

(Primarily for smaller devices)

On GotoL Jump to an address in code memory based on an Index value.

(Primarily for larger devices)

Repeat...Until Execute a block of instructions until a condition is true.

Select..Case..EndSelect Conditionally run blocks of code.

Tern A form of Ternary Operator and has the same mechanism as a

C compiler's '?' directive.

While…Wend Execute statements while condition is true.

General BASIC Commands

CallCall an assembly language subroutine.
ClearPlace a variable or bit in a low state, or clear all RAM area.
ClearBitClear a bit of a port or variable, using a variable index.
DecDecrement a variable.
DelayMsDelay (1 millisecond resolution).
DelayUsDelay (1 microsecond resolution).
DelayCsDelay (1 clock cycle resolution).
DigReturn the value of a decimal digit.
GetBitExamine a bit of a port or variable, using a variable index.
GosubCall a BASIC subroutine at a specified label.
GoToContinue execution at a specified label.
IncIncrement a variable.
LoadBitSet or Clear a bit of a port or variable, using a variable index.

Ptr8, Ptr16, Ptr32, Ptr64 Indirectly read or write RAM using a variable to hold the address.

RandomGenerate a pseudo-random number.
ReturnContinue at the statement following the last Gosub.
RolBitwise rotate a variable left with or without the microcontroller’s Carry flag.
RorBitwise rotate a variable right with or without the microcontroller’s Carry flag.
SeedSeed the random number generator, to obtain a more random result.
SetPlace a variable or bit in a high state.
SetBitSet a bit of a port or variable, using a variable index.
StopStop program execution.
SwapExchange the values of two variables.
EndStop execution of the BASIC program.
View original PDF page 133Open page in PDFOriginal PDF page 133

RAM String Variable Commands

Left$Extract n amount of characters from the left of a String.
Mid$Extract characters from a String beginning at n characters from the left.
Right$Extract n amount of characters from the right of a String.
StrLoad a Byte array with values.
StrnCreate a null terminated byte array.
Str$Convert the contents of a variable to a null terminated String.
ToLowerConvert the characters in a String to lower case.
ToUpperConvert the characters in a String to upper case.
ValConvert a null terminated String to an integer value.

Non-Volatile Data Commands

cPtr8, cPtr16, cPtr32, cPtr64 Indirectly read flash memory using a variable as the address.

CdataPlace information into flash memory. For access by CreadX.
Cread8, Cread16, Cread32, Cread64Read a value from a code memory table.
EdataDefine initial contents of on-board EEPROM.
EreadRead a value from on-board EEPROM.
EwriteWrite a value to on-board EEPROM.
LookDownSearch a constant lookdown table for a value.
LookDownLSearch constant or variable lookdown table for a value.
LookUpFetch a constant value from a lookup table.
LookUpLFetch a constant or variable value from lookup table.

Directives

AddressOfLocate the address of a variable or label.
Asm-EndAsmInsert assembly language code section.
ConfigSet or Reset programming fuse configurations.
DeclareAdjust library routine parameters.
DeviceChoose the type of PIC24® or dsPIC33® microcontroller to compile for.
DimCreate a variable.
IncludeLoad a BASIC file into the source code.
Proc-EndProcCreate a procedure unit
Sub-EndSubCreate a subroutine unit

ISR_Start...ISR_End Define an interrupt handler block of code.

Symbol Create an alias to a constant, port, pin, or register.

View original PDF page 134Open page in PDFOriginal PDF page 134