laboratorios+y+ejemplos

//Manejo de lcd 16x2 con pic16f877a//


=//**Laboratorios con Microcontroladores PIC**//=



El informe de estos laboratorios se deben entregar en formato IEEE. ejemplo

CONVERSOR ANALOGO DIGITA

En esta página encontraran los laboratorios y ejemplos de claes

=**EJEMPLO CONTROL DE DISPLAY**=

Taller Matlab

Derivada

syms x f= input( 'digite una funcion' ); deriva= diff(f) d=simplify(deriva) pretty(d) ezplot(d) axis([-1 5 -1 2]) grid on ;

Integral syms x ; f= input( 'digite una funcion' ); integra=int(f); i=integra; pretty(i); ezplot(i); axis([-3 5 -1 2]); disp(i); grid on ;

varios disp( '1.area' ); %disp muestra la operació

disp( '2.perimetro' ); disp( '3.grafica' ); disp( '4.salir' ); n=input( 'digite la opcion' ); syms x ;

switch (n) case 1 %triangulo

b=input( 'digite la base' ); h=input( 'digite la altura' ); a=(b*h)/2; disp (a); case 2 %perimetro

f1=input( 'lado 1' ); f2=input( 'lado 2' ); f3=input( 'lado 3' ); p=f1+f2+f3; disp(p); case 3 % grafica

vx1=input( 'valor inicial del limite en x' ); % vx2=input( 'valor final del limite x' ); % vy1=input( 'valor inicial del limite y' ); % vy2=input( 'valor inicial del limite y' ); % f=input( 'funcion' ); ezplot(f); axis([vx1 vx2 vy1 vy2 ]) disp(f); title( 'nombre de la grafica' ); xlabel( 'leyenda en x' ); ylabel( 'leyenda en y' ) grid on ;

case 4 close all end

/ //Ejemplo resolución de matriz// //clc//

//disp('Digite los valores según corresponda con los valores k y w...')// //k1=input('digite el valor k1=');//

//k2=input('digite el valor k2=');//

//k3=input('digite el valor k3=');//

//k4=input('digite el valor k4=');//

//k5=input('digite el valor k5=');// //w1=input('digite el valor w1=');//

//w2=input('digite el valor w2=');//

//w3=input('digite el valor w3=');//

//w4=input('digite el valor w4=');//

//w5=input('digite el valor w5=');// //%//

//A=[(k1+k2) -k2 0 0 0;-k2 (k2+k3) -k3 0 0;0 -k3 (k3+k4) -k4 0;0 0 -k4 (k4+ k5) -k5;0 0 0 -k5 k5]//

//w=[w1;w2;w3;w4;w5]// //%solución//

//disp('la solución es ...')//

//X=A\w// / Escribir una función que calcule la hipotenusa de un triángulo rectángulo. %Se calcula según el teorema de Pitágoras c = **sqrt** (a^2+b^2); Con esta función debo crear un fichero con el nombre pit**.**m. Si ahora escribo pit(8, 7) obtengo ans = 10.6301 //
 * function** c = pit (a, b)



function varargout = cambiocolor(varargin)

% CAMBIOCOLOR M-file for cambiocolor.fig

% CAMBIOCOLOR, by itself, creates a new CAMBIOCOLOR or raises the existing

% singleton*.

%

% H = CAMBIOCOLOR returns the handle to a new CAMBIOCOLOR or the handle to

% the existing singleton*.

%

% CAMBIOCOLOR('CALLBACK',hObject,eventData,handles,...) calls the local

% function named CALLBACK in CAMBIOCOLOR.M with the given input arguments.

%

% CAMBIOCOLOR('Property','Value',...) creates a new CAMBIOCOLOR or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before cambiocolor_OpeningFcn gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to cambiocolor_OpeningFcn via varargin.

%

% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one

% instance to run (singleton)".

%

% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help cambiocolor % Last Modified by GUIDE v2.5 29-Oct-2010 10:16:01 % Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @cambiocolor_OpeningFcn, ...

'gui_OutputFcn', @cambiocolor_OutputFcn, ...

'gui_LayoutFcn', [], ...

'gui_Callback', []);

if nargin && ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1});

end if nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

else

gui_mainfcn(gui_State, varargin{:});

end

% End initialization code - DO NOT EDIT

% --- Executes just before cambiocolor is made visible.

function cambiocolor_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn.

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% varargin command line arguments to cambiocolor (see VARARGIN) % Choose default command line output for cambiocolor

handles.output = hObject; % Update handles structure

guidata(hObject, handles); % UIWAIT makes cambiocolor wait for user response (see UIRESUME)

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = cambiocolor_OutputFcn(hObject, eventdata, handles)

% varargout cell array for returning output args (see VARARGOUT);

% hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure

varargout{1} = handles.output;

function edit1_Callback(hObject, eventdata, handles)

% hObject handle to edit1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edit1 as text

% str2double(get(hObject,'String')) returns contents of edit1 as a double

% --- Executes during object creation, after setting all properties.

function edit1_CreateFcn(hObject, eventdata, handles)

% hObject handle to edit1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white');

end % --- Executes on button press in pushbutton1.

function pushbutton1_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) %--

%ORDENES PARA MOSTRAR UNA IMAGEN

%-

%set(handles.axes1,'Visible','off'); %--para hacer que el cuadro axes1 no aparezca al iniciar el programa

set(handles.imagen,'Visible','off');%hace que el exes imagen no se vea

axes(handles.imagen);

set(handles.imagen,'Visible','on');%hace que el exes imagen se vea

a=get(handles.edit1,'string');

%image(imread(a,'jpg')); %puede ir en un directorio diferente a work

imshow(a);title('IMAGEN ORIGINAL');

set(handles.imagen,'Xtick',[]);%borra la escala en eje X

set(handles.imagen,'Ytick',[]);%borra la escala en eje Y

% --- Executes on button press in pushbutton2.

function pushbutton2_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) set(handles.imagen1,'Visible','off');%hace que el exes imagen no se vea

axes(handles.imagen1);

set(handles.imagen1,'Visible','on');

a=get(handles.edit1,'string');

rojo=imread(a);

rojo(:,:,2)=0;

rojo(:,:,3)=0; imshow(rojo)

% --- Executes on button press in pushbutton3.

function pushbutton3_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

set(handles.imagen3,'Visible','off');%hace que el exes imagen no se vea

axes(handles.imagen3);

set(handles.imagen3,'Visible','on');

a=get(handles.edit1,'string');

verde=imread(a);

verde(:,:,1)=0;

verde(:,:,3)=0; imshow(verde) % --- Executes on button press in pushbutton4.

function pushbutton4_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) set(handles.imagen4,'Visible','off');%hace que el exes imagen no se vea

axes(handles.imagen4);

set(handles.imagen4,'Visible','on');

a=get(handles.edit1,'string');

azul=imread(a);

azul(:,:,1)=0;

azul(:,:,2)=0; imshow(azul)

% --- Executes on button press in pushbutton5.

function pushbutton5_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

set(handles.imagen5,'Visible','off');%hace que el exes imagen no se vea

axes(handles.imagen5);

set(handles.imagen5,'Visible','on');

a=get(handles.edit1,'string');

ig=imread(a);

gris=rgb2gray(ig);

imshow(gris) % --- Executes on button press in pushbutton6.

function pushbutton6_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

set(handles.imagen6,'Visible','off');%hace que el exes imagen no se vea

axes(handles.imagen6);

set(handles.imagen6,'Visible','on');

a=get(handles.edit1,'string');

ig=imread(a);

gris=rgb2gray(ig);

bw=im2bw(gris);

imshow(bw)

% --- Executes on button press in pushbutton7.

function pushbutton7_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

close all

Datasheet Memoria ISD