hello
i new in interface between matlab and PIC, so i need some help how i can send data from matlab program by serial port to PIC .i am work to how control in dc motor depended on matlab output if output of matlab 0 the dc motor not work, if output of matlab 1 the dc motor will work , i am start in matlab code how open contact with PIC, but how sent the value to PIC.
here this part of my code
Code:
if(h>90)
b=1
s = serial('COM2');
fopen(s)
fclose(s)
(here need dc motor work)
else
b=0
(here dc motor must be not work )
h out of sum calculation
in above code how send (b) to PIC to dc motor work
thanks for all and sorry for bad English :-(
Just try to do it individually, send '1' from PC Hyperterminal and the start your DC Motor and then send '0' from PC Hyperterminal to stop DC Motor.
Code:
%Create Serial Port Object
s = serial('COM2','BaudRate',9600,'Terminator','CR');
fopen(s)
fprintf(s,'Write Anything here will be sent to Serial Port);
msg = fgets(s); %get data from serial port
fclose(s)
delete(s)
thanks for reply , i have another question my above question depended in this work
1-When the employee puts his finger on the fingerprint reader, and press the first button, the PIC sends a signal to the computer in order to make fingerprint reader work, and the fingerprint reader take image and stored in File.
2-Then press the second button ,where PIC send a signal to the computer to active features matlab code, to find features and stores in computer .
3-press on third button the PIC send signal to the computer in order to active( fingerprint compared code) where there are two conclusions
1 - if there is a match the door is opened by sending a signal (1) to the to the motor
2 - If no matching the door will not open and computer send a signal (0) to the motor
pleas need help sorry for bad English.