File: PR705init.m

package info (click to toggle)
psychtoolbox-3 3.0.14.20170103%2Bgit6-g605ff5c.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,044 kB
  • ctags: 69,483
  • sloc: ansic: 167,371; cpp: 11,232; objc: 4,708; sh: 1,875; python: 383; php: 344; makefile: 207; java: 113
file content (37 lines) | stat: -rw-r--r-- 1,104 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
37
function response = PR705init(portString)
% PR705init - Initialize the serial port to talk to the PR-705.
%
% Syntax:
% retval = PR705init
% retval = PR705init(portString)
%
% Description:
% Initializes the serial port and establishes remote mode for the PR-705.
%
% Input:
% portString (1xN char) - Name of the serial port to use.
%
% Output:
% response (1xN char) - Character data returned from the PR-705.
%
% 11/29/12    zlb   Wrote it based on the PR670Toolbox. 

global g_serialPort g_useIOPort

if nargin == 0
    % Let FindSerialPort do its job
    portString = FindSerialPort('', g_useIOPort);
end

% Only open if we haven't already.
if isempty(g_serialPort)
    % IOPort has above port settings 9600 baud, no parity, 8 data bits,
    % 1 stopbit, no handshake (aka FlowControl=none) already as
    % built-in defaults, so no need to pass them:
    oldverbo = IOPort('Verbosity', 2);
    g_serialPort = IOPort('OpenSerialPort', portString, 'Lenient DontFlushOnWrite=1');
    IOPort('Verbosity', oldverbo);
end

PR705write('PR705');
response = PR705read(1, 16); % get the ' REMOTE MODE' response