OS 4 - 14.02.00
0 Blank
Does nothing
Send Byte 0 = 0
Returns Nothing
1 Version
Read the operating system version number
Send Byte 0 = 1
Returns Byte 0 = version number - low byte
Byte 1 = version number - high byte
Comments Divide by 1000 to get the version number, eg. version 1.023
would be returned as 1023
2 Reset
Reset Smart Box
Send Byte 0 = 2
Byte 1 = 254 or 255
Returns Nothing
Comments Reset SmartBox from the host micro. Sending a 254 performs
a soft reset (same as pressing reset), sending 255 does a
hard reset (clears battery back RAM). Before sending
anymore codes create a small delay while SmartBox resets
various parts of hardware
3 NameCode
To obtain the operating system call number where the name
is known
Send Byte 0 = 3
Byte 1 - n = ASCII characters of OS call name
Byte n+1 = 13
Returns Byte 0 = Operating system call number
4 CodeName
To obtain the name associated with an operating system
call
Send Byte 0 = 4
Byte 1 = OS call number
Returns StringCR = OS call name
5 MultipleSetup
To set the values that will be returned by MultipleRead
Send Byte 0 = 5
Byte 1 = Analogue channel 1
Byte 2 = Analogue channel 2
Byte 3 = Analogue channel 3
Byte 4 = Analogue channel 4
Byte 5 = Digitial inputs
Byte 6 = Digital outputs
Byte 7 = Motor outputs
Returns Nothing
Comments This sets up the readings which will be returned when the
call MultipleRead is made. If a byte = 1 the corresponding
port will be returned, 0 = value not returned
6 MultipleRead
Returns multiple readings as defined using MultipleSetup
Send Byte 0 = 6
Returns Bytes as defined by MultipleSetup
Comments This call returns readings from a number of ports as
defined by MultipleSetup
7 MultipleServer
Constantly returns multiple readings as defined using
MultipleSetup
Send Byte 0 = 7
Returns Bytes as defined by MultipleSetup
Comments This call is similar to MultipleRead but continues to
return readings until SmartBox receives the byte 123
8 IdentSystem
Read System Information
Send Nothing
Returns Byte 0 = table length
Word = VIA
Word = ACIA
Word = ADC
Word = AUX.PORT
Word = jobs.status
Word = jobin.buf
Word = jobout.buf
Byte = Processor ident
Word = OS version number
Byte = Hardware version number
String10 = Name, padded to 10 chars
Byte = Number of inputs
Byte = Number of outputs
Byte = Number of motors
Byte = Number of analogues
Byte = BBR support
Byte = Short support
Byte = Printer support
Byte = Keypad support
Byte = LCD x dim/support
Byte = LCD y dim
OS Release 3,4
9 Credits
Returns the copyright string
Send Byte 0 = 9
Returns StringNUL = Copyright string
Comments This call returns the copyright message and OS details
10 WriteMotors
Writes a byte to the motor drivers
Send Byte 0 = 10
Byte 1 = value to write
Returns Nothing
Comments Each of the four motor outputs has two bits encoded into
this value, bits 0 and 1 are for motor a, bytes 2 and 3 are
for motor b, bits 4 and 5 are for motor c and bits 6 and 7
are for motor d, setting both bits to 0 will stop the
motor, setting the low bit high and high bit low will make
the motor go forward and setting the high bit high and the
low bit low will make it go backwards. Using this call
automatically stops all pulsing of motors
11 ReadMotors
Read the state of the motor drivers
Send Byte 0 = 11
Returns Byte 0 = value read from the motor drivers
Comments The value returned is the same value as what would be sent
to WriteMotors
12 MotorForward
Switch a motor on
Send Byte 0 = 12
Byte 1 = motor number (1 to 4)
Returns Nothing
Comments This makes the appropiate motor go forward. Using this call
automatically cancels the pulsing for the appropiate motor
13 MotorReverse
Switch a motor on with reverse polarity
Send Byte 0 = 13
Byte 1 = motor number (1 to 4)
Returns Nothing
Comments This makes the appropiate motor go backward. Using this
call automatically cancels the pulsing for the appropiate
motor
14 MotorHalt
Switch a motor off
Send Byte 0 = 14
Byte 1 = motor number (1 to 4)
Returns Nothing
Comments This makes the appropiate motor stop. Using this call
automatically cancels the pulsing for the appropiate motor
15 MotorPower
Pulse a motor outputs to vary speed
Send Byte 0 = 15
Byte 1 = motor number (1 to 4)
Byte 2 = on time
Byte 3 = off time
Returns Nothing
Comments This pulses the appropiate motor at a rate determined by
the on/off time (in centiseconds) specified, alternating
the motor between the state at which it was last defined
(Forward or Reverse) and Halt
16 PatchMF
Same as MotorForward
OS Release 3,4
17 MotorVoltage
Set voltage for motor outputs
Send Byte 0 = voltage (0 to 3)
Returns Nothing
Notes Voltage values are 0 (0v), 1 (6v), 2 (9v), 3 (12v).
*Setting a voltage of 0 will also switch *outputs* to 0v*
Comments This sets the actual voltage supplied to the motor outputs
OS Release 4
20 WriteOutputs
Write a 8 bit value to the digital output port
Send Byte 0 = 20
Byte 1 = byte to be written to the port
Returns Nothing
Comments Using this call automatically cancels all pulsing on the
output port
21 OutputPower
Vary the power by pulsing individual output lines
Send Byte 0 = 21
Byte 1 = bit number (0 to 7)
Byte 2 = on time
Byte 3 = off time
Comments This pulses the appropiate output line at a rate determined
by the on/off time (in centiseconds) specified, alternating
the output line between on and off
22 GetSensors
To read the type of sensors connected to the analogue
sensors
Send Byte 0 = 22
Returns Byte 1 = type of sensor connected to sensor A
Byte 2 = type of sensor connected to sensor B
Byte 3 = type of sensor connected to sensor C
Byte 4 = type of sensor connected to sensor D
Comments This returns the sensor types connected to the analogue
sensors that were returned from the last time they were
checked. A sensor type of 0 means no sensor
23 CheckSensors
To check the type of sensors connected to the analogue
sensors
Send Byte 0 = 23
Returns Byte 1 = type of sensor connected to sensor A
Byte 2 = type of sensor connected to sensor B
Byte 3 = type of sensor connected to sensor C
Byte 4 = type of sensor connected to sensor D
Comments This does an immediate check of the sensor types connected
to the analogue sensors. A sensor type of 0 means no
sensor
24 WriteSensorTable
Write sensor table entry
Notes * Not Implemented *
OS Release 3
25 ReadSensorTable
Read sensor table entry
Send Byte 0 = entry to read
Returns Byte 0 = sensor number
Byte 1 = number of decimal points to display
Byte 2 = max adc reading
Byte 3 = reading offset (LSB)
Byte 4 = reading offset (MSB)
Byte 5 = multiplication factor (LSB)
Byte 6 = multiplication factor (MSB)
Byte 7 = division factor (LSB)
Byte 8 = division factor (LSB)
String = full sensor title
String = abbreviated sensor label
String = sensor label
String = sensor units
Notes If byte 0 is &FF then sensor is unknown
OS Release 3,4
28 SetBitHigh
Set individual output line(s) high
Send Byte 0 = 28
Byte 1 = byte determining which lines will be set
Returns Nothing
Comments A bit set in the byte sent will set the corresponding
output line high
29 SetBitLow
Set individual output line(s) low
Send Byte 0 = 29
Byte 1 = byte determining which lines will be unset
Returns Nothing
Comments A bit set in the byte sent will set the corresponding
output line low
30 ReadADCReg
To read a ADC register
Send Byte 0 = 30
Byte 1 = register number (0 to 15)
Returns Byte 0 = value of register
OS Release 2
31 WriteADCReg
To write to a ADC register
Send Byte 0 = 31
Byte 1 = register number (0 to 15)
Byte 2 = value to write
Returns Nothing
OS Release 2
32 ReadACIAReg
To read a ACIA register
Send Byte 0 = 32
Byte 1 = register number (0 to 15)
Returns Byte 0 = value of register
OS Release 2
33 WriteACIAReg
To write to a ACIA register
Send Byte 0 = 33
Byte 1 = register number (0 to 15)
Byte 2 = value to write
Returns Nothing
OS Release 2
34 ReadVIAReg
To read a VIA register
Send Byte 0 = 34
Byte 1 = register number (0 to 15)
Returns Byte 0 = value of register
OS Release 2
35 WriteVIAReg
To write to a VIA register
Send Byte 0 = 35
Byte 1 = register number (0 to 15)
Byte 2 = value to write
Returns Nothing
OS Release 2
36 SetVIAHigh
To set bits in a VIA register
Send Byte 0 = 36
Byte 1 = register number (0 to 15)
Byte 2 = mask
Returns Nothing
OS Release 2
37 SetVIALow
To unset bits in a VIA register
Send Byte 0 = 37
Byte 1 = register number (0 to 15)
Byte 2 = mask
Returns Nothing
OS Release 2
40 ReadADC
Take a reading from a specific ADC channel
Send Byte 0 = 40
Byte 1 = channel number (1 to 4)
Returns For an 8 bit reading:
Byte 0 = reading from ADC
For a 16 bit reading:
Byte 0 = low byte of reading
Byte 1 = high byte of reading
Comments The value returned will be at the resolution specified by
OS calls HighResADC and LowResADC
41 ReadADCs
Read all the ADC channels
Send Byte 0 = 41
Returns For 8 bit readings:
Byte 0 = reading from channel 1
Byte 1 = reading from channel 2
Byte 2 = reading from channel 3
Byte 3 = reading from channel 4
For 16 bit readings
Byte 0 = reading from channel 1 (low byte)
Byte 1 = reading from channel 1 (high byte)
Byte 2 = reading from channel 2 (low byte)
Byte 3 = reading from channel 2 (high byte)
Byte 4 = reading from channel 3 (low byte)
Byte 5 = reading from channel 3 (high byte)
Byte 6 = reading from channel 4 (low byte)
Byte 7 = reading from channel 4 (high byte)
42 ForcedADCRead
Force the A to D convertor to make a conversion and return
the result
Send Byte 0 = 42
Byte 1 = channel number (1 to 4)
Returns For an 8 bit reading:
Byte 0 = reading from ADC
For a 16 bit reading
Byte 0 = reading from ADC (low byte)
Byte 1 = reading from ADC (high byte)
44 HighResADC
Sets the resolution of ADC readings to 16 bit
Subsequent readings will return 2 byte values
Send Byte 0 = 44
Returns Nothing
Comments For OS 2 readings returned will be only accurate to
10 bits. OS 3,4 provides support for 16 bit readings,
but only to an accuracy of 8 bits.
45 LowResADC
Sets the resolution of ADC readings to 8 bit
Subsequent readings will return single byte values
Send Byte 0 = 45
Returns Nothing
47 ReadResolution
Reads the current ADC resolution setting
Send Byte 0 = 47
Returns Byte 0 = resolution setting, where:
0 = 8 bit
1 = 16 bit
50 DownloadData (OS 2), DownloadData740 (OS 3),
DownloadData375 (OS 4)
Download data into the SmartBox's memory
Send Byte 0 = 50
Byte 1 = start address to write (low byte)
Byte 2 = start address to write (high byte)
Byte 3 = length of data (low byte)
Byte 4 = length of data (high byte)
Bytes 5 - n = data
Returns Nothing
52 UploadData (OS 2), UploadData740 (OS 3),
UploadData (OS 4)
Upload data from the SmartBox's memory
Send Byte 0 = 52
Byte 1 = start address to read (low byte)
Byte 2 = start address to read (high byte)
Byte 3 = length of data (low byte)
Byte 4 = length of data (high byte)
Returns Byte 0 - n = data
54 ExecuteCode (OS 2), ExecuteCode740 (OS 3),
ExecuteCode375 (OS 4)
Execute machine code held at a specified address
Send Byte 0 = 54
Byte 1 = execution address (low byte)
Byte 2 = execution address (high byte)
Byte 3 = contents of the A register on entry to the code
Byte 4 = contents of the X register on entry to the code
Byte 5 = contents of the Y register on entry to the code
Returns Nothing
55 StoreByte (OS 2), StoreByte740 (OS 3),
StoreByte375 (OS 4)
Store a byte in the SmartBox's RAM
Send Byte 0 = 55
Byte 1 = address to write (low byte)
Byte 2 = address to write (high byte)
Byte 3 = byte to be stored
Returns Nothing
56 ReadByte (OS 2), ReadByte740 (OS 3),
ReadByte (OS 4)
Read a byte from the SmartBox's RAM
Send Byte 0 = 56
Byte 1 = address to read (low byte)
Byte 2 = address to read (high byte)
Returns Byte 0 = byte read
57 ReadRAMSize
Read the amount of RAM with which the SmartBox is fitted
Send Byte 0 = 57
Returns Byte 0 = RAM size (low byte)
Byte 1 = RAM size (high byte)
OS Release 2,3
59 ExtendCall
Call the extended call vector
Send Byte 0 = 59
Returns Byte 0 = extension value
Comments This call provides the user with the possibility of adding
extra calls to SmartBox easily
OS Release 2,3
60 SetClock
Set the internal clock in SmartBox. This clock only runs
while the power in maintained
Send Byte 0 = 60
Byte 1 = 1/10 seconds (0 to 9)
Byte 2 = seconds (0 to 59)
Byte 3 = minutes (0 to 59)
Byte 4 = hours (0 to 23)
Returns Nothing
Comments The day value is set to 0
61 ReadClock
Read the internal clock. On reset the clock will be set to
zero
Send Byte 0 = 61
Returns Byte 0 = 1/10 seconds
Byte 1 = seconds
Byte 2 = minutes
Byte 3 = hours
Byte 4 = days
62 ReadTopmem
Read the current value of TOPMEM
Send Byte 0 = 62
Returns Byte 0 = value of TOPMEM (low byte)
Byte 1 = value of TOPMEM (high byte)
OS Release 2,3
63 WriteTopmem
Write the value of TOPMEM
Send Byte 0 = 63
Byte 1 = value of TOPMEM (low byte)
Byte 2 = value of TOPMEM (high byte)
Returns Nothing
OS Release 2,3
64 ReadLomem
Read the current value of LOMEM
Send Byte 0 = 64
Returns Byte 0 = value of LOMEM (low byte)
Byte 1 = value of LOMEM (high byte)
OS Release 2,3
65 WriteLomem
Write the value of LOMEM
Send Byte 0 = 65
Byte 1 = value of LOMEM (low byte)
Byte 2 = value of LOMEM (high byte)
Returns Nothing
OS Release 2,3
66 ReadHimem
Read the current value of HIMEM
Send Byte 0 = 66
Returns Byte 0 = value of HIMEM (low byte)
Byte 1 = value of HIMEM (high byte)
OS Release 2,3
67 WriteHimem
Write the value of HIMEM
Send Byte 0 = 67
Byte 1 = value of HIMEM (low byte)
Byte 2 = value of HIMEM (high byte)
Returns Nothing
OS Release 2,3
70 WritePrinter
Write printer port (no handshaking)
Send Byte 0 = byte to write
Returns Nothing
OS Release 3
71 ReadPrinter
Read printer port
Send Nothing
Returns Byte 0 = printer port value
OS Release 3
72 PrintChar
Send a character to printer port
Send Byte 0 = char
Returns Nothing
OS Release 3
73 PrintStreamZ
Send a stream of characters to the printer port
Send StringNUL = string to print
Returns Nothing
OS Release 3
74 PrintStream
Send a stream of characters to the printer port
Send Byte 0 = number of bytes to send (LSB)
Byte 1 = number of bytes to send (MSB)
Bytes = stream of characters to print
Returns Nothing
OS Release 3
75 PrintServer
Echo all characters to printer port
Notes No exit
OS Release 3
80 WriteRTCReg
Write a RTC register
Send Byte 0 = register
Byte 1 = value
Returns Nothing
OS Release 3
81 ReadRTCReg
Read a RTC register
Send Byte 0 = register
Returns Byte 0 = value
OS Release 3
82 WriteRTC
Writes RTC as a string
Send StringCR = RTC time
Returns Nothing
Notes * Not currently implemented *
Time is represented as DDD,dd mmm yyyy.hh:mm:ss
DDD is 3 character day (Mon, Tue, Wed, Thu, Fri, Sat, Sun)
dd is day of month
mmm is month
yyyy is year
hh is hours
mm is minutes
ss is seconds
OS Release 3
83 ReadRTC
Reads RTC as a string
Send Nothing
Returns StringCR = RTC time
Notes Time is represented as DDD,dd mmm yyyy.hh:mm:ss
DDD is 3 character day (Mon, Tue, Wed, Thu, Fri, Sat, Sun)
dd is day of month
mmm is month
yyyy is year
hh is hours
mm is minutes
ss is seconds
OS Release 3
84 WriteRTCbcd
Writes all 7 RTC time registers
Send Byte 0 = seconds
Byte 1 = minutes
Byte 2 = hours
Byte 3 = date
Byte 4 = month
Byte 5 = day
Byte 6 = year
Returns Nothing
Notes All values are represented in BCD
Years below 80 (&80 in BCD) signify 20xx
Day starts (0) from Monday
OS Release 3
85 ReadRTCbcd
Reads all 7 RTC time registers
Send Nothing
Returns Byte 0 = seconds
Byte 1 = minutes
Byte 2 = hours
Byte 3 = date
Byte 4 = month
Byte 5 = day
Byte 6 = year
Notes All values are represented in BCD
Years below 80 (&80 in BCD) signify 20xx
Day starts (0) from Monday
OS Release 3
90 ReadInputs
Reads a byte from the digital inputs port
Send Byte 0 = 90
Returns Byte 0 = byte read from the digital inputs port
91 ReadBit
Reads a bit from the digital inputs port
Send Byte 0 = 91
Byte 1 = byte to read (0 to 7)
Returns Byte 0 = bit read from the digital inputs port
Comments Reads an individual sensor from the digital inputs port
92 ReadOutputs
Reads a byte from the digital outputs port
Send Byte 0 = 92
Returns Byte 0 = byte read from the digital outputs port
Notes This reads the soft copy of the last written byte
OS Release 3,4
93 CountReset
Resets input port counter(s)
Send Byte 0 = 93
Byte 1 = bit masks for counters to reset
OS Release 4
94 CountRead
Reads input port counter(s)
Send Byte 0 = 94
Byte 1 = counter to read (0 to 7) or 255 for all
Returns Byte 0 = value of counter (LSB)
Byte 1 = value of counter (MSB)
Byte n = value of counter (LSB)
Byte n+1 = value of counter (MSB)
Notes Counter values return 65535 (-1) from box reset, or max count
OS Release 4
98 InsightDriver
Starts the internal Insight software
OS Release 3
99 DataApp
Starts the internal DataApp software
OS Release 3
100 WriteLCDReg
Write LCD Register
Send Byte 0 = register number
Byte 1 = register value
Returns Nothing
OS Release 3
101 ReadLCDReg
Read LCD Register
Send Byte 0 = register number
Returns Byte 0 = register value
OS Release 3
102 LCDChar
Send a character to the LCD display driver
Send Byte 0 = char
Returns Nothing
OS Release 3
103 LCDStreamZ
Send a stream of characters to the LCD display driver
Send StringNUL = string to display
Returns Nothing
OS Release 3
104 LCDStream
Send a stream of characters to the LCD display driver
Send Byte 0 = number of bytes to send (LSB)
Byte 1 = number of bytes to send (MSB)
Bytes = stream of characters to display
Returns Nothing
OS Release 3
110 ReadKeypad
Reads the raw state of the keypad
Send Nothing
Returns Byte 0 = current keypad reading bitstate
OS Release 3
111 ReadKeypadPress
Reads the processed state of the keypad
Send Nothing
Returns Byte 0 = current keypad press bitstate
OS Release 3