Smart Box List of Commands

Smart Box List of Commands

Having got a copy of the Economatics Smart Box “Operating System Serial Protocols” document curiosity of John and flaxcottage.com, I noted that one of the commands returns the name of a command based on the provided command number. Given that the instruction manual is most likely for an older version of the Smart Box (mine is an “SB-04”, rather than the older “SB-01”), which is build around a 6502 processor rather than the Mitsubishi microcontroller in mine, I wrote a short program which iterates through every command number between 0 and 99 and returns the “CodeName”. The following table shows the resulting output – I’ve also included room for other Smart Box variants for when I get access to one, or if someone runs the same program for me.

Command No.SB-01SB-01/EVSB-04
0Blank*Blank
1VersionVersion
2ResetReset
3NameCodeNameCode
4CodeNameCodeName
5MultipleSetupMultipleSetup
6MultipleReadMultipleRead
7MultipleServerMultipleServer
8IdentSystem
9CreditsCredits
10WriteMotorsWriteMotors
11ReadMotorsReadMotors
12MotorForwardMotorForward
13MotorReverseMotorReverse
14MotorHaltMotorHalt
15MotorPowerMotorPower
16PatchMF*PatchMF
17MotorVoltage
20WriteOutputsWriteOutputs
21OutputPowerOutputPower
22GetSensors*GetSensors
23CheckSensors*CheckSensors
25ReadSensorTable
28SetBitHighSetBitHigh
29SetBitLowSetBitLow
30ReadADCReg*
31WriteADCReg*
32ReadACIAReg*
33WriteACIAReg*
34ReadVIAReg*
35WriteVIAReg*
36SetVIAHigh*
37SetVIALow*
40ReadADCReadADC
41ReadADCsReadADCs
42ForcedADCReadForcedADCRead
44HighResADCHighResADC
45LowResADCLowResADC
47ReadResolutionReadResolution
50DownloadDataDownloadData375
52UploadDataUploadData375
54ExecuteCodeExecuteCode375
55StoreByteStoreByte375
56ReadByteReadByte375
57ReadRAMSize
59ExtendCall
60SetClockSetClock
61ReadClockReadClock
62ReadTopmem
63WriteTopmem
64ReadLomem
65WriteLomem
66ReadHimem
67WriteHimem
90ReadInputsReadInputs
91ReadBitReadBit
92ReadOutputs
93CountReset
94CountRead

Items marked with a * in the SB-01 column are undocumented. The SB-01 commands were taken from a machine belonging to mph1708 on the stardot.org.uk forums. The machine was running ROM OS 2.073 dated 12/07/96.

The program I used is as follows – don’t forget to change the serial port from “/dev/ttyUSB0” to whatever is applicable on your setup :

#!/usr/bin/python
import time
import serial

ser = None

def getCommandName(cmd):
        global ser
        if ser.is_open:
                ser.write(chr(4)+chr(cmd))
                time.sleep(0.2)
                readText = ""
                while ser.inWaiting() > 0:
                        readText += ser.read(1)
        return readText

ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)

x=0
while x<100:
	theText = getCommandName(x)
	if len(theText)>1:
		print str(x)+" : "+theText
	x+=1

ser.close()

Please let me know if you have any interesting results via my contact page.

Things to note looking at the results, compared to the available documentation…

  • Command 0 (Blank) is undocumented
  • Command 8 (IdentSystem) is undocumented
  • Command 9 is called “Credits” instead of “Copyright”
  • The documentation contains both “MotorHalt” and “MotorPower” (an typo?) as Command 14. The SB-04 box reports Command 14 as “MotorHalt” and Command 15 as “MotorPower”
  • Command 16 (PatchMF) is undocumented
  • Command 17 (MotorVoltage) is undocumented – this is not a surprise as some older Smart Boxes used a key to change voltages, whereas it seems that this is a software feature on the SB-04
  • Command 22 (GetSensors) is undocumented. I assume this reports what sensor types are connected?
  • Command 23 (CheckSensors) is undocumented
  • Command 25 (ReadSensorTable) is undocumented
  • The documentation contains both “SetBitHigh” and “SetBitLow” (an typo?) as Command 28. The SB-04 box reports Command 28 as “SetBitHigh” and Command 29 as “SetBitLow”
  • Command 43 is not present on the SB-04. This is “ReadSensor” and may have been replaced by Command 22, 23, and 25
  • Commands 50, 52, 54, 55 and 56, all of which relate to accessing the Smart Box memory and executing the contents of the memory, have been renamed with “375” on the end. I believe this refers to the microcontroller type? I am surprised to see they are still implemented at all.
  • Commands 51 and 53 have been omitted. These commands related to transferring data to and from the Smart Box using an Xmodem transfer format (with and without error checking)
  • Command 57 has been omitted (ReadRAMSize)
  • Command 58 has been omitted (ReadModule). This command seems to be for identifying some kind of hardware additions fitted to the equipment when the Smart Box was used embedded within a machine or similar.
  • Command 59 has been omitted (ExtendCall) this seems to be a method by which additional commands could be added and it seems unfortunate that it has been excluded. Reference is made to “Appendix B, machine code programming”. Unfortunately I don’t appear to have a copy of this appendix.
  • Command 62 is omitted (ReadTopMem)
  • Command 63 is omitted (WriteTopMem)
  • 64, 65, 66 and 67 (“ReadLoMem”, “WriteLowMem”, “ReadHiMem” and “WriteHiMem” respectively) are all omitted
  • Command 93 (CountReset) is undocumented. I guess this is a hardware counter, but don’t currently know what input it is connected to.
  • Command 94 (CountRead) is undocumented. I guess this is a hardware counter, but don’t currently know what input it is connected to.

I’d be very interested to run the same program on an older Smart Box to see if there are any undocumented commands there. A fair few commands appear to have been removed for the SB-04, many of which were likely difficult or impossible to implement on the microcontroller as opposed to the full 6502 embedded computer that existed before.