proteus light sound mind machine biofeedback



Proteus Segment Format

There are 12 bytes per segment.

The typical segment has the following structure.

Byte 1

SD_Time . Contains the mantissa of the segment time.

Bits 0 and 1 of SD_XtraBits (byte 7 below) contain the exponent.Base 4

Resolution : 0.1, 0.4, 1.6 or 6.4 seconds (depending on exponent)

Range : 0.1 sec. To 27.2 min. (segment times < 0.5s not recommended)

e.g. Segment time = 3m : 20s = 200s = 2000 10th seconds

2000 > 255 so divide by 4 (2000 / 4 = 500) and increment the exponent (=1).

Keep dividing by 4 until quotient < 256.

500 / 4 = 125 . increment the exponent (=2)

125 is less than 256 so SD_Time = 125

SD_XtraBit : set exponent bits to 2 = 102:

x

x

x

x

x

x

1

0

value

7

6

5

4

3

2

1

0

bit number

Byte 2

SD_LFO1_Strt. . Contains the 8 most significant bits (MSbs) of the 9 bit "LFO1 Start" frequency value. The least significant bit (LSb) is placed in bit 2 of SD_XtraBits.

Resolution : 10th Hz

Range : 0.1 to 51.1 Hz

e.g. LFO1 start frequency = 27.5 Hz = 275 10th Hz

275 = 100010011 (binary)

8 MSb's = 10001001 = 137 = SD_LFO1_Strt

The LSb = 1 so .

SD_XtraBits : set bit 2 to 1:

x

x

x

x

x

1

1

0

value

7

6

5

4

3

2

1

0

bit number

Byte 3

SD_LFO1_Fin. . Contains the 8 MSbs of the 9 bit "LFO1 Finish" frequency value. The LSb is placed in bit 3 of SD_XtraBits.

Resolution : 10th Hz

Range : 0.1 to 51.1 Hz

e.g. LFO1 start frequency = 6.2 Hz = 62 10th Hz

62 = 000111110 (binary)

8 MSb's = 00011111 = 31 = SD_LFO1_Fin

The LSb = 0 so .

SD_XtraBits : set bit 2 to 0:

x

x

x

x

0

1

1

0

value

7

6

5

4

3

2

1

0

bit number

Byte 4

SD_LF1_Brite. . Contains the Brightness values for the channel 1 light frames.

Range : 0 to 15 Hz with 0 = off : 15 = full brightness

The 4 MSbs hold the encoded finish value and the 4 LSbs hold the encoded start value.

e.g. LF1 finishing brightness = 15 = 11112 : LF1 starting brightness = 3 = 00112

Shift . LF1 finish value to the 4 Most Significant bits (multiply by 16) = 15*16 =240 = 111100002

Add LF1 starting value (00112)

SD_LF1_Brite = 111100112 = 243

Byte 5

SD_LF2_Brite. . Contains the Brightness values for the channel 2 light frames.

Range : 0 to 15 Hz with 0 = off : 15 = full brightness

The 4 MSbs hold the encoded finish value and the 4 LSbs hold the encoded start value.

e.g. LF2 finishing brightness = 7 = 01112 : LF2 starting brightness = 13 = 11012

Shift . LF1 finish value to the 4 most significant bits (multiply by 16) = 7*16 = 112 = 011100002

Add LF1 starting value (11012)

SD_LF2_Brite = 011111012 = 125

Byte 6

SD_Pitch. . Contains segment sound pitch frequency (start and finish) information Other LSbs are placed in bits 4-7 of SD_XtraBits.

Resolution : 10 Hz

Range : 10 to 630 Hz (values below 40 Hz not recommended)

Encoding example...

Start pitch frequency = 200 Hz : Finish pitch frequency = 250 Hz

To encode SD_Pitch & SD_XtraBits use the following technique.

Divide Start pitch frequency by 10 : 200 / 10 = 20

Convert to a 6 bit binary number = 0101002

Use four MSb's of 6 bit value to encode four LSb's of SD_Pitch byte.

SD_Pitch set to:

x

x

x

x

0

1

0

1

value

7

6

5

4

3

2

1

0

bit number

Use two LSb's to encode bits 4 and 5 of SD_XtraBits

x

x

0

0

0

1

1

0

value

7

6

5

4

3

2

1

0

bit number

Divide Finish pitch frequency by 10 : 250 / 10 = 25

Convert to 6 bit binary number = 0110012

Use four MSb's of the 6 bit number to encode four MSb's of SD_Pitch

SD_Pitch set to

0

1

1

0

0

1

0

1

value

7

6

5

4

3

2

1

0

bit number

Use two LSb's to encode bits 6 and 7 of SD_XtraBits

0

1

0

0

0

1

1

0

value

7

6

5

4

3

2

1

0

bit number

Byte 7

SD_XtraBits. . Set along with above bytes

Byte 8

SD_Ctl1. Contains Segment control bits.

7

6

5

4

3

2

1

0

bit number

Bit assignments:

0) Sound Table Pointer (Lo bit)
1) Sound Table Pointer (Hi bit)

These two bits point to one of four sound tables which will be used when the segment is run.

2) Soft Off Sound . If the bit is set then the system will perform a soft-off of the sound at the end of the current segment. If the sound is already off nothing will be done.
3) Soft On Sound . If the bit is set then the system will perform a soft-on of the sound at the beginning of the current segment. If the sound is already on nothing will be done.
4) Soft Off Lights . If the bit is set then the system will perform a soft-off of the light frames (LFs) at the end of the current segment. If the lights are already off nothing will be done.
5) Soft On Lights . If the bit is set then the system will perform a soft-on of the light frames at the beginning of the current segment. If the lights are already on nothing will be done.
6) Binaural beats active ... If set then the audio pitch in the right channel will be shifted upwards from the left channel by an amount equal to the value of LFO #1. This is intended to be used with a sine wave audio signal but can be used with other waveforms.
7) Last segment of session. If set then the current session will end after this segment has timed out.

Byte 9

SD_Ctl2. Contains more Segment control bits.

7

6

5

4

3

2

1

0

bit number

Bit assignments

0) Light Frames Active . If the bit is cleared then the LFs will be off during the segment.
1) Sound Active . If the bit is cleared then the sound will be off during the segment.
2) Synchronize Channel 1 and 2. Setting this bit will cause LFs and sound modulation do be in phase (This bit has no effect if the "Dual LFOs" bit is set . see SD_Ctl3).
3) Sound modulation active (The amplitude of the internal sound will be modulated in time with the LFO frequency of each channel)
4) Special LF1 segment. if set the current segment will ignore any LFO1 frequency information and use the value set by the Supplemental Command. This allows setting the LFO1 frequency to a very specific value and holding it throughout the segment(s). see Special Segment Encoding below.
5) Special sound segment. if set the current segment will ignore any Pitch frequency info of this segment and use the value set by the Supplemental Command. This allows setting the Pitch to a very specific frequency and holding it throughout the segment(s). see Special Segment Encoding below.
6) No BioFd Ctrl : No Biofeedback control. If set then any ThoughtStream data received will be ignored during this segment. This bit is cleared by default so each segment will be influenced by ThoughtStream data if it is being received.
7) Special LF2 segment. if set the current segment will ignore any LFO2 frequency information and use the value set by the Supplemental Command. Allows setting the LFO2 frequency to a very specific value and holding it throughout the segment(s). see Special Segment Encoding below. If the Dual Light Frame frequencies bit is cleared (bit 0 of SD_Ctl3. see below) then this bit will have no effect and the channel 2 LFs will follow the channel 1 LF rate.

Also note. Code versions prior to 2.0 and code version 2.2 and greater have a operating mode called the monochromatic mode which allows the Proteus to behave like some earlier monochromatic devices. If this feature is active then channel 2 will follow channel 1 and all information regarding channel 2 will be ignored. The monochromatic mode is indicated by a flashing left decimal point on the Proteus unit when it is displaying "Pxx", "Uxx", "Usr" or "PC". The mode has to be toggled manually by pressing the middle and bottom button simultaneously.

Byte 10

SD_Ctl3. Contains a third byte of Segment control bits.

7

6

5

4

3

2

1

0

bit number

Bit assignments

0) Dual Light Frame frequencies .Set this bit for Dual Light Frame frequencies, i.e. Channel 1 and 2 LFOs will run independently. If cleared then both channels run at the value specified by LFO #1.
1) Dual Binaural Beats (BB) . When selected two sets of binaural tones will be generated.

Two tones will be generated in the left ear. The first is the value of the segment PITCH frequency as set with the SD_Pitch and SD_XtraBits bytes above. This is the base frequency for the first binaural beat. The second tone is the base frequency for the second binaural beat and is a multiple of the first frequency (1/2 ; 2/3 ; 3/4 ; 4/3 ; 3/2 and 2/1) as specified by a Supplemental Command segment.

The two audio tones in the right headphone will be shifted upwards from the left channel by an amount equal to the LFO #1 value and LFO #2 value.

Example: audio pitch is set to 200 Hz , LFO #1 is set to 12.0 Hz, , LFO #2 is

set to 8.0 Hz , BB2/BB1 = 1.5. The left ear will hear 200 Hz and 200 * 1.5 =

300 Hz while the right ear will hear 200+12 = 212 Hz and 300 + 8 = 308

Hz.

The base frequency ratio can be set using the menu bar . Utilities, Edit

Supplemental Commands. This value can be dynamically set during a session

by inserting a Supplemental Command segment into a session with the box

labeled "BB2 / BB1" checked. If no Supplemental Command is added to the

session the default Supplemental Command will be used. This value also can

be adjusted using the menu bar . Utilities, Edit Supplemental Commands.

Adjust the BB2 to BB1 ratio, check the "BB2 / BB1" box and check the

"Update defaults setting" box. With the Proteus in "PC" mode click on the

"Send to Proteus" box and the default settings will be updated. Whenever the

Proteus is asked to process dual binaural beats without a Supplemental

Command segment it will look to this default segment for a value. This also

applies if the "Do Spcl LF1" , "Do Spcl LF2" and "Do Spcl Snd" boxes are

check in a session segment.

2) LFO2 finish frequency LSb.
3) LFO2 start frequency LSb.
4) Not used

The following three bits are used to designate the type of segment is being processed.

5) Special segment bit.
6) Special segment bit.
7) Special segment bit.

000x xxxx = Standard session segment

001x xxxx = Biofeedback Control Segment #1 (see below)

010x xxxx = Biofeedback Control Segment #2 (see below)

011x xxxx = Supplemental Command Segment (see below)

Byte 11

x

x

x

x

x

1

x

x

value

7

6

5

4

3

2

1

0

bit number

SD_ LFO2_Strt. . Contains the 8 MSbs of the 9 bit "LFO2 Start" frequency value. The least significant bit (LSb) is placed in bit 2 of SD_Ctl3 (above).

Resolution : 10th Hz

Range : 0.1 to 51.1 Hz

e.g. LFO2 start frequency = 42.0 Hz = 420 10th Hz

420 = 110100100 binary

8 MSb's = 11010010= 210 = SD_LFO2_Strt

The LSB = 0 so . bit 2 of SD_Ctl3 set to 0:

x

x

x

x

x

0

x

x

value

7

6

5

4

3

2

1

0

bit number

Byte 12

SD_ LFO2_ Fin. . Contains the 8 MSbs of the 9 bit "LFO2 Finish" frequency value. The least significant bit (LSb) is placed in bit 3 of SD_Ctl3 (above).

Resolution : 10th Hz

Range : 0.1 to 51.1 Hz

e.g. LFO2 start frequency = 16.5 Hz = 165 10th Hz

165 = 010100101 binary

8 MSb's = 01010010 = 82 = SD_LFO2_Fin

LSB = 1 so . bit 3 of SD_Ctl3 set to 1:

x

x

x

x

1

0

x

x

value

7

6

5

4

3

2

1

0

bit number

Variant Segment formats

There are three variant segment formats which can be used in session files. Two are used with the biofeedback controller and one supplemental command segment.

Biofeedback controller segments.

The controller occupies two segments in the session table.

It is used to set up how the Proteus responds to Thought Stream data.

Note. If the Proteus is running a session and a new segment is read with no Thought Stream data coming in from the indicated sensor then the biofeedback control parameters will be ignored. If a sensor is plugged into the Proteus while a session is running the Proteus will refer to the current biofeedback control segments and alter the running characteristics of the segment. If the "No BioFd Ctrl" flag is set (see above) then the associated segment will ignore all Thought Stream data during that segment.

See the ProtEd 2.2 Session Programming document for more about the editing and use of the biofeedback control segments.

I. Biofeedback controller segment format

Byte 1:

Not used . set to 0

Bytes 2: LFO #1 (Start)

Bytes 3: LFO #1 (Finish)

Bytes 4: Channel #1 Brightness

Bytes 5: Channel #2 Brightness

Bytes 6: Pitch (Start and Finish)

Bytes 7: XtraBits

Programmed in the same manner as a regular session segment.

Bytes 8-9 Not currently used

Byte 10

Set flags so Proteus can process BF Segment #1

0

0

1

x

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

Bytes 11: LFO #2 (Start)

Bytes 12: LFO #2 (Finish)

Programmed in the same manner as a regular session segment.

II. Segment format #2

Byte 1

Not used., set to 0

Bytes two through five are used to designate which control sensors effect which Proteus function.

Thought Stream sensors have the following values.

0) None
1) EDR Channel #1 . data from Thought Stream I is interpreted as EDR #1

The following sensors will be available with the ThoughtStream PC

2) EDR Channel #2
3) Temperature probe Channel #1

4) Temperature probe Channel #2

5) Heartbeat probe Channel #1

6) Heartbeat probe Channel #2

Byte 2

Encodes which Thought Stream sensor controls Pitch and LFO Channel #1

e.g. Pitch is not under biofeedback control (none=0) : LFO #1 is effected by the EDR #1 (=1) biofeedback sensor.

Byte encoding = (Pitch control sensor * 16) + LFO #1 control sensor

= (0 * 16) + 1 = 1

0

0

0

0

0

0

0

1

value

7

6

5

4

3

2

1

0

bit number

Byte 3

Encodes which Thought Stream sensor controls Volume and Channel #1 brightness.

e.g., Volume is under the EDR #1 biofeedback control (=1) : Channel #1 brightness is under the Temp. #1 biofeedback control (=3).

Byte encoding = (Volume control sensor * 16) + Channel #1 brightness control sensor

= (1 * 16) + 3 = 19 = 000100112

0

0

0

1

0

0

1

1

value

7

6

5

4

3

2

1

0

bit number

Byte 4

Future option . Encodes which Thought Stream sensor controls Proteus parameter #7 (future option) and LFO Channel #2

Byte encoding = (Proteus parameter #7 * 16) + LFO #2 control sensor

0

x

x

x

0

x

x

x

value

7

6

5

4

3

2

1

0

bit number

Byte 5

Future option . Encodes which Thought Stream sensor controls Proteus parameter #8 (future option) and Channel #2 brightness

Byte encoding = (Proteus parameter #8 * 16) + Channel #2 brightness control sensor

0

x

x

x

0

x

x

x

value

7

6

5

4

3

2

1

0

bit number

Bytes six through eight

Thought Stream sensor sensitivity settings.

There are 16 sensitivity levels per sensor.

EDR sensors have the following sensitivity ranges:

15 , 20, 26, 35, 46, 61, 80 , 106, 141, 186, 247, 326, 432, 571, 756 and 1000 (%)

These correspond to the to available sensitivity settings of 0 to 15.

Temperature sensors have a sensitivities ranges of:

0.33 , 0.42, 0.52, 0.66, 0.83, 1.0, 1.3 , 1.6, 2.0, 2.6, 3.2, 4.1, 5.1, 6.4, 7.8 and 10 (deg. F)

These correspond to the to available sensitivity settings of 0 to 15.

Byte 6

Encodes sensitivity setting for EDR #1 and EDR #2

e.g., EDR #1 sensitivity setting = 26% (2) : EDR #2 sensitivity setting = 106% (7)

Byte encoding = (EDR #2 setting * 16) + EDR #1 setting

= ( 7 * 16) + 2 = 114

0

1

1

1

0

0

1

0

value

7

6

5

4

3

2

1

0

bit number

Byte 7

Encodes sensitivity setting for Temp #1 and Temp #2

Byte encoding = (Temp #2 setting * 16) + Temp #1 setting

x

x

x

x

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

Byte 8

Byte encoding = (Heartbeat #2 setting * 16) + Heartbeat #1 setting

x

x

x

x

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

Byte 9

= value of Proteus parameter #8 (0- 255) (future option)

Byte 10

Set flags so Proteus can process BF Segment #2

0

1

0

x

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

Byte 11

= value of desired Volume ( 0 - 255) : 0 = off : 255 = maximum volume

Byte 12

= value of Proteus parameter #7 (0- 255) (future option)

The supplemental command segment

The supplemental command segment occupies one segment in the session table.

It is used to set the LFO #1, LFO #2 and Pitch frequencies to more demanding values (LFO's to 0.01 Hz and Pitch to 0.1 Hz).

This control should be used in conjunction with Special LF1 segment ; Special LF2 segment and Special sound segment flags. (see SD_Ctl2 above)

These flags, which must be set on a per segment basis, allow the system to run at the desired frequencies for the duration of the segment. When a flag is set the session data associated with the set flag will not be processed and no ramping of that function is allowed during that segment.

The supplemental command segment can also sets the overall volume and brightness of the unit.

III. Supplemental Command Segment format

Bytes 1 & 2 - Encoded LFO #1 value

Range ( 0.20 to 51.10 Hz)

Byte 1 .

Bit 7 . If this bit is set then LFO #2 function active . If cleared then LFO #2 function inactive

Bits 4-6 . exponent of LFO #1 value.

Bits 0-3 . MSb's of LFO #1 value. (bits 8-11)

Byte 2 .

Bits 0-7 . LSb's of LFO #1 value. (bits 0-7)

Encoding LFO #1 value

The exponent is derived as follows.

exp = 5 - Int ( log 2 (LFO #1 value))

If exp > 7 then exp = 7 (values below 0.25 will cause overflow)

If exp < 0 then value is too high (if you try values >= 64 Hz then under flow occurs)

Encoded exponent value = exp * 16

12 bit value = Int ((LFO #1 value) * 64 * (2 ^ exp) + 0.5)

Encode four most significant bits = Quotient of (12 bit value / 256 )

Encode eight least significant bits = 12 bit value Mod 256

e.g. LFO #1 = 7.83 Hz (active)

function active so set bit 7 of Byte 1

Byte 1

1

x

x

x

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

exp = 5 - Int ( log 2 (7.83))

= 5 - Int ( 2.969 ) = 5 - 2 = 3

Encoded exponent value = exp * 16 = 3 * 16 = 48

Byte 2

1

0

1

1

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

12 bit value = Int ((7.83) * 64 * (2 ^ 3) + 0.5) = 4009

Encode four most significant bits = Quotient of (4009 / 256 ) = 15

Byte 1)

1

0

1

1

1

1

1

1

value

7

6

5

4

3

2

1

0

bit number

Encode eight least significant bits = (4009 Mod 256 ) = 169

Byte 2)

1

0

1

0

1

0

0

1

value

7

6

5

4

3

2

1

0

bit number

Note . Set the Special LF1 segment flag. For each segment that you want the special LFO #1 to run (see SD_Ctl2 above)

Bytes 3 and 4 - Encoded LFO #2 value

Range ( 0.20 to 51.10 Hz)

Byte 3 .

Bit 7 . If set then LFO #2 function active . If cleared then LFO #2 function inactive

Bits 4-6 . exponent of LFO #2 value.

Bits 0-3 . MSb's of LFO #2 value. (bits 8-11)

Byte 4 .

Bits 0-7 . LSb's of LFO #2 value. (bits 0-7)

Encoding LFO #2 value . Use technique used for encoding LFO #1

Note . Set the Special LF2 segment flag. For each segment that you want the special LFO #2 to run (see SD_Ctl2 above)

Bytes 5 & 6 - Encoded Pitch value

Range ( 40.0 to 999.9 Hz)

Byte 5

Bit 7 . If set then Pitch function active . If cleared then Pitch function inactive

Bits 4-6 . exponent of Pitch value.

Bits 0-3 . MSb's of Pitch value. (bits 8-11)

Byte 6 .

Bits 0-7 . LSb's of Pitch value. (bits 0-7)

Encoding Pitch value

The exponent is derived as follows.

exp = 9 - Int ( log 2 (Pitch value))

If exp > 7 then exp = 7 (values below 4 Hz will cause overflow)

If exp < 0 then value is too high (values >= 1024 Hz cause under flow)

Encoded exponent value = exp * 16

12 bit value = Int ((Pitch) * 4 * (2 ^ exp) + 0.5)

Encode four most significant bits = Quotient of (12 bit value / 256 )

Encode eight least significant bits = 12 bit value Mod 256

e.g. Pitch = 272.5 Hz (active)

function active so set bit 7 of Byte 1

Byte 5

1

x

x

x

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

exp = 9 - Int ( log 2 (272.5))

= 9 - Int ( 8.090 ) = 9 - 8 = 1

Encoded exponent value = exp * 16 = 1 * 16 = 16

1

0

0

1

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

12 bit value = Int ((272.5) * 4 * (2 ^ 1) + 0.5) = 2180

Encode four most significant bits = Quotient of (2180/ 256 ) = 8

Byte 5

1

0

1

1

1

0

0

0

value

7

6

5

4

3

2

1

0

bit number

Encode eight least significant bits = (2180 Mod 256 ) = 132

Byte 6

1

0

0

0

0

1

0

0

value

7

6

5

4

3

2

1

0

bit number

Note . Set the Special sound segment. For each segment that you want the special LFO #2 to run (see SD_Ctl2 above)

Byte 7

Value of desired volume .value (0-255) 0 = off : 255 = full volume

Byte 8

Value of desired brightness .value (0-255)

Byte 9

Not currently used

Byte 10

Bits 5-7 used to designate "Supplemental Command Segment"

Bit 0 set if Volume level is to be used by the Proteus unit

Bit 1 set if Brightness level is to be used by the Proteus unit

0

1

1

x

x

x

x

x

value

7

6

5

4

3

2

1

0

bit number

Bytes 11 and 12

Not currently used

Proteus hardware/firmware Notes

Memory Layout.

The Proteus unit uses a preprogrammed MC68HC908GP32 micro controller.

The FLASH memory (32256 bytes) is located in the address location from 800016 to FDFF16. It has been allocated as follows.

******************************************************************

******************************************************************

F60016 - FDFF16 : Core routines.

These are the essential routines necessary for the minimal operation of the Proteus unit. A Block Protection feature within the processor itself prevents this code from being altered.

******************************************************************

DE0016 - F5FF16 : Password Protected OS Code.

In order to program this area of memory a special password must precede the data.

******************************************************************

CE0016 - DDFF16 : Unprotected OS Code.

Initially the Password Protected OS Code area was supposed to contain all the Upgradeable OS code. Unfortunately, the size of the OS code outgrew the block size and due to an oversight (which was programmed into the core routines) it can't be changed. As a result when you upgrade the OS code some of it will have to be accompanied with a password and the rest sent as general data. This general data is not password protected and caution must be used when downloading session data. If the size of the session data is too large the OS code will be overwritten and the unit will become unstable . resulting in a non-standard reset and a prompt for the user to re-download the OS data (a flashing "dL" on the Proteus display).

Version 1.3 of the OS code will not use all of the Unprotected OS Code area, but as more features are added to the Proteus more memory will be needed and the lower limit (CE0016 ) will have to be pushed downward as required. This will cut into the available space for session data.

******************************************************************

Session table area 800016 - start of OS code (CDFF16 for Ver 1.3 to 2.2) . (19968 bytes)

-------------------------------------------------------

800016 - size of preprogrammed session data : Preprogrammed session data.

The Proteus unit comes with 50 installed programs. Version 1.3 of the OS code will allow the user to download "user" sessions while preserving the original 50. It will be possible to overwrite these preprogrammed sessions using another instruction, but doing so will require any "user" sessions to be reloaded as well.

-------------------------------------------------------

End of Preprogrammed session data - CDFF16 : User session data

Version 1.3 of the OS code will require a new segment structure to accommodate dual LF frequencies. The size of each segment will increase from ten to twelve bytes.

*****************************************************************************************

*****************************************************************************************

Programming the Proteus using the serial interface.

The serial port of the Proteus, when in the download mode ( dL ) is set up as follows.

19200 BAUD

No parity bit

8 data bits

1 Stop bit

****************

The flash memory must be erased and programmed in blocks of 128 and 64 bytes respectively. The Proteus unit handles this automatically but the programmer must supply proper address information or the Proteus will ignore it or improperly program 64 bytes with out erasing it first.

*******************************************************************

Generally before starting a programming sequence it is best to send a "Stop Block Transfer" command. This will initialize the Proteus and get it ready to receive new data.

To send a "Stop Block Transfer" command send the following sequence.

Header Value1 (A316 = 16310 )

Header Value2 (8A 16 = 13810 )

Stop Block Transfer Command (13 16 = 1910)

*******************************************************************

*******************************************************************

To program an area in Unprotected FLASH memory (800016 - DDFF16) use the following sequences.

Note. This would be used when upgrading or reprogramming session data or the OS code.

-------------------------------------------------------

1) Send a "Start Block Transfer" command.

Header Value1 (A316 = 16310 )

Header Value2 (8A 16 = 13810 )

Start Block Transfer Command (0 16 = 0 10)

Starting Address High Byte (80 16 = 128 10 ) . example to start programming at memory location (800016)

Starting Address Low Byte (0 16 = 0 10 )

Sum the previous five bytes = (1AD 16 = 42910)

Check Sum High Byte (1 16 = 1 10)

Check Sum Low Byte (AD 16 = 173 10)

* NOTE . The Starting Address must begin on a 128 byte boundary ( xx0016 or xx8016). The Proteus will ignore the command and subsequent data if the low byte of the address is anything but ( 0016 or 8016).

-------------------------------------------------------

2) Send a "Store Block" command .

Header Value1 (A316 = 16310 )

Header Value2 (8A 16 = 13810 )

Store Block Command (1 16 = 1 10)

64 bytes of data

Sum the previous 67 bytes

Check Sum High Byte

Check Sum Low Byte

128 bytes of FLASH will be erased starting at the given address and the first 64 bytes will be programmed with the provided data.

-------------------------------------------------------

3) Continue sending "Store Block" commands with data

Note. Track the number of "Store Block" commands that are sent. The value will be sent at the end of the transfer.

Note. As long as the data is to be stored in contiguous memory locations the Proteus will automatically track the progress thus no additional address information is required beyond that given in the "Start Block Transfer" command. If there is a break in the address of the area to store the data then the current block transfer must be ended (see below) and a new block transfer begun. If the last block sent is less than 64 bytes long it must be padded out to 64 bytes otherwise the Proteus will not recognize the block. Use ( FF 16 = 256 10 ) as pad values.

Note. Timing issues.

While the Proteus is programming the FLASH memory the OS code in the FLASH memory can not be executed. The Programming routine is stored in RAM and run from there. During this time data on the serial line can not be processed and will be ignored. Sufficient time delays must follow each "Store Block" commands so the Proteus unit can erase and program the FLASH memory then resume executing the OS code. At a baud rate of 19200 bit per second it will take about 36 milliseconds to send the 69 bytes in each block. It takes 1.1 milliseconds to erase 128 bytes of memory and 2.2 milliseconds to program 64 bytes of memory. These are ideal values. It is always a good idea to pad the time a bit ( a block rate 50 milliseconds is a good starting value). If the Proteus unit has trouble downloading data then it may be necessary to increase the time even further. Windows based programs are often limited in there ability to accurately time millisecond intervals. It is also difficult to know exactly when the serial data bock was sent so the block rate may have to be a lot slower in order to assure that adequate time is given for each block to be programmed. The Proteus unit will flash a "Bad" display if it detects any errors during the download. Generally a lost block of data won't be detected until the "End Block Transfer" command is given and the number of blocks sent doesn't match the number received.

-------------------------------------------------------

4) After a contiguous series of blocks have been sent a final "End Block Transfer" command must be sent.

Header Value1 (A316 = 16310 )

Header Value2 (8A 16 = 13810 )

End Block Transfer command (5 16 = 5 10)

Number of blocks sent. High Byte

Number of blocks sent. Low Byte

Sum the previous five bytes

Check Sum High Byte

Check Sum Low Byte

*******************************************************************

*******************************************************************

To program an area in Protected FLASH memory (DE0016 - F5FF 16) use the following sequences.

Note. This would be used when upgrading or reprogramming the OS code.

1) Send an "Upgrade Code" command.

Header Value1 (A316 = 16310 )

Header Value2 (8A 16 = 13810 )

Upgrade Code command (0B 16 = 11 10)

Password #1 (EC16 = 23610)

Password #2 (D516 = 21310)

Password #3 (9C 16 = 15610)

Password #4 (BB 16 = 18710)

Sum the previous five bytes = (450 16 = 110410)

Check Sum High Byte (4 16 = 410)

Check Sum Low Byte (50 16 = 8010)

-------------------------------------------------------

2) Send a "Start Block Transfer" command.

see above for details

-------------------------------------------------------

3) Send a "Store Block" commands . as many as are required

see above for details

-------------------------------------------------------

4) Send a "End Block Transfer".

see above for details

*******************************************************************

Session data formatting .

When sending session data to the Proteus certain conventions must be adhered to otherwise the Proteus will be unable to access the data or will run the sessions improperly.

When downloading "Pxx" sessions always start the download at 800016 , sent with a "Start Block Transfer" command.

******************************

Send the following information, in order, in 64 byte blocks (69 bytes total including header information and check sums).

Number of sessions . value = 1 to 99

-----------------------------

Length of session data (Version 1.3) High Byte

Length of session data (Version 1.3) Low Byte

Note. Add the total number of data bytes to be sent and round the value up to the next number divisible by 128.

-----------------------------

Starting Address of Session #1 .High Byte

Starting Address of Session #1 . Low Byte

Starting Address of Session #2 .High Byte

Starting Address of Session #2 . Low Byte

.

.

Starting Address of Last Session .High Byte

Starting Address of Last Session . Low Byte

-----------------------------

Start of Session #1 data

Length of session #1 in seconds .High Byte

Length of session #1 in seconds .Low Byte

Note. This information is used by the Proteus to display the Time Remaining when a session is run.

Segment #1 : data . 12 bytes (see segment formatting document)

Segment #2 : data . 12 bytes

.

.

Last Segment : data . 12 bytes

-----------------------------

Start of Session #2 data

Length of session #2 in seconds .High Byte

Length of session #2 in seconds .Low Byte

Segment #1 : data . 12 bytes (see segment formatting document)

.

.

Last Segment : data . 12 bytes

-----------------------------

-----------------------------

Intermediate Session data

.

.

-----------------------------

Start of Last Session data

Length of last session in seconds .High Byte

Length of last session in seconds . Low Byte

Segment #1 : data . 12 bytes (see segment formatting document)

.

.

Last Segment : data . 12 bytes

*******************************************************************

When downloading "Uxx" sessions you have to calculate the start address by knowing the length of all the sessions and subtracting it from the end of the reserved "Session Table" area (CDFF16 for version 1.3 - 2.2 of the code). In addition you have to start the User session data on a boundary that is divisible by 128 (xx0016 or xx8016).

If the length of the Utility sessions is too long and they attempt to overwrite the Primary Sessions the data will be ignored and the download will be unsuccessful.

Note . The last four bytes in the Session Table are used by the User sessions to encode

1) A check value .the "Length of session data" (see below). This is redundant information but is used to check the validity of the user session table.
2) The Starting address of the session table. This is where the Proteus looks to find the start of User session table. If the calculated user session table comes within 4 bytes of CDFF16 then you have to start the User session table back another 128 bytes.

Note . Future releases the operating code may shrink the Session Table size. It will be necessary to recalculate the User Program information to make it work with subsequent upgrades. Release notes will be given with the upgrade code if this is the case.

******************************

Send the following information, in order, in 64 byte blocks (69 bytes total including header information and check sums).

Number of sessions . value = 1 to 99

-----------------------------

Length of session data High Byte

Length of session data Low Byte

Note. Add the total number of data bytes to be sent and round the value up to the next number divisible by 128.

-----------------------------

Starting Address of Session #1 .High Byte

Starting Address of Session #1 .Low Byte

Starting Address of Session #2 .High Byte

Starting Address of Session #2 . Low Byte

.

.

Starting Address of Last Session .High Byte

Starting Address of Last Session . Low Byte

-----------------------------

Start of Session #1 data

Length of session #1 in seconds .High Byte

Length of session #1 in seconds .Low Byte

Note. This information is used by the Proteus to display the Time Remaining when a session is run

Segment #1 : data . 12 bytes (see segment formatting document)

Segment #2 : data . 12 bytes

.

.

Last Segment : data . 12 bytes

-----------------------------

Start of Session #2 data

Length of session #2 in seconds .High Byte

Length of session #2 in seconds .Low Byte

Segment #1 : data . 12 bytes (see segment formatting document)

.

.

Last Segment : data . 12 bytes

-----------------------------

-----------------------------

Intermediate Session data

.

.

-----------------------------

Start of Last Session data

Length of last session in seconds .High Byte

Length of last session in seconds . Low Byte

Segment #1 : data . 12 bytes (see segment formatting document)

.

.

Last Segment : data . 12 bytes

*******************************************************************

Note. You have to pad out the data to CDFB16 with FF16. The final four bytes are set as follows.

CDFC16 = Length of session data. High Byte (see above)

CDFD16 = Length of session data. Low Byte

CDFE16 = Starting Address of User Session Table .High Byte (sent with Start Block Transfer command)

CDFF16 = Starting Address of User Session Table .Low Byte

Care must be taken not to send too many bytes. Going beyond CDFF16 will overwrite the operating code. The first 1024 bytes are for the four sound tables. If the internal audio signals sound odd after a download the sound tables may have been altered.

*******************************************************************

Sending data to the Proteus unit ( @ 4800 baud).

*******************************************************************

Using the Proteus - PC / Thought Stream interface.

The serial port of the Proteus, when in the download mode ( dL ) is set up as follows.

4800 BAUD

No parity bit

8 data bits

1 Stop bit

******************************************************

In Pxx , Uxx , USr and PC mode the Proteus unit is set at 4800 baud which is compatible with the data rates of the ThoughtStream unit. It is used to input ThoughtStream data , run Real-time viewing of the windows editor and accept other PC commands.

**********************************************

**********************************************

The basic block structure for sending data to the Proteus is to send the following .

Byte 1) Header value #1 = A316 = 16310 ;1st byte of serial data block

Byte 2) Header value #2 = BA16 = 18610 ;if sending 4800 baud data in Pxx , Uxx , USr and PC modes

Byte 3) Data type ;used to designate what type of data is being sent

;below is a list of the currently used data types

3rd byte options ...

Stop Block Transfer =19 ;Used to show end of a block transfer sequence

Stop Session = 20 ;unconditional quick stop of session

View Real time commands

Store data In SSR = 32 ;store next 12 bytes in session segment registers

Store data in User Preference area

= 33 ;stores data to be used by the "Usr" mode

StoreInBioPref1 = 45 ;biofeedback preference segment #1

StoreInBioPref2 = 46 ;biofeedback preference segment #2

Supplemental Cmnd = 47 ;Supplemental commands values to Proteus

Use the following six commands to relay (or simulate) Thought Stream II data

Threm1Data = 35 ;12 bit data from Thermistor #1

EDR1Data = 36 ;12 bit data from EDR #1

HB_1Data = 37 ;16 bit data from Heartbeat sensor #1

Threm2Data = 38 ;12 bit data from Thermistor #2

EDR2Data = 39 ;12 bit data from EDR #2

HB_2Data = 40 ;16 bit data from Heartbeat sensor #2

Update Temporary Supplemental Command Segment

= 42 ;used to update the working Supplemental Command Segment. will not overwrite data in FLASH memory.

Update Temporary Biofeedback Segment

= 43 ;used to update the working Biofeedback Segments. will not overwrite data in FLASH memory.

Run Many Segments = 44 'used to run a number of segments from the PC

StoreInBioPref1 = 45 'used to send default Biofeedback controller (Segment 1) to Proteus. Will overwrite FLASH data

StoreInBioPref2 = 46 'used to send default Biofeedback controller

(Segment 2) to Proteus. Will overwrite FLASH data

Store Supplemental Command value

= 46 'used to send default Supplemental Command

Segment to Proteus. Will overwrite FLASH data

Bytes 4 +) Bytes of data (varies with commands . see below)

Last two bytes) 16 bit checksum of all the above bytes. High bytes first :Low byte last.

**********************************************

**********************************************

Examples.

**********************************************

Sending a "Stop Session" command

It is always a good idea to send a "Stop Session" instruction before you start sending updates and when you want to stop direct control of the Proteus unit. To do this send the following block of data.

Byte 1) Header #1 . value = 163 10 = A3 16

Byte 2) Header #2 and device code . value = 186 10 = BA 16 . device code designates data as coming from a PC.

Byte 3) Destination . value = 20 10 = 14 16 . (tells Proteus what to do with data. Stop Session).

Add the values of the above 3 bytes to get a check sum. In this case = 36910 = 17116

Take check sum and divide by 256.

Byte 4) quotient from above equation. (High byte of checksum) . = 1

Byte 5) remainder from above equation. (Low byte of checksum) . =11310 = 7116

**********************************************

Sending a "EDR1Data" command.

applies to EDR1Data :Threm1Data :EDR2Data : Threm2Data

Byte 1) Header #1 . value = 163 10 = A3 16

Byte 2) Header #2 and device code . value = 186 10 = BA 16 . device code designates data as coming from a PC.

Byte 3) command . value = 35 (EDR1Data)

Byte 4) High 4 bits of EDR1Data (12 bit value)

Byte 5) Low 8 bits of EDR1Data (12 bit value)

Byte 6) High 8 bits of Timer value (16 bit value)

Byte 7) Low 8 bits of Timer value (16 bit value)

Note. Bytes 6 and 7 are generated by the ThoughtStream PC and represent a clock reading taken when a particular sensor is read.

resolution : 1/3000th of a second

range : 333 uS to 21.845 seconds

Add the values of the above 7 bytes to get a check sum.

Take check sum and divide by 256.

Byte 8) quotient from above equation. (High byte of checksum) .

Byte 9) remainder from above equation. (Low byte of checksum) .

*******************************************

******************************************************************

DATA FORMAT FOR THE THOUGHT STREAM PC

******************************************************************

Serial Port Settings.

Baud rate 4800 : No parity : 8 data bits : 1 stop bit

The computer interface is optically isolated so you have to power it (generally with the DTR and RTS lines from the computers serial port, though other means can be used).

Using Visual Basic the following code will set the port up for communication with the Thought Stream unit...

MSComm1.CommPort = PortNum ;Use appropriate port number. (1,2,3 or 4)

MSComm1.Settings = "4800,N,8,1"

MSComm1.InputLen = 1

MSComm1.RThreshold = 1

MSComm1.InputMode = comInputModeText

MSComm1.PortOpen = True

MSComm1.DTREnable = False

MSComm1.RTSEnable = True

Serial data is sent in blocks of 9 bytes (18.75 mSec. Bursts).

These blocks are synchronized with a 50 mSec clock.

Each active EDR and thermistor sensor has a data update rate of five readings per second ( a maximum of 20 readings per second if both EDR sensors and both thermistor sensors are active).

The data rates from the heartbeat sensors is dependent on the heart rate, however the transmitted messages are synchronized with the 50 mSec clock.

******************************************************************

The nine byte block is formatted as follows.

BYTE 1) ... 1st Header Value = $A3 = 163 decimal

BYTE 2) ... 2nd Header Value = $9A = 154 decimal

BYTE 3) ... Data Source Code . one of six values

Channel 1 Thermistor Data = $23 = 35 decimal

Channel 1 EDR Data = $24 = 36 decimal

Channel 1 Heart Beat Data = $25 = 37 decimal

Channel 2 Thermistor Data = $26 = 38 decimal

Channel 2 EDR Data = $27 = 39 decimal

Channel 2 Heart Beat Data = $28 = 40 decimal

BYTE 4 & 5) ... Data from the above sensor

(Byte 4 = High byte : Byte 5 = Low Byte)

For EDR and Thermistor sensors the reading is a 12 bit value.

12 bit value = ( ( Byte 4 * 256) + Byte 5).

Converting the EDR reading to a resistance value is done with the following formula.

R probe ( in kilo Ohms) = ( ( 12 bit value ) * 221 ) / ( 4095 - 12 bit value )

Converting the Thermistor reading to a temperature value is done with the following formula.

Temp probe (in degrees Fahrenheit ) = ( ( 12 bit value ) / 72.26 ) + 74.1

For the Heartbeat sensors the reading is a 16 bit time value representing the time between detected heartbeats. The 16 bit timer in the Thought-Stream PC unit has a resolution of 1 / 3000th of a second .2048 / 6.144 MHz. and a maximum value of 21.845 seconds . ( ( 2 ^ 16 ) - 1 ) / 3000.

The following equation converts the time information to beats per minute.

180,000 / ( ( Byte 4 * 256) + Byte 5).

Note . When the sensor is moved, relative to the finger, the signal may be lost for a few seconds. It is recommended that an averaging scheme be used so the drop outs don't show up as missing heart beats. Also maintaining a 'long term' timer will be needed to determine when the 16 bit TSII timer rolls over (every 21.85 seconds).

BYTE 6 & 7) . 16 bit time signature. This value is set when a sensor sends an update

(Byte 6 = High byte : Byte 7 = Low Byte)

BYTE 8 ) Check Sum Hi Byte . Sum of previous seven bytes

BYTE 9 ) Check Sum Lo Byte

*********************

************************************************************

SERIAL DATA FORMAT FOR THE THOUGHT STREAM I

************************************************************

The ThoughtStream sends a serial block is sent every 0.5 seconds.

The serial block is now nine bytes long (the old block was seven bytes long).

BYTE 1) 1st HEADER VALUE = $AA = 170 decimal

BYTE 2) 2nd HEADER VALUE = $AA = 170 decimal

BYTE 3) DEVICE CODE VALUE = 1

BYTE 4) relaxation value : range 0 to 255. When display is all red then the value equals 255, if display is all green then the value equals 0.

BYTE 5 & 6) current 12 bit ADC value recorded by the thought stream

BYTE 6) BITS 7-4 should be all 0's. bits 3-0 contain the four most significant bits of the 12 bit value.

BYTE 5) contains the eight LSBs.

BYTE 7) Status of the thought stream

Bit allocations...

BIT 0) PROBE ERROR... Set if resistance of the hand probe is open

or shorted. (If not corrected in 10 seconds then TS unit will shut off)

BIT 1) LOW BATTERY... Set if low battery has been detected

(If Start/Stop button is not pushed with in 10 seconds the TS unit will shut off)

BIT 2) NEW DATA. Set if data in current block actually represents a new value from the last. (data is sent at precise times but all the averaging required to get bits 5 & 6 [above] sometimes takes more than 0.5 sec. so this lets any external device know whether the block really represent new data.)

BIT 3) Recalculation has occurred. set if this has happened. (If the current probe resistance happens to go lower than the initial start resistance the TS would generate garbage values. To get around this the TS recalculates everything and starts anew, assuming that the 'new' lower resistance to be the beginning resistance. This wont effect byte 5 & 6 in anyway but bytes 4,8 and 9 will take on new significance.

BIT 4) Not Used

BIT 5,6 & 7) 3 bit code representing which sensitivity is being used

BIT 5 = LSb : BIT 7 = MSb

********* Two new bytes...

BYTE 8 & 9) 12 bit ADC value of the starting probe resistance. this will be

set at the beginning of a session or if the ThoughtStream unit recalibrates during a session.

BYTE 8) bits 7-4 should be all 0's. bits 3-0 contain the four most significant bits of the 12 bit value.

BYTE 9) Contains the eight LSBs.