File: PR705write.m

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (33 lines) | stat: -rw-r--r-- 1,057 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function varargout = PR705write(datastr, varargin)
% PR705write - Write a string of characters to the PR-705.
%
% Syntax:
% varargout = PR705write(cmdStr [, block=1])
%
% Description:
% This is a convenience wrapper to write data to the PR-705 device. Aside
% from appending a carriage return and not requiring an explicit port
% handle, this function is identical to IOPort's Write (see IOPort Write? 
% for more details).
%
% Inputs:
% datastr (1xN char) - data string to write to the PR-705.
% block (scalar) - enable (1, default) or disable (0) blocking writes
%
% Outputs:
% Refer to IOPort Write?
%
% 11/29/12    zlb   Wrote it.

global g_serialPort

if nargin < 1 || isempty(datastr) || nargin > 2 || nargout > 6
    error('Invalid input/output arguments. Please refer to ''help PR750write''.\n');
end

if datastr(end) ~= 13 && ~strcmp(datastr, 'PR705') % only command that doesn't require a CR
    datastr = [datastr 13];
end

% Write sequence of chars to PR-705.
[varargout{1:nargout}] = IOPort('Write', g_serialPort, upper(datastr), varargin{:});