362
edits
Line 11: | Line 11: | ||
There are two ways for this depending whether you only need to send a trigger pulse or whether you also need to set machine parameters, enable/Disable etc. | There are two ways for this depending whether you only need to send a trigger pulse or whether you also need to set machine parameters, enable/Disable etc. | ||
'''Sending a trigger pulse only''' | '''Sending a trigger pulse only:''' | ||
For this you need to have a parallel port. Virtually no laptop these days come with a parallel port. If you must use a laptop, then there are some limited option with parallel port Express Cards. Otherwise desktop computers may have a factory installed parallel port and if not a PCI parallel port card can be easily added. | For this you need to have a parallel port. Virtually no laptop these days come with a parallel port. If you must use a laptop, then there are some limited option with parallel port Express Cards. Otherwise desktop computers may have a factory installed parallel port and if not a PCI parallel port card can be easily added. | ||
You then need to build a cable to connect the parallel port to the TMS machine. Easiest way would be to hack a BNC cable and connect a Male DB25 connector and connect the signal wire of the BNC cable to pin 2 and the shield wire to pin 18 (or any of the pin 18 - 25) | You then need to build a cable to connect the parallel port to the TMS machine. Easiest way would be to hack a BNC cable and connect a Male DB25 connector and connect the signal wire of the BNC cable to pin 2 and the shield wire to pin 18 (or any of the pin 18 - 25). Then connect the DB25 side to the parallel port and the BNC side to the Input Trigger jack on the Magstim. | ||
In E-Prime you need to use WritePort command (Syntax: WritePort PORT_ADDRESS, Value) | |||
WritePort can write to pins 2-9 of the parallel port. Pin order is like this: 9-8-7-6-5-4-3-2 | |||
So 00000001 means send 5 volts down first pin (Pin 2) and so forth. WritePort takes the decimal value of the byte so either calculate it (for example first pin (pin2) on would be 2^0 = 1) or use a table as in http://www.pstnet.com/support/kb.asp?TopicID=1320 | |||
or just use the binary value with the &B prefix e.g. &B00000001 | |||
WritePort also needs the parallel port address. One way To find the parallel port address is to go to: | |||
Control Panel --> Device Manager --> Ports --> LPT1 --> Resources | |||
and get the beginning value of the first I/O range (for example 378 or D010) which is in Hex so need to refer to it as with &H prefix: &HD010 | |||
Lastly the pin needs to be reset after the desired pulse duration has elapsed. One way to do this would be to use Sleep function which take values in milliseconds. | |||
So to send a 10ms TTL pulse you could use this in-line script: | |||
Const PORT_ADDRESS = &HD010 | |||
Const PulseDur = 10 'ms | |||
WritePort PORT_ADDRESS, &B00000001 ' turn on pulse. | |||
Sleep PulseDur | |||
WritePort PORT_ADDRESS, &B00000000 ' turn ff pulse | |||
'''Sending a trigger pulse only:''' | |||
For this you need to have a serial port and possibly an unlock code (that may need to be purchased from Magstim). | |||
edits