In order to use it you must install the special driver software that
comes on the cd with the device. The computer will not be able to
talk to converter without this software. You will also need to set
the parameters in the keyspan serial assistant control panel. With the
keyspan you can leave most of the settings at their default. The
keyspan has serial ports - usb::1 and usb::2. The example bleow shows
the control panel that controls the keyspan device. In the
example below, note that usb1 is mapped to a port name "Printer Port
USB". You will need that port name in the xtra that allows director
to talk to serial devices.
The EZIO board sends and receives commands via RS-232 communication.
It uses an xtra for deirector to send serial communicati0on. This
example uses Geoff Smith's SerialXtra which you must place in yor Xtra
directory. If you use other serial communication xtras, you will
probably need to adjust the commands.
| -- Do not delete this Movie Script! Nothing will work!!
-- Director for Windows EZ I/O script -- Version 1.3beta april 23, 2001 -- fixes serial comm problems with handlers that return results -- modifications by Olof Bendt for it to work in Director8 with Geoff Smith's Serial Xtra -- just install the Xtra as usual, instead of the .dll file supplied with the EZIO -- distribution. -- -- =============================================================================== -- Copyright 1997, The Regents of the University of Michigan. All rights reserved. -- Developed at the University of Michigan School of Art and Design -- by Michael Rodemer and Ed Bennett -- =============================================================================== -- ===============================================================================
-- this routine checks if you have already intiialized the serial xtra
on startsensors
|
NOTE: you should use the routines described
in section 5 below to access the read and write routines rather than these
direct calls
Those routines allow easy use of the simulator
when there is no board
The EZIO board comes with several routines for using its various capabilities. The capabilities include the following:
The EZIO board is looking for a string of characters including a
letter and one of more values to tell it what to do. Each of these
routines compose the proper sequence of commands and then send them out
the
serial port. These routines should be put in the script at the movie
level. They will be repeatedly called as you attempt to check the
input status of the various digital and analog ports and output digital
signal levels to the output ports.
|
-- A2D will read a voltage between 0 and 5 Volts -- (use the 5V available on the board) and return its value, -- expressed as a number between 0 and 255 -- you get access to its value by setting a variable equal to its result -- for example A3 = A2D(3) would set the variable A3 = current analog voltage on A2D lineNo --valid line numbers are 1-8
|
|
-- readLine returns a 0 or 1 to indicate the state of a single line, -- with "1" being "high" and "0" being "low" -- set z4 = readLine(4) would set the variable z4 = to the voltage state at the input line 4 on readLine lineNo -- valid line numbers are 1 through 10
|
|
-- writeLine turns a single line on or off, "1" being "on," "0" being "off" --writeLine 2, 1 would turn on output port 2 -- writeLine 3, 0 would turn off output port 3 on writeLine lineNo, onOff -- valid line numbers are 1 through
10
|
|
-- =============================================================================== -- writePort will cause a pattern of ons and offs on digital output lines 1 through 8 on the board -- depending on the value of the variable "state" on writePort state -- valid values for state are 0-255
-- ===============================================================================
on readPort
-- ===============================================================================
on PWM lineNo, onTime -- valid line numbers are 1 or 2
-- the following code makes two 8-bit numbers
end
|
Here are some samples that show how to use the ezio board and provide
for a simulator when there is no ezio board.
| --================= intro
-- use a variable called ezflag to indicate if pluged into the board -- script will use that variable thoughout to redirect to simulator if not plugged in -- the ezio board init routines will be called if it = 1 -- the digital and analog input values will be fetched from the board if ezflag = 1 -- otherwise he digital and analog input values will be fetvched from simulator -- use these routines for all calls to the board and the simulator will be seamless -- !!!! don't change the member numbers or sprite numbers of the simulator and indicators!! the routines assume they are where they are -- -- initsensorlists is routine to reset all values -- digital in
-- analog in
-- ditigal out
--===============start routines
-- these are the lists that will store the values of sensors and outputs on initsensorlists global fakedanainl,curanainl
end --====================== idle routines to check values at the board -- take out the comments to force regular updates
of input sensor readings
on idle
-- this calls routines to read analog and digital
in
on updateInputs
--==================== read digital in
on readdiginput q -- read digital input for each port
on readalldigin -- loop through all 8 digital input
on fakedigitalin
-- resetall digital in
--======================== read analog in -- This is basic routine to read analog input
on readAnainput q -- does one readings
-- loops through all by calling readdiginput with q = 1 to 8
-- routine to take all the fake simulator values
and enter them into the system
-- reset all analog
--====================== ditial output -- basic routine to write out value to digital
output port
on writedigout q,val
-- see what buttons indicate
on writealldigout
-- sets all digital out to off (0)
--============== make simulator and indicators
visible
-- indicator visile
|