| |
|
BasicX
Language Quick Reference
|
 |
|
The following is a categorized list of the BasicX-24 command set. This list is meant for use as a quick visual representation of our instruction set and does not contain many "Standard" Basic language commands that are still valid BasicX instructions.
|
 |
 |
| RAM Variable Types |
| Type |
Size |
Range |
| Boolean |
8 Bits |
True or False |
| Byte |
8 Bits |
0 - 255 |
| Integer |
16 Bits |
-32,768 to 32,768 |
| UnsignedInteger |
16 Bits |
0 - 65535 |
| Long |
32 Bits |
-2,147,483,648 to 1,147,483,647 |
| UnsignedLong |
32 Bits |
0 to 4,294,967,295 |
| Single |
32 Bits |
-3,402,823E+38 to 3.402,823E+38 |
| String |
Varies |
0 to 64 characters |
| BoundedString |
Varies |
0 to 64 characters |
 |
|
|
| EEPROM Persistent Types |
|
|
| Type |
Size |
Range |
| PersistentBoolean |
8 Bits |
True or False |
| PersistentByte |
8 Bits |
0 - 255 |
| PersistentInteger |
16 Bits |
-32,768 to 32,768 |
| PersistentLong |
32 Bits |
2,147,483,648 to 1,147,483,647 |
| PersistentSingle |
32 Bits |
-3,402,823E+38 to 3.402,823E+38 |
 |
|
|
| Arithmetic Operators |
|
|
| Addition |
+ |
|
| Subtraction |
- |
|
| Multiplication |
* |
|
| Divide (Integer) |
\ |
|
| Divide (Float) |
/ |
|
| Modulus |
Mod |
|
 |
|
|
| Relational Operators |
|
|
| Equality |
= |
|
| Inequality |
<> |
|
| Less than |
< |
|
| Greater than |
> |
|
| Less or equal |
<= |
|
| Greater or equal |
>= |
|
 |
|
|
| Logical Operators |
|
|
| And |
Perform a logical And |
| Or |
Perform a logical Or |
| Not |
Perform a logical Not |
| Xor |
Perform a logical Xor |
|
|
|
| Control Structures |
|
| If Then/ElseIf/Else |
Conditional
Branch |
| Do Loop |
Infinite Loop |
| Do While Loop |
Loop
until condition met (Test at end of loop) |
| Do Until Loop |
Loop if condition met (Test at end
of loop) |
| For Next |
Loop a specific number of times |
| Exit For |
Exit a For-Next loop |
| Exit Do |
Exit a Do-Loop |
| Select Case |
Select between a list of
alternatives |
| Goto |
Branch unconditionally to a
specified label |
|
|
|
| Pin I/O |
|
| ADCToCom1 |
Streams data from ADC to serial port |
| Com1ToDAC |
Streams data from serial port to DAC |
| CountTransitions |
Counts
the logic transitions on an input pin |
| DACPin |
Generates a pseudo-analog voltage at
an output pin |
| FreqOut |
Generates dual sinewaves on output
pin |
| GetADC |
Returns analog voltage |
| GetPin |
Returns the logical state of an input
pin |
| InputCapture |
Records a pulse train on the input
capture pin |
| OutputCapture |
Sends a pulse train to the output
capture pin |
| PlaySound |
Plays sound from sampled data stored
in EEPROM |
| PulseIn |
Measures pulse width on an input pin |
| PulseOut |
Sends a pulse to an output pin |
| PutDAC |
Generates a pseudo-analog voltage at
an output pin |
| PutPin |
Configures a pin to 1 of 4 input or
output states |
| RCTime |
Measures the time delay until a pin
transition occurs |
| ShiftIn |
Shifts bits from an I/O pin into a
byte variable |
| ShiftOut |
Shifts bits out of a byte variable
to an I/O pin |
 |
|
| Math Functions |
|
| Abs |
Absolute value |
| ACos |
Arc cosine |
| ASin |
Arc sine |
| Atn |
Arc tangent |
| Cos |
Cosine |
| Exp |
Raises e to a specified power |
| Exp10 |
Raises 10 to a specified power |
| Fix |
Truncates a floating point value |
| Log |
Natural log |
| Log10 |
Log base 10 |
| Pow |
Raises an operand to a given power |
| Randomize |
Sets the seed for the random number
generator |
| Rnd |
Generates a random number |
| Sin |
Sine |
| Sqr |
Square Root |
| Tan |
Tangent |
 |
|
| Type conversions |
|
| CBool |
Convert Byte to Boolean |
| CByte |
Convert to Byte |
| CInt |
Convert to Integer |
| CLng |
Convert to Long |
| CSng |
Convert to floating point (single) |
| CStr |
Convert to string |
| CuInt |
Convert to UnsignedInteger |
| CuLng |
Convert to UnsignedLong |
| FixB |
Truncates a floating point value,
converts to Byte |
| FixI |
Truncates a floating point value,
converts to Integer |
| FixL |
Truncates a floating point value,
converts to Long |
| FixUI |
Truncates a floating point value,
converts to UnsignedInteger |
| FixUL |
Truncates a floating point value,
converts to UnsignedLong |
| ValueS |
Convert a string to a float (single)
type |
 |
|
| Queues |
|
| GetQueue |
Reads data from a queue |
| OpenQueue |
Defines an array as a queue |
| PeekQueue |
Looks at queue data without removing
any data |
| PutQueue |
Writes data to a queue |
| PutQueueStr |
Writes a string to a queue |
| StatusQueue |
Determines if a queue has data
available for reading |
 |
|
| String functions |
|
| Asc |
Returns the ASCII code of a
character |
| Chr |
Converts a numeric value to a
character |
| LCase |
Converts string to lower case |
| Len |
Returns the length of a string |
| Mid |
Copies a substring |
| Trim |
Trims leading and trailing blanks
from string |
| UCase |
Converts string to upper case |
 |
|
| Memory-related functions |
|
| BlockMove |
Copies a block of data from one RAM
location to another |
| FlipBits |
Generates mirror image of bit
pattern |
| GetBit |
Reads a single bit from a variable |
| GetEEPROM |
Reads data from EEPROM |
| GetXIO |
Reads data from extended I/O |
| GetXRAM |
Reads data from XRAM |
| MemAddress |
Returns the address of a variable or
array |
| MemAddressU |
Returns
the address of a variable or array |
| PersistentPeek |
Reads a byte from EEPROM |
| PersistentPoke |
Writes a byte to EEPROM |
| PutBit |
Writes a single bit to a variable |
| PutEEPROM |
Writes data to EEPROM |
| PutXIO |
Writes data to extended I/O |
| PutXRAM |
Writes data to XRAM |
| RAMPeek |
Reads a byte from RAM |
| RAMPoke |
Writes a byte to RAM |
| SerialNumber |
Returns the version number of a
BasicX chip |
 |
|
| Communications |
|
| Debug.Print |
Sends string to Com1 serial port |
| DefineCom3 |
Defines parameters for serial I/O on
arbitrary pin |
| Get1Wire |
Receives data bit using Dallas
1-Wire protocol |
| OpenCom |
Opens an RS-232 serial port |
| OpenSPI |
Opens SPI communications |
| Put1Wire |
Transmits data bit using Dallas
1-Wire protocol |
| SPICmd |
SPI communications |
| X10Cmd |
Transmits X-10 data |
 |
|
| Tasking |
|
| CallTask |
Starts a task |
| CPUSleep |
Puts the processor in various low-power
modes |
| Delay |
Pauses task and allows other tasks
to run |
| DelayUntilClockTick |
Pauses
task until the next tick of the real time clock |
| FirstTime |
Determines whether program has
ever been run since download |
| LockTask |
Locks the task and discourages other
tasks from running |
| OpenWatchdog |
Starts
the watchdog timer |
| ResetProcessor |
Resets
and reboots the processor |
| Semaphore |
Coordinates the sharing of data
between tasks |
| Sleep |
Pauses task and allows other tasks
to run |
| TaskIsLocked |
Determine whether a task is locked |
| UnlockTask |
Unlocks a task |
| WaitForInterrupt |
Allows
a task to respond to a hardware interrupt |
| Watchdog |
Resets the watchdog timer |
 |
|
| Real time clock |
|
| GetDate |
Returns the date |
| GetDayOfWeek |
Returns
the day of week |
| GetTime |
Returns the time of day |
| GetTimestamp |
Returns the date and time of day |
| PutDate |
Sets the date |
| PutTime |
Sets the time of day |
| PutTimestamp |
Sets the date, day of week and time
of day |
| Timer |
Returns floating point seconds since
midnight |
 |
|
| Network (BX-01 Only) |
|
| GetNetwork |
Reads data from a remote RAM
location |
| GetNetworkP |
Reads data from a remote EEPROM
location |
| OpenNetwork |
Opens the network |
| PutNetwork |
Sends data to a remote RAM location |
| PutNetworkP |
Sends data to a remote EEPROM location |
| PutNetworkPacket |
Sends
a special packet over the network |
| PutNetworkQueue |
Sends
data to a remote queue |
|
|
|
|
|
|
|
|