Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

problem with sending different trigger to BrainVision Recorder with V-Amp, serial port

Dear community

Hi, I'm Lee, and it's my first time asking a question. Please understand If I'm not good at English.


I'm making simple oddball task for my ERP Experiment.

So I want to send different trigger at different stimuli.

but, BrainVision Recorder was received same trigger. just "S11".


at first, before start the experiment, I wrote the code like below at inline script(run).

import serial
import time

try:
	exp.port= serial.Serial('COM3')
	print 'serial port read', exp.port.name, exp.port.baudrate, exp.port.bytesize, exp.port.parity
except: 
	print 'serial port not read'

and the printed result of first inline script is here.

serial port read COM3 9600 8 N


and after each stimuli, I wrote the code like below.

value = var.triggervalue

t = time.time()
count = 0

try:	
	while (time.time()-t) < 0.005 : #500Hz: >4ms / 250Hz: >8ms
		exp.port.write(str(value)) # or whatever is appropriate
		count += 1
	print('trigger has been sent')
	print('value:',value,'    time:',time.time()-t,'    count:',count)
except:
	print 'trigger not sent'

self.sleep(200)

and the printed result is here. (value 1: prominent / value 2: odd)

trigger has been sent
('value:', 1, '  time:', 0.005000114440917969, '  count:', 58)

trigger has been sent
('value:', 1, '  time:', 0.00599980354309082, '  count:', 32)

trigger has been sent
('value:', 2, '  time:', 0.006000041961669922, '  count:', 36)

trigger has been sent
('value:', 1, '  time:', 0.006000041961669922, '  count:', 34)

trigger has been sent
('value:', 1, '  time:', 0.006000041961669922, '  count:', 67)


last, I end the experiment with this code

exp.port.close()


I expected this inline scripts would sent right trigger, but BrainVision Recorder received only "S11".


Why Recorder read the trigger only "S11", not "S1" nor "S2"? Where is "S11" from?

I read other forums(https://forumcogsci.nl/index.php?p=/discussion/491/solved-sending-different-triggers-via-serial-port etc), but I can't understand why and where I make mistake.

Could you explain what is wrong?


and I have one more question.

I send the trigger with "for" phrase, so I send lots of trigger at one time to handle nyquist  problem.

How can I send the only one and long trigger?


If you could correct my mistake, I would be much appreciated.

Thanks a lot.

Comments

  • Hi Lee,

    I don't know whether this makes sense (I've never worked with Serial ports), but maybe you have unset a trigger before sending a new trigger. So in between exp.port.write(str(1)) amd exp.port.write(str(2)), send exp.port.write(str(0)).

    I send the trigger with "for" phrase, so I send lots of trigger at one time to handle nyquist problem. How can I send the only one and long trigger?

    One way is to send a counter, for example this:

    counter = 0 
    for i in range(100):
        if counter == 30:
            print(i)
        counter += 1
    

    Eduard

    Buy Me A Coffee

  • Thanks for your reply, Eduard.

    Actually, I found what I wrong just before.

    I want to handle nyquist problem, so I send triggers with "while" phrase, (sorry, I have mistake. I wrote wrong word.)

    but, It send wrong trigger.

    with while phrase, I intended to send trigger [1,1,1,1,1,1,1...] -> [S1,S1,S1,S1,S1....]

    but, serial port sent trigger [111111....] -> the max signal -> [S11]

    photo at below is the result of serial port communication(that I sent to BrainVision Recorder).


    Do you know How can I send only one and long trigger?

    To solve Nyquist problem, when sampling rate is 500Hz,

    One Trigger must longer than 4ms.

    How can I make long trigger?


    thanks alot.

  • edited April 2020

    Hi Lee,

    If your experiment allows for it, you can sleep for a little while (e.g. 10 ms ) on every iteration.

    for x in range(100):
        clock.sleep(10)
        print(clock.time())
    

    Does that do the trick?

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games