MasterScan  Lab_Matlab_control Master Branch
List of all members | Properties and Events | Protected Properties | Methods | Protected Methods
dotsWritableDOut1208FS Class Reference
Inheritance diagram for dotsWritableDOut1208FS:
Inheritance graph
[legend]

Properties and Events

Property currentChannel = 0
 Channel number to use. More...
 
Property vendorID = 2523
 USB vendor ID for the 1208FS device.
 
Property productID = 130
 USB product ID for the 1208FS device.
 
Property channels = [0 1]
 valid output channels for TTL pulses and signals
 
Property ports = 0
 valid output ports for strobed words
 
Property dPortConfigID = 1
 HID report ID for digital port setup.
 
Property dPortOutID = 4
 HID report ID for digital port output.
 
Property pulseWidth = .001
 width of TTL pulse in seconds
 
Property pulseMax = 255
 pulseMax [0-255]
 
Property pulseSignal = [true false]
 TTL signal containing a single pulse.
 
Property signalStartID = 21
 HID report ID to start analog output scans.
 
Property signalStatusCookie = 8
 HID element cookie for analog output status.
 
Property signalStatusRunning = 0
 "still running" status returned from 1208FS device
 
Property signalStatusDone = 2
 "all done" status returned from 1208FS device
 
Property signalStopID = 22
 HID report ID to stop analog output scans.
 
Property signalSamplesID = 0
 HID report ID to sending analog output samples.
 
Property signalSamplesPerReport = 32
 number of analog output samples to send per report
 
Property signalMaxSamples = 512
 max number of samples that the 1208FS can buffer
 
Property signalPrescanReports = 7
 number of reports the 1208FS may buffer before initiating scan
 
Property clockFrequency = 10e6
 clock frequency used by the 1208FS microcontroller
 
Property clockMaxPreload = 65535
 maximum counter size used by the 1208FS microcontroller
 
Property clockMaxPrescale = 8
 maximum clock scale exponent used by the 1208FS microcontroller
 
- Properties and Events inherited from dotsWritableDOut
Property defaultPauseBetweenPulses = 0.1
 for sendTTL pulses
 
- Properties and Events inherited from dotsWritable
Property isAvailable = false
 

whether or not the object is ready to read() from


 
Property clockFunction
 

any function that returns the current time as a number


 

Protected Properties

Property deviceIDs
 mexHID() device IDs for all the 1208FS sub-devices
 
Property primaryID
 mexHID() device ID for the primary 1208FS device
 
Property outputID
 mexHID() device ID for the output 1208FS device
 

Methods

self dotsWritableDOut1208FS (varargin)
 Arguments are ultimately passed to openDevice.
 
timestamp sendStrobedWord (self, word, port)
 Send a 15-bit strobed word spanning digial ports A and B. More...
 
timestamp ref sendTTLPulse (self, channel)
 Send a TTL pulse, using a short TTL signal. More...
 
timestamp ref sendTTLSignal (self, channel, signal, frequency)
 Send a TTL signal using an analog output scan. More...
 
time getDeviceTime (self)
 overloaded getDeviceTime sends a TTL pulse and returns the onset time of the pulse – used for synchronization
 
- Methods inherited from dotsWritableDOut
self dotsWritableDOut ()
 Constructor takes no arguments.
 
timestamp sendStrobedWord (self, word, port)
 Send a strobed digital word. More...
 
timestamp sendTTLPulse (self)
 Send a single TTL pulse. More...
 
firstTimestamp lastTimestamp sendTTLPulses (self, numPulses, pauseBetweenPulses, channel)
 Send multiple TTL pulses Timestamps are estimates of onset times of first and last pulses. More...
 
timestamp sendTTLSignal (self, channel, signal, frequency)
 Send a TTL signal or waveform. More...
 
- Methods inherited from dotsWritable
self dotsWritable ()
 

Constructor takes no arguments.


 
 initialize (self, varargin)
 

Locate, acquire, configure, etc. device and component resources.


 
time getDeviceTime (self)
 

Get the current time from clockFunction.


 
 close (self)
 

Release any resources acquired by initialize().


 
 delete (self)
 

Automatically close when Matlab is done with this object.


 

Protected Methods

 openDevice (self, properties)
 Protected methods. More...
 
 closeDevice (self)
 Release the mexHID() device. More...
 
report formatSignalConfig (self, channel, signal, frequency)
 Format a HID report to configure an analog output scan.
 
report formatSignalStop (self)
 Format a HID report to end an analog output scan.
 
report formatSignalData (self, signal)
 Format a HID report to send analog out sample byte data.
 
report formatDigitalConfig (self, port, isInput)
 Format a HID report to configure digital port direction.
 
report formatDigitalOutput (self, port, byte)
 Format a HID report to send digital port byte.
 
signalStatus waitForRunningSignal (self)
 Block as long as the device reports "still running".
 
status timing ref writeSignalSamples (self, channel, signal, frequency)
 Write configuration and samples to analog output scan.
 
- Protected Methods inherited from dotsWritable
 openDevice (self)
 

Locate and acquire input device resources (for subclasses).

More...
 
 closeDevice (self)
 

Release input device resources (for subclasses).

More...
 

Additional Inherited Members

- Static Methods inherited from dotsWritableDOut
static dout getDefault ()
 get default Dout device
 

Methods

◆ sendStrobedWord()

timestamp sendStrobedWord ( self  ,
word  ,
port   
)

Send a 15-bit strobed word spanning digial ports A and B.

Parameters
wordunsigned integer representing a word or code to send
portignored, always uses ports A and B

Uses both digital output ports of the 1208FS, A and B, to send a 15-bit strobed word. Sets the 8 lowest bits of word to port A. Sets the next 7 bits of word to port B. Ignores any higher bits of word. Uses the 8th bit of port B as a strobe bit.

Makes four mexHID() transactions to write the bits of word to the digital ports and flash the strobe bit.

  1. writes the low 8 bits to port A
  2. writes the high 7 bits to port B, with strobe bit clear
  3. writes the high 7 bits to port B, with strobe bit set
  4. writes the high 7 bits to port B, with strobe bit clear

The four transactions makes sure that all word bits are in place before the strobe bit is set, and that the strobe bit is cleared before continuing. Thus, the strobe bit may remain set for as long as it takes to complete a transaction. From tests, it appears this takes about 2ms.

Returns the mexHID() pre-transaction timestamp from the 3rd transaction, when the strobe bit was set.

Here are the word bits, digital port bits, and phisical device pins that dotsDOut1208FS expects to match:

word bit0123 456789 10111213 14(strobe)
port bitA0A1A2A3 A4A5A6A7B0 B1B2B3B4B5 B6B7
pin21222324 2526272833 3435363738 3940

◆ sendTTLPulse()

timestamp ref sendTTLPulse ( self  ,
channel   
)

Send a TTL pulse, using a short TTL signal.

Parameters
channel0 or 1, from which analog output to send the TTL pulse

Uses sendTTLSignal() to send a single TTL pulse. The signal is specified in the pulseSignal property and should contain a single region of true, followed by false. This assumes that channel begins at a low value and will transition to high and back to low during the pulse.

The pulseWidth property specifies the duration of each sample in pulseSignal: output sample frequency is equal to 1/pulseWidth.

Returns the timestamp returned from sendTTLSignal(). As long as pulseSignal begins with a true value, the timestamp will be an estimate of when channel transitioned to a high value. See sendTTLSignal() for timing details and other details.

◆ sendTTLSignal()

timestamp ref sendTTLSignal ( self  ,
channel  ,
signal  ,
frequency   
)

Send a TTL signal using an analog output scan.

Parameters
channel0 or 1, from which analog output to send signal
signallogical array specifying a sequence of TTL values to output from channel, with true->high and false->low
frequencyfrequency in Hz at which to move through elements of signal

Outputs the given TTL signal, at the given sample frequency, from the given analog output channel, under control of the 1208FS device's onboard microprocessor. If signal is too long to fit in the device's onboard memory, returns immediately with a negative error code. From tests, it appears that the onboard memory holds 512 samples.

Before outputting a new TTL signal, blocks until the 1208FS deivce reports that the previous signal is all done. Otherwise, the previous signal would be truncated. The device reports the status of the previous signal as a HID element value which mexHID() can read.

Once ready, makes 1 mexHID() transaction to configure the given channel to ouput n samples at the given frequency, where n is the number of elements in signal. Then makes m additional transactions to write signal data to the 1208fs device's onboard memory. Since each transaction contains 32 samples, m is equal to n/32, rounded up.

From tests, it appears that the 1208FS begins outputting signal upon receipt of one of the m signal data transactions. There are two apparent patterns:

  1. when the number of transactions m is 7 or fewer, the device outputs samples upon receipt of last transaction.
  2. when the number of transacitons m is 8 or more, the device outputs samples upon receipt of 8th transaction.

Returns the mexHID() pre-transaction timestamp from either the last or the 8th transaction, as above. From tests, it appears that this pre-transaction timestamp preceeds signal onset by about 3.5ms when the scan frequency is 1000Hz and about 1.5ms when the scan frequency is 10,000Hz. The size of the preceeding interval did not seem to depend on the length of signal. Further testing would be warranted.

Here are the channels, "signal name"s and physical device pins that dotsDOut1208FS expects to match:

channel 01
nameD/A OUT 0D/A OUT 1
pin1314

◆ openDevice()

openDevice ( self  ,
properties   
)
protected

Protected methods.

Open the device Open and configure the 1208FS device with mexHID().

Parameters
propertiesoptional struct of HID device properties for locating a particular 1208FS device

Initializes mexHID() if necessary and locates the 1208FS deivce using by VendorID, ProductID, and any additional properties specified (e.g. SerialNumber). Opens the four sub-devices of the 1208FS and determines which is the primary front-end (primaryID) and which is the analog output scan device (outputID).

Configures both digital output ports, A and B, for doing outputs. Stops any analog output scan that might be in progress, and sets intial low (0V nominal) values to both analog output channels.

◆ closeDevice()

closeDevice ( self  )
protected

Release the mexHID() device.

Stops any analog output scan that might be in progress, and releases all four sub-devices of the 1208FS.

Does not attempt to terminate mexHID().

Properties and Events

◆ currentChannel

Property currentChannel = 0

Channel number to use.

IN both 4- and 8-channel modes, the D/A outs are: channel 0 = physical port 13 channel 1 = physical port 14 NOTE that ground channels are: 12, 15; true ground is 17


The documentation for this class was generated from the following file: