Mình sắp điên với Matlab Gui rồi nè các bạn, mình có đoạn code sau:
function Connect_Callback(hObject, eventdata, handles)
% hObject handle to Connect (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load data;
if (IsConnect ==0);
IsConnect=1;
s=serial('COM1');
s.BytesAvailableFcncount = 1;
s.BytesAvailableFcnMode = 'byte';
s.BytesAvailableFcn =@myCallback;
set(handles.edit_RX,'String','ready');
fopen(s);
end
save data;
% --- Executes during object creation, after setting all properties.
function Connect_CreateFcn(hObject, eventdata, handles)
% hObject handle to Connect (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function myCallback(obj,event)
set(handles.edit_RX,'String','hehe..');
% End of edit
tại sao khi mình gứi dữ liệu từ Pic đến PC ,Matlab cứ thông báo la:
Warning: The BytesAvailableFcn is being disabled. To enable the callback property
either connect to the hardware with FOPEN or set the BytesAvailableFcn property.
Haizz, chán quá
function Connect_Callback(hObject, eventdata, handles)
% hObject handle to Connect (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load data;
if (IsConnect ==0);
IsConnect=1;
s=serial('COM1');
s.BytesAvailableFcncount = 1;
s.BytesAvailableFcnMode = 'byte';
s.BytesAvailableFcn =@myCallback;
set(handles.edit_RX,'String','ready');
fopen(s);
end
save data;
% --- Executes during object creation, after setting all properties.
function Connect_CreateFcn(hObject, eventdata, handles)
% hObject handle to Connect (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
function myCallback(obj,event)
set(handles.edit_RX,'String','hehe..');
% End of edit
tại sao khi mình gứi dữ liệu từ Pic đến PC ,Matlab cứ thông báo la:
Warning: The BytesAvailableFcn is being disabled. To enable the callback property
either connect to the hardware with FOPEN or set the BytesAvailableFcn property.
Haizz, chán quá