No announcement yet.

interfacing trigger from RS-232 with E-Prime

  • Filter
  • Time
  • Show
Clear All
new posts

  • interfacing trigger from RS-232 with E-Prime

    Does anybody have any experience detecting the trigger signal from the serial port with e-prime? I'm trying to set up an e-prime program that will loop infinitely until the trigger is detected, however I have yet to get it to work (admittedly also I'm not sure I've got the right port and pin numbers).

    We have the LSC-400B controller box in the lab.

    Thanks in advance.

  • #2
    Assuming that you also have the Lumina response pad, try having E-Prime detect key presses -- this is an easier way to test the setup such as baud rate, COM port number, etc.

    Once E-Prime can detect the buttons, from E-Prime's perspective the trigger is simply the 5th button.


    • #3
      I'm not sure if we have a Lumina response pad. I'll go take a look the next time I get a chance to go to the MRI lab.

      So does this mean it's not possible to simply connect the LSC-400B controller box to the computer via serial port and interface it through e-prime? Also does this mean the controller box actually sends an ASCII message through the serial port or does it just change the voltage in certain pins?


      • #4
        Yes, you can connect the controller directly to a computer via serial port. Using the response pad was just an idea to help you with the testing but it's not required.

        When set to E-Prime mode, the controller sends 800 or 1600 bytes per second, with each byte containing a bit pattern and each bit corresponding to a key. That's how PST implemented it in their Serial Response Box (SRB) and the Lumina controller emulates that. When using the Lumina controller with E-Prime, you should be telling E-Prime that you have a PST SRB Model 200A.

        It is possible to have the Lumina controller send ASCII characters -- just set the mode to ASCII. But in this case, you will need to do some programming in E-Prime to open the serial port and read the incoming bytes.


        • #5
          Okay so it sounds like I will have to change my approach to the problem. Originally the e-prime script looked something like this when we were using the parallel port:

          scan = readport(&H379)
          scan = scan and &H40
          loop while scan <> &H40

          To use the serial port, I thought I could just change the port to &H3F8 then change the pin number (which I have no idea how to find...yet). So it sounds like it isn't as simple as I once thought?


          • #6
            Alas, I don't know E-Prime to be able to help with this question. Is your sample code meant to "talk" to a generic serial device? My understanding is that you can simply tell E-Prime that you are using a PST Serial Response Box Model 200A, set the baud rate and COM port number correctly, and it should work -- no serial port scripting necessary.


            • #7
              Actually I got it to work via the serial port scripting. But you are right. I just found out we had a PST Serial Response Box so I'm going to be testing that out. The problem before with the scripting is that I can't differentiate different signals from buttons for instance. This would allow more flexibility for future experiments I think.

              I was just wondering if there are any e-prime code that can be used to identify the buttons. From what I can tell, the button detection can be set up under the "property pages" menu. I was just wondering if there was any set of code that can be also used for differentiating buttons?



              • #8
                I've never used E-Prime to be able to answer this question. But if you like, try uploading the code to the forums (may be even starting a new thread) and perhaps someone else who is an E-Prime guru can help.