Re: [buildcheapeeg] comADC-EEG

From: Joerg Hansmann (info_at_jhansmann.de)
Date: 2001-08-08 14:03:22


Hi Rob ,

----- Original Message -----
From: Rob Sacks <editor_at_realization.org>
To: <buildcheapeeg_at_yahoogroups.com>
Sent: Wednesday, August 08, 2001 6:21 AM
Subject: Re: [buildcheapeeg] comADC-EEG

> Hi Joerg,
>
> Congratulations!
>
> For hardware ignoramuses like myself,
> could you explain the advantages over
> the previous RS232 machine?

1)It is cheaper.

2)The digital part only consists of
2 x 555 timer and an optocoupler and some
discrete parts.

3)No AD-Converter and no uC is required.

4)It has less power consumption (only a few mA).

5)it can be expanded up to 4 channels (making a
total of 5 timers (I think there is a 855 chip that
contains 4 x 555 timers) and 4 optocouplers)

...And here the good part ends.

Now the disadvantages:
---------------------------------
It is connected to the com-port (RS232) but does not
use RxD TxD . Instead each 1/256 second data is
transmitted over one of the handshake lines as a
high-signal that lasts from 10usec to 1000usec .

The pulse-lenght contains the sampled analog value
and must be decoded in a high-speed polling loop.

So different CPU and port-IO-speeds result
in different resolution. On my PC
I get slightly above 8 bit. Some PCs get 9 bit
and more.

To evaluate the resolution I have written a little
DOS utilty. (if someone wants to check the possible
resolution of his PC I can mail it)

> Why do you say this isn't Windows friendly?

Timing is very critical and shortly before the loop
(for synchronisation)
and during the loop (for counting)
all tasks and interrupts _must_ be stopped.
That is why I use a 32bit DOS-Program.

(see below the receiver routine in C++)

Regards,

Joerg

---------------------------------------------------------------------------------------
#define MAX_COUNT 1000

int com_adc(int &_sync)
{
int count,sync;
register unsigned in_adr;

count=0;
sync=0;
in_adr=MODEM_STATUS_REGISTER;

// enter_critical();
disable();

// do _not_ use return in this section !!!!
// Always goto end_proc instead !!
// Else the irq s will be disabled forever
// and you can HARD-RESET your PC

while (! (inp (in_adr) & 0x10)){
sync++; // --- sync on L->H transition on CTS
if(sync > (MAX_COUNT*3) ){
count=-2; // no comADC Hardware on port
goto end_proc;
}
}

if(sync){ // --- sync ok
// --- count ADC value to decode pulsewidth from 10us to 1ms
while (inp (in_adr) & 0x10){
count++;
if(count > MAX_COUNT){
count=-2; // no comADC Hardware on port
goto end_proc;
}
}
}else{ // --- no sync
count=-1; // error-code: out of sync
}

end_proc:
enable();
// exit_critical();
_sync=sync;
return count;
}



This archive was generated by hypermail 2.1.4 : 2002-07-27 12:28:31 BST