Important info first !
You _MUST_ have a 28c256 eeprom and a 61256 sram installed on the mainboard.
If not, the box will fail to come up.
Also, on the very first startup, the eeprom gets initialized with a default-setup.
This takes some seconds, so be patient the first time.
However, if after 10 to 20 seconds the box wont come up, something must be wrong
with either the eeprom or the sram.....
Current functions of the firmware
- readout of up to 88 adc inputs
- output of up to 64 dac channels
- readout of up to 64 digital pins, like for buttons etc...
- output of up to 64 digital pins, like for led's etc...
The readout of the adc's can be pre-processed on a per-channel basis if wanted.
Processing includes, in that order :
- disable/enable the channel
- crop off a floor value
- limit to a maximum value
- shift left of the bits representing the readout
- shift right of the bits
- stabilize readout
- scale the readout
- send the readout to the host
Each step works on the result of the previous step.
The floor value specifies the minimum input representing 0
Everything below will be cropped to 0
After that, the readout gets hard-limited to the ceil value.
"stabilizing" of the readout means the following:
If the actual readout differs from the last one by at least a specified
threshold, it gets sent to the host (or saved, if auto-send isnt enabled)
After that change, but inbetween a specified number of samples, every change gets updated,
even the slightest one. However, after the channels was sampled that often, the difference
must again reach the threshold to update it again.
The protocol
The following is for non-hid mode, for example when accessing it with libusb.
this mode is activated by requesting the device to use configuration #2 on the
usb side. THIS IS DONE BY A USB COMMAND and has _nothing_ to do with the box-setups
for the box's functions itself.
if you want to know how to access in hid-mode, just request that info from
your hid-driver once the box is connected. thats what hid report's are for ...
The box either sends or receives packets of one of the following structures :
(be sure to send as much bytes as you need to)
typedef struct button_readout {
char report_id;
char buttonbits;
};
report_id specifies the group-number
range is 1 to 8
buttonbits contains the status of all buttons in the group
typedef struct led_output {
char report_id;
char ledbits;
};
report_id specifies the group-number
range is 1 to 8
ledbits contains the status of all led outputs in the group
typedef struct adc_readout {
char report_id;
int16 value;
};
report_id specifies the channel-number+9
range is 9 to 96
value is the readout as 16 bit integer
typedef struct dac_output {
char report_id;
int16 value;
};
report_id specifies the channel-number+97
range is 97 to 160
value is the level to set the dac to as 16 bit integer
only the lowest 12 bits are used by the dac
typedef struct system_command {
char report_id;
char command;
char bvalue;
int16 value;
};
alternatively, for commands sending/requiring only a byte as a value :
typedef struct system_command {
char report_id;
char command;
char bvalue;
char smallvalue;
};
report_id is always 161 for this kind of messages
every 161 set-report gets echoed back to the host
every get-report echoes back the request plus the value filled in
command can currently be one of the following:
00 : load setup specified in bvalue (0..3) from eeprom to sram
-- NOTE -- If you select a configuration to load, but there wasnt any one saved at
-- that position, it gets initialized with default values first. That takes some seconds,
-- so be patient ...
01 : save setup from sram to location in eeprom specified in bvalue (0..3)
02 : set the floor value of the adc channel (0..87) specified in bvalue to value
03 : set the ceil value of the adc channel (0..87) specified in bvalue to value
04 : set the scale value of the adc channel (0..87) specified in bvalue to value
-- NOTE -- This value is given as integer, and divided in the firmware by 10.000
-- so, a value of 10.000 means a factor of 1, 1.000 means 0,1 and so on ....
--- the readout is multiplied by that factor then.
05 : set the stabilize threshold of the adc channel (0..87) specified in bvalue to smallvalue
06 : set the stabilize timeout of the adc channel (0..87) specified in bvalue to smallvalue
07 : set the number of shifts for the adc channel (0..87) specified in bvalue to smallvalue
-- NOTE -- : the lower four bits are the right-shift amount, the upper ones for left-shift
08 : set the config byte of the adc channel (0..87) specified in bvalue to smallvalue
-- NOTE -- : the bits enable/disable :
-- bit 0 : processing of the channel
-- bit 1 : floor cropping
-- bit 2 : maximum-limit
-- bit 3 : left-shift
-- bit 4 : right-shift
-- bit 5 : scaling
-- bit 6 : stabilizing
-- bit 7 : auto-send to host on change
09 : get the current value of the adc channel (0..87) specified in bvalue
10 : get the floor value of the adc channel (0..87) specified in bvalue
11 : get the ceil value of the adc channel (0..87) specified in bvalue
12 : get the scale value of the adc channel (0..87) specified in bvalue
-- NOTE -- See command 04 for what the scale value means
13 : get the stabilize threshold of the adc channel (0..87) specified in bvalue
14 : get the stabilize timeout of the adc channel (0..87) specified in bvalue
15 : get the shift value of the adc channel (0..87) specified in bvalue
16 : get the config byte of the adc channel (0..87) specified in bvalue
17 : enable/disable digital input groups as defined in bvalue (bitmask, bit0 = first group, bit1 = second group, ...)