Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

control dc motor by matlab and PIC

Status
Not open for further replies.

Esra Elazragh

Newbie level 4
Joined
Aug 31, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
39
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 :-(
 

Have a look at this link.
https://sites.google.com/site/coolembeddedlaboratory/home/matlab/serial-communication-using-matlab

The task you are doing is very simple.

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)
https://sites.google.com/site/coole...edded-system/servo-motor-control-using-matlab
 

    V

    Points: 2
    Helpful Answer Positive Rating
thanks for reply , i have another question my above question depended in this work
ees.jpg
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.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top