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 and receiving triggers

edited May 2017 in OpenSesame


I have a problem with sending (to EEG) and receiving (from a button box) triggers. In the past I have been able to do this without problems, but I recently switched to a new lab and it seems I cannot get it to work here.

For example, to sent EEG triggers I am using the following code:

### initiate EEG trigger ###

    from ctypes import windll
    global io
    io = windll.dlportio # requires dlportio.dll !!!
    print 'The parallel port couldn\'t be opened’

And then later in my inline script:

Global io
trigger = 10
port_eeg = 41152
    io.DlPortWritePortUchar(port_eeg, 1)    
    io.DlPortWritePortUchar(port_eeg, 0)
    print ‘Failed to send trigger’

However, this doesn't work as I get the message Failed to send trigger.
To obtain the portcode I have used the device manager and changed the heximal port code (A0C0) to decimal code (41152), as I previously also used decimal codes.

Does anyone have any tips what I might be doing wrong here and how I can fix it.

Cheers and thanks in advance,



  • Hi Dirk

    The issue could be the port address, a possible reason is when the dll was written the address was meant an signed integer (32bit), so you may want to convert it. I think it should be -8384.

    Or try use the dll here

    Good luck


  • Hey Gary,

    Thanks for your quick reply. Not sure what you mean with -8384. When I follow the instructions on the stack overflow link 41152 stays 41152? Am I missing something here?



  • Whoops you are right, should have tried it before I posted.

    The difference between signed and unsigned is that in binary the left hand digit indicates its sign, 0 is positive, 1 is negative and for unsigned it is a value. Plus I also forgot that the number is twos complement.

    And have just noticed it uint32 and int32 change these to uint16 and int16

    Two method shown below
    `import ctypes

    def uint16_to_int16(i):
    return ctypes.c_int16(i).value

    print uint16_to_int16(41152)
    import numpy
    print numpy.int16( numpy.uint16(41152) )`

    The number is -24384

    Hope this helps


  • Thanks, I used an online calculator and ended up with the same number. Unfortunately that did not do the trick.

    Any other suggestions?

    Btw others here are using Matlab and Presentation software to send triggers and works fine :(

  • Hi

    Have you tried the dll on the other link?


  • No I did not do that yet. I was a bit hesitant to download new software on a computer that others are successfully using for EEG. Could that be a potential problem?

  • No, just another dll, it can be placed in any folder on the PC as long as you use the loadlibrary with the path plus it doesn't net to be registered . I use it for all experiments that require event marking.

    It didnt work on one PC, but didn't have time to work out why, so had to create a USB device to do the job.

  • Yes, thank you very much Gary. That second link did the trick. You saved me a lot of frustration!!

  • Created the modified dll due to my frustration, glad it saved you from some :)

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 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