File: PR670write.m

package info (click to toggle)
psychtoolbox-3 3.0.15.20190207.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 101,848 kB
  • sloc: ansic: 174,133; cpp: 11,232; objc: 4,832; sh: 1,874; python: 1,047; php: 384; makefile: 189; java: 113
file content (36 lines) | stat: -rwxr-xr-x 931 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
34
35
36
function PR670write(cmdStr, appendCR)
% PR670write - Write a string of characters to the PR-670.
%
% Syntax:
% PR670write(cmdStr)
% PR670write(cmdStr, appendCR)
%
% Description:
% Writes a string of characters to the PR-670.  By default, it appends a
% carriage return (CR) to the end of the string.  Note that if the CR is
% already there, it won't be appended. The CR can be disabled as
% some commands do not need it.  See the PR-670 documentation for which
% command need the CR.
%
% Input:
% cmdStr (1xN char) - String of characters to send.
% appendCR (scalar) - 1 to append a CR, 0 to not append.  Default: 1

global g_serialPort;

if nargin == 1
	appendCR = 1;
end

if appendCR
	% Check for the CR and add if necessary.
	if cmdStr(end) ~= char(13)
		cmdStr = [cmdStr char(13)];
	end
end

% Write sequence of chars to PR-670.
for i = 1:length(cmdStr)
    IOPort('write', g_serialPort, upper(cmdStr(i)));
    pause(0.05)
end