sending com port command
Paul Groot
pfc.groot at gmail.com
Mon Feb 20 20:47:47 UTC 2012
Hi Erin,
Although, in theory, it would be possible to use the WritePort command
to send bytes to a classical serial (non-USB) RS232 port, it is
definitely not the way to go. Instead you should use a SerialDevice
object to communicate with a COM port. The easiest way is to add such
a Serial device in the following dialog:
E-Studio>Menu>Edit>Experiment>Devices>Add Serial. The default setting
should be OK (9600bps, 8bit, no parity, 1 stopbit). When you add this
device, EPrime will add a global SerialDevice object variable to your
script. The name of this variable will be 'Serial' if there is only
one serial device.
The next thing you should do is to add a single line of inline script
to send the command:
SerialDevice.WriteString "sk0" & ebCr
The ebCr constant is a cariage return that is probably required by the device.
I'm not sure if the external device also needs to be initialised first
(by sending "CPA00000000" for example), but that's up to you to find
out ;-)
Hope this helps,
Paul
2012/2/18 Erin <erin.siebert at gmail.com>:
> I am trying to send a command to an external device via a usb
> connection. The external device is an ADU200 USB Relay I/O Interface
> (http://www.ontrak.net/ADUcommands.htm). This is a control box which
> triggers an automatic feeder for our monkeys. Using the control box's
> test software, I can trigger the auto feeder by sending the control
> box the command "sk0." So, I know I need E-Prime to send the command
> "sk0" to the ADU200 control box via a usb COM port.
>
> I have read the E-Prime help, and it appears it is difficult to send a
> non binary message via a com port (the WritePort command). It is
> possible I may need to use something called a Declare Statement, which
> is done outside of E-Prime. However, I am hoping this is not
> necessary.
>
> Reading the OnTrak help, it appear a Visual Basic code similar to
> MSComm1.Output = "sk0" would work (http://www.ontrak.net/visual.htm),
> however this does not appear to be an option in E-Prime.
>
> Any pointers would be very appreciated. Thank you!
>
> Erin
>
> --
> You received this message because you are subscribed to the Google Groups "E-Prime" group.
> To post to this group, send email to e-prime at googlegroups.com.
> To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
More information about the Eprime
mailing list