Parallel port reading


Author
Message
Jimmy
Jimmy
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 7, Visits: 1

Hello all,


I am trying to read a signal from a parallel port, actually from a device with some buttons.


First of all I tried to look for the validresponses and the correcrtresponses through the Parallel Port Monitor. I have connected the wires on pins 2,3 and 4....however the Parallel Port Monitor shows an 'incoming' activity on the Status ports, pins 10, 12,13, 15 and a value of 127....sometimes I gives me a value of 255 on the first 8 pins as well (Data ports).....however I have plugged only 3 wires on these pins....



These values are given either I press a button of my device, several buttons or nothing.



I have tried to use the following code, just to see how to get the responses....



<trial>


/ inputdevice = lpt1 (I have confirmed that this is the correct port)


/ validresponse = (127, 0)......or instead of 127, I put 255


/ correctresponse = (127).....or instead of 127, I put 255


/ response = timeout(3000)


</ trial>



However, I get the blank screen and then I have a created file but without information about the parallel port response...



Any clues? I am new to Inquisit and I have to use it urgently, so it is likely I miss something, cause I read pretty fast the tutorials....



Thanks


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

I would make a little test script with a <trial> set up like this


<trial checkportsignal>
/ stimulusframes = [1=button]
/ inputdevice = lpt1
/ validresponse = (anyresponse)
</trial>

<text button>
/ items = ("Press the 1st button.", "Press the 2nd button.", "Press the 3rd button.")
/ select = (sequence)
</text>

<block myblock>
/ trials = [1-3=checkportsignal]
</block>


After running the script and pressing the appropriate buttons, look at the generated data file. The 'response' column should contain the codes you're looking for.


Let me know if that helps,


~Dave


Jimmy
Jimmy
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 7, Visits: 1

I am using Inquisit 3.0.5.0 and I have also used the command /port = lpt1, instead of /inputdevice = lpt1.


When the Parallel Port Monitor gives me activity on both Status and Data ports, and I try to run the above code, I get an error of "A port stimulus item does not contain 8 bits".


Cheers


Jimmy
Jimmy
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 7, Visits: 1

Hi Dave,


Thanks for your immediate reply!


I've tried what you suggested. I added a /response=timeout(2000) after the 'valideresponse' command. I got again blank screen but anyway, the file that is now created has no information about 'response', 'correct' and some other columns.


The only weird thing is that there is a value on the 'trialduration' of '-1'....could it be so?



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

Sorry, didn't notice your reply yesterday. I'm not sure what might be going on here. A reported trialduration of -1 sure doesn't sound right, though. Have you run a few DirectX Diagnostics on the machine (Tools -> DirectX Diagnostics...). Updating both the graphics card drivers as well as DirectX might also be worth a shot. Also, have tried to run the script on a different PC? Are you experiencing the same issue(s) there?


Best wishes from a fellow Inquisit user,


~Dave


Jimmy
Jimmy
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 7, Visits: 1

Hi Dave,


I run the DirectX diagnostics. No problem at all, altough I didn't see anywhere a tab about the parallel port (lpt1). I don't know if I should have seen something about this running this particular tool however.


Also, I cannot run the script in another PC here, so unfortunately I cannot test this.


It could be a problem of the PC or of the device though, cause I tried to read the signal through Matlab as well, but I got weird outputs too.


If you have any other idea in the near future, please let me know, but anyway thanks for your interest, your ideas and your help.


J.


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

I run the DirectX diagnostics. No problem at all, altough I didn't see anywhere a tab about the parallel port (lpt1). I don't know if I should have seen something about this running this particular tool however.


Correct, you shouldn't have seen anything related to the LPT port there. The reason I referred you to DirectX Diagnostics is the odd trialduration (-1) you reported. This sometimes happens when either DirectX, the graphics card drivers or both aren't working / interacting properly. However, this doesn't seem to be the case here.


Also, I cannot run the script in another PC here, so unfortunately I cannot test this.


Why not? Even if you don't have a license, Inquisit will be fully functional for a 30-day trial period. So you should be able to just install it on any machine that has a parallel port and check whether the problem's you're seeing also occur there.


If you have any other idea in the near future, please let me know


Will do.


Best wishes from a fellow Inquisit user,


~Dave


Jimmy
Jimmy
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 7, Visits: 1

Hi Dave and all of you other guys.


I have now fixed the whole thing. We have connected the wires on the pins (2, 3, 4) which were recognized by Matlab, whereas Inquisit reads from the Status pins (10, 11, 12, 13, 15). So, we reconnected the wires and now the buttons work fine when I check them through the Parallel Port Monitor.


Now, the thing is that when I press a button and I get a response (for instance a value of 31), Inquisit 'remembers' this value even if I go to the next trial. So, its memory says 31, although I press another button and I am expected to get 79 for instance. After a random time, it goes back to the normal value and then gives the proper one according to the button pressed. But still, it remembers it for a while.


I haven't found a way to clear the memory or the buffer. Is there any way to do so? Or, is the problem because of something else than my clue?


All the best,


J.


seandr
seandr
Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)
Group: Administrators
Posts: 1.3K, Visits: 5.6K

Hi J,


Inquisit doesn't remember the signal, it simply reports the current state of the parallel port (i.e.,whether each pin is in a high or low voltage state). Given the way TTL signals on the parallel port work, once a signal is sent to the port, the pins remain in the signal state until another signal is sent.


So, to clear a given signal from the port, your button device must follow up the button-press signal with the baseline signal.


-Sean



Jimmy
Jimmy
Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)Esteemed Member (1.8K reputation)
Group: Forum Members
Posts: 7, Visits: 1

Hi Sean and thanks for your reply.


It clears a bit my mind. But I still have a question, that perhaps cannot be answered.




So, to clear a given signal from the port, your button device must follow up the button-press signal with the baseline signal.




According the above solution, I am wondering how I could send through my device a baseline signal, as the baseline signal is present only when no button is pressed. I mean, when I switch on the device there is the baseline signal and when I press the button the signal changes and, according to your explanation, it remains in a specific state until a new signal comes.


As I cannot send a baseline signal, the only way that it may work is to send a signal from another button (which is fine for my project). But, as I wrote before, I cannot send another signal from another button neither straight after the previous button press, nor after some (random) seconds waiting. I have to wait a bit for Inquisit being able to read another signal.


I don't know if I missed something from what you explained, or if I messed them up more :)


But thanks again!


Jimmy


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search