Skip to content

Commit

Permalink
I'm not quite sure how this works
Browse files Browse the repository at this point in the history
  • Loading branch information
aulloa committed Mar 17, 2015
1 parent f822cbb commit a25722a
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 4 deletions.
45 changes: 41 additions & 4 deletions Protochip.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,47 @@
obj1 = serial('COM5');
else
fclose(obj1);
obj1 = obj1(1)
obj1 = obj1(1);
end

% Flush the data in the input buffer.
% flushinput(obj1);
%Flush the data in the input buffer.
flushinput(obj1);
fopen(obj1)
out = fread(obj1,64,'int16','l',)
set(obj1,'Terminator','CR')
A = fscanf(obj1,'%s')
% B = fread(obj1,'uint8')
% d = 736034.599826;
% fgets(obj1)
% A = fscanf(obj1,'%x')
%
% fid = fopen(fullfile(pathname, filenameAll));
% fopen(obj1)
% [a,b] = hexfread(obj1,6)
% str = native2unicode(fread(obj1))
% A = sscanf(str,'%x %x')
% format hex
% [mformat] = fopen(obj1);
% fclose(obj1)
% set(obj1,'Terminator','CR')
% [A,count,msg] = fread(obj1,64,'short')
% [b,count,msg] = fread(obj1,64,'short')
% out1 = fread(obj1,512/16,'int16')
% out2 = fread(obj1,512/16,'int16')
% out4 = fread(obj1,512/16,'int16')
% out5 = fread(obj1,512/16,'int16')
% out6 = fread(obj1,512/16,'int16')
% out7 = fread(obj1,512/16,'int16')
% out8 = fread(obj1,512/16,'int16')
% out9 = fread(obj1,512/16,'int16')
% out10 = fread(obj1,512/16,'int16')
% out11 = fread(obj1,512/16,'int16')
% out12 = fread(obj1,512/16,'int16')
% out13 = fread(obj1,512/16,'int16')
% out14 = fread(obj1,512/16,'int16')
% out15 = fread(obj1,512/16,'int16')
% out16 = fread(obj1,512/16,'int16')

s = serial('COM5');
s.BaudRate = 9600
fopen(s)
fscanf(s,'%X')
28 changes: 28 additions & 0 deletions realterm.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
hrealterm=actxserver('realterm.realtermintf'); % start Realterm as a server
% Only use these 3 lines to see what properties and methods realterm has.....
fprintf(1,'\nProperties of Realterm\n\n');
get(hrealterm) %List all properties.
try
set(hrealterm) %In later versions of matlab, this will show you what possible values the enumerations can take
catch
end
fprintf(1,'\n\nMethods of Realterm\n\n');
invoke(hrealterm) %List all functions
% some example properties
hrealterm.baud=9600;
hrealterm.caption='Matlab Realterm Server';
hrealterm.windowstate=1; %minimized
hrealterm.PortOpen=5; %open the comm port
is_open=(hrealterm.PortOpen~=1); %check that it opened OK
hrealterm.displayas=2; %show hex in terminal window
hrealterm.CaptureFile='c:\temp\matlab_data.dat'
invoke(hrealterm,'startcapture'); %start capture
%do what you want here
fprintf(1,'\n\nTry what you want here. Type RETURN to end demo and close realterm\n')
keyboard
invoke(hrealterm,'stopcapture');
try %try to close any we can in case they are faulty.
invoke(hrealterm,'close'); delete(hrealterm);
catch
fprintf('unable to close realterm')
end; %try

0 comments on commit a25722a

Please sign in to comment.