Yeah that’s exactly how I did it. I think now though that what I’m looking for cant actually be done with MATLAB unless I pre define it to run like 1000 times. I only have to do this for a demonstration of my hardware capabilities and the next team will handle the programming interface.
Here's my code:
% Function: STRINGGET
%
% Description: code for capturing a string trtminated by 'w'
% String Description: <-...,w,w,w,w,w,w,R0444,G0444,.......,t20,W,w,w,w,w,...->
% Trigger: 'S'
% Serial Port Terminator: 'w'
% BaudRate : 19200
% Input Buffer Size: 4500 CHAR
% Timeout: 60 seconds
%
% Inputs: ADuC842 UART serial string
% Outputs: serial string
s = serial('COM1');
%create serial port object on COM1
set(s,'BaudRate',19200, 'Parity','none', 'Terminator', 'w', 'InputBufferSize', 4500, 'Timeout', 60);
% set serial port object peramiters
fopen(s);
fprintf(s, 'S'); % send 'S' CHAR to ADuC842
str = fgetl(s); % read string from input buffer of serial port object
k = str % move string into k for opperations
fclose(s);
delete(s) % object must be closed, deleted and removed from the workspace
clear s
I can run this in a for loop with 1:1000 and make some kickass graphs.
I been looking into plotting now and I have arrays like P_Ar(1 to 6,1 to 1000,1 to 62)
do you think I should try and plot this info as it comes in or after I have finished placing it into the array.