Hello,
Just purchased a StimTracker and using the interface to neuroscan EEG (http://www.cedrus.com/support/stimtracker/tn1469_neuroscan.htm). So seems like I should have 8 event marker/trigger bits with which to send events from Matlab.So using serial.m in Matlab my commands are:
s1 = serial(’/dev/cu.usbserial-AH01NEJ7’, ‘BaudRate’, 115200,‘DataBits’, 8, ‘StopBits’, 1, ‘FlowControl’, ‘none’, ‘Parity’, ‘none’, ‘Terminator’,‘CR’, ‘Timeout’, 400, ‘InputBufferSize’, 16000);
fopen(s1)
But now I get a little confused. Say I want to send a 10ms pulse, so first thing I need to do is set the pulse duration. According to the cedrus documentation (http://www.cedrus.com/support/stimtracker/tn1450_st_commands.htm) to set the time I need to use a “four byte binary value indicating the number in milliseconds” forming a “32-bit unsigned integer”. So if I use matlab’s decimal-to-binary converter for 10 I get:
dec2bin(10)
ans =
1010
But this is not a four byte binary value. To make this four bytes then I guess I need to add a bunch of 0’s. Also from what I read, bits are read from right to left so the 0’s should be placed on the left of 1010. So then to set the pulse duration to 10ms I would execute the command:
fprintf(s1,[‘mp’,00000000000000000000000000001010]);
Then say I want to have this 10ms pulse on channel 3 (out of the 8 possible event channels available to me). The documentation states “mh followed by two ‘bit mask’ bytes (a binary value). In the first byte, each bit corresponds to an output line. The second byte is currently ignored”. So if I understand things correctly in the first byte each bit represents the state of each channel - so to have all 8 channels off would be:
00000000
Then to turn on channel 3 (and remembering bits are read right to left) would be:
00000100
and then taking this and adding a second bit mask byte that is ignored, so will just make it all zeros:
00000000
means the Matlab command should ultimately look like this (since read right to left, the ignored byte is supposed to be second, so will add it to the left):
fprintf(s1,[‘mh’,0000000000000100]
Is my understanding of this correct? If not, could someone else explicitly give their fprint() statements for 1) setting a pulse duration for some time (like 10ms), and 2) sending an event to one of the channels? It would be extremely helpful! (and ultimately I want to use IOPort.m commands since they apparently are more precise, but to begin with I figure I should understand serial.m commands)
Thanks so much!
David