# PCIe parallel port address

**URL:** <https://psychtoolbox.discourse.group/t/pcie-parallel-port-address/552>\
**Category:** Uncategorized\
**Created:** [September 18, 2010, 2:13pm UTC](https://psychtoolbox.discourse.group/t/pcie-parallel-port-address/552 "2010-09-18T14:13:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [September 18, 2010, 2:13pm UTC](https://psychtoolbox.discourse.group/t/pcie-parallel-port-address/552/1 "2010-09-18T14:13:33Z")

</div>

Hello,  
Each time I log in to my laptop - the address of the parallel port changes (e.g. 0x7030, 0x7CE6 etc.), so I`m looking for a way to read it automatically. I`m using a PCI express card (ST-lab), and from reading the manual - I understood that Matlab doesn`t handle these cards properly.  
  
  
Any advice would be much appreciated!  
Ido

---

<div class="post-metadata">

**Author:** ![e\_flister](https://avatars.discourse-cdn.com/v4/letter/e/e36b37/32.png) [@e\_flister](https://psychtoolbox.discourse.group/u/e_flister)\
**Post date:** [September 18, 2010, 10:23pm UTC](https://psychtoolbox.discourse.group/t/pcie-parallel-port-address/552/2 "2010-09-18T22:23:04Z")

</div>

i tried for a while to figure out how to do this and gave up. it's infuriating since windows must know the address since it's assigned an LPT number. :( summary of what i found is at   
[http://psychtoolbox.org/wikka.php?wakka=FaqTTLTrigger](http://psychtoolbox.org/wikka.php?wakka=FaqTTLTrigger)  
  
in short:  
  
matlab's data acquisition toolbox uses winio ([http://www.internals.com/utilities\_main.htm)](http://www.internals.com/utilities_main.htm)), but can only get addresses for built-in ports. perhaps their winio code could read the address if we knew where in the protected memory it was stored...  
  
to get the first built-in parallel port address with winio:  
bresult = GetPhysLong((PBYTE)0x0408, &port);  
  
the DOS debug command can also read protected memory ([http://www.doc.ic.ac.uk/~ih/doc/par/doc/findd.html)](http://www.doc.ic.ac.uk/~ih/doc/par/doc/findd.html))  
  
but I can't figure out how to use an interactive DOS program from inside matlab (for instance using the "dos," "system", or "!" commands - any ideas?)  
  
hwinterface32 ([http://logix4u.net/Legacy\_Ports/Parallel\_Port/How\_to\_read\_Parallel\_Serial\_Port\_address\_from\_BIOS.html)](http://logix4u.net/Legacy_Ports/Parallel_Port/How_to_read_Parallel_Serial_Port_address_from_BIOS.html)) can also read the memory if we knew where it was.  
  
i'd love to find out how to do this -- anyone have ideas?  
  
-e  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "idodavid93" \<idodavid93@...\> wrote:  
> \>  
> \> Hello,  
> \> Each time I log in to my laptop - the address of the parallel port changes (e.g. 0x7030, 0x7CE6 etc.), so I`m looking for a way to read it automatically. I`m using a PCI express card (ST-lab), and from reading the manual - I understood that Matlab doesn`t handle these cards properly.  
> \>   
> \>   
> \> Any advice would be much appreciated!  
> \> Ido  
> \>

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [September 19, 2010, 10:25pm UTC](https://psychtoolbox.discourse.group/t/pcie-parallel-port-address/552/3 "2010-09-19T22:25:55Z")

</div>

The correct way would be to use WMI ("Windows management instrumentation service"):  
  
Overview:  
\<[http://msdn.microsoft.com/en-us/library/aa394582(](http://msdn.microsoft.com/en-us/library/aa394582()v=VS.85).aspx\>  
  
Example C++ application for WMI access:  
\<[http://msdn.microsoft.com/en-us/library/aa390418(](http://msdn.microsoft.com/en-us/library/aa390418()v=VS.85).aspx\>  
  
What StackOverflow (always a good address for programming questions) has to say about enumerating LPT: ports aka parallel ports via WMI:  
  
\<[http://stackoverflow.com/questions/3325560/how-to-enumerate-windows-lpt-ports-and-their-i-o-range](http://stackoverflow.com/questions/3325560/how-to-enumerate-windows-lpt-ports-and-their-i-o-range)\>  
  
None of this is fun or beautiful (it's MS-Windows after all), but should get you started.  
  
best,  
-mario  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "e\_flister" \<e\_flister@...\> wrote:  
> \>  
> \> i tried for a while to figure out how to do this and gave up. it's infuriating since windows must know the address since it's assigned an LPT number. :( summary of what i found is at   
> \> [http://psychtoolbox.org/wikka.php?wakka=FaqTTLTrigger](http://psychtoolbox.org/wikka.php?wakka=FaqTTLTrigger)  
> \>   
> \> in short:  
> \>   
> \> matlab's data acquisition toolbox uses winio ([http://www.internals.com/utilities\_main.htm)](http://www.internals.com/utilities_main.htm)), but can only get addresses for built-in ports. perhaps their winio code could read the address if we knew where in the protected memory it was stored...  
> \>   
> \> to get the first built-in parallel port address with winio:  
> \> bresult = GetPhysLong((PBYTE)0x0408, &port);  
> \>   
> \> the DOS debug command can also read protected memory ([http://www.doc.ic.ac.uk/~ih/doc/par/doc/findd.html)](http://www.doc.ic.ac.uk/~ih/doc/par/doc/findd.html))  
> \>   
> \> but I can't figure out how to use an interactive DOS program from inside matlab (for instance using the "dos," "system", or "!" commands - any ideas?)  
> \>   
> \> hwinterface32 ([http://logix4u.net/Legacy\_Ports/Parallel\_Port/How\_to\_read\_Parallel\_Serial\_Port\_address\_from\_BIOS.html)](http://logix4u.net/Legacy_Ports/Parallel_Port/How_to_read_Parallel_Serial_Port_address_from_BIOS.html)) can also read the memory if we knew where it was.  
> \>   
> \> i'd love to find out how to do this -- anyone have ideas?  
> \>   
> \> -e  
> \>   
> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "idodavid93" \<idodavid93@\> wrote:  
> \> \>  
> \> \> Hello,  
> \> \> Each time I log in to my laptop - the address of the parallel port changes (e.g. 0x7030, 0x7CE6 etc.), so I`m looking for a way to read it automatically. I`m using a PCI express card (ST-lab), and from reading the manual - I understood that Matlab doesn`t handle these cards properly.  
> \> \>   
> \> \>   
> \> \> Any advice would be much appreciated!  
> \> \> Ido  
> \> \>  
> \>
