OS Reference Overview

Apart from the programming language, there is a fair chunk of firmware in the computer that manages the operation of the input and output, the screen and keyboard, the filing system and several other things too. We call this chunk of software, the Operating System (OS)

This section tries to define some of the concepts relevant to the computer and then going into the definition of the commands specific to it.

Character Input Output

Character based input is what you want to enter into the machine, it includes typed commands at the keyboard and any other text. Character based output is information printed by the machine on the screen for reading.

The computer will accept character input from the serial port and the keyboard at the same time. Character input is fed into the 'console' which provides a prompt and accepts typed commands.

The computer will output character data to the serial port and LCD screen (if fitted) at the same time. An echo of what is typed is always outputon the console, so that the user can see what is being typed.

When a program is run, any character based output is sent to the console for reading. Any character based input for the program is read from the console, via the serial port and keyboard (if connected).

Controller Input Output

This type of IO is used to switch electronic devices on and off, or take input from electrical sensors or switches.

The computer has the ability to set and read the status of 8 digital IO pins and also read the voltages at 4 analogue input pins. Access to these IO ports are via special operating system commands (SYS commands).

SYS Commands

These commands provide direct access to the operating system features

SYS 0 - Reset

SYS 0,0

This command will restart the computer immediately


SYS 1 - Streams

SYS 1, Setting

This command can be used to control where input and output is connected to.

A single setting number must be provided. Use the table below to determine which settings are required, and add their values up. Use the sum as the setting.

FeatureValue
Output stream to serial port1
Output stream to LCD screen2
Input stream from serial port4
Input stream from keyboard8

See the following examples:-

Output to LCD screen, input from keyboard only: sys 1,10
Output to LCD and serial port, input from keyboard only: sys 1,7
Output to LCD and serial port, input from keyboard and serial port: sys 1,15
Output to serial port, input from serial port: sys 1,5


SYS 2 - Serial Speed

SYS 2,Speed

This command will set the speed of the serial port speed in bps (bits per seconds). The default is 9600

See the following examples:-

Set 2400 bps: sys 2,2400
Set 9600 bps: sys 2,9600
Set 19200 bps: sys 2,19200

The serial port always uses 8 data bits and one stop bit.


SYS 3 - Scroll locking

SYS 3, Setting

This command controls the scroll locking for text printed to the LCD display.
When enabled, the computer will wait for the space key to be pressed when the LCD screen is already full of text and about to scroll up.

See the following examples:-

Automatic scroll locking is on: sys 3,1
Automatic scroll locking is off: sys 3,0


SYS 10 - IO Pin Config

SYS 10,Pin,Setting

This command is used to configure any of the 8 digital IO pins as an input or output.

Pin corresponds to the IO pin to be configured.

The Setting can be 0 for input or 1 to set the pin as an output.

If the pin is configured as an output, it's output voltage will be 0v until it is turned on.

If the pin is configured as an input its pin voltage will be 0v with a weak pull down resistor.
The pin will read a logic 0 until 3v is applied to the pin which will make it read a logic 1.


SYS 11 - Output pin on/off

SYS 11,Pin,Output

This command is used to turn an output pin on or off.

Pin corresponds to the output pin to be control.

Output must be either 0 or 1.
Setting 0 will make the pin go to 0 volts
Setting 1 will make the pin go to 3 volts.


SYS 12 - Read an input pin

SYS 12,Pin

This command is used to read the value of an input pin.

Pin corresponds to the IO pin to be configured, for a digital input pin, the numbers are 1 to 8. For analogue inputs, the pin numbers are 100 to 103

See the following examples:-

Read the digital pin 1: PRINT SYS 12,1
Read the digital pin 3: PRINT SYS 12,8
Read the digital pin 8: PRINT SYS 12,8
Read the analogue pin 1: PRINT SYS 12,100
Read the analogue pin 2: PRINT SYS 12,101
Read the analogue pin 3: PRINT SYS 12,102
Read the analogue pin 4: PRINT SYS 12,103


SYS 20 - Draw a sprite

SYS 20,spid,x,y

This command will draw one of the a pre-defined sprites with id spid on the LCD screen at location x,y

SYS 50 - Define a sprite

SYS 50,spid,bitmap

This command will defines a sprite for drawing on the LCD screen. spid is the numerical id of the sprite. bitmap is a string of 8 bytes in hexadecimal characters.

See the following examples:-

Define a solid black box with id 1 SYS 50,1,FFFFFFFFFFFFFFFF
Define an empty box with id 2 SYS 50,2,FF818181818181FF


(c) 2017 PicoCreate

Terms and conditions apply, click here for further details