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.

Questions about interfacing Matlab with AT89S51 (Assembly)

Status
Not open for further replies.

ZaeemAhmad

Junior Member level 2
Joined
Dec 24, 2009
Messages
20
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,452
I want to interface MATLAB (GUI) with AT89S51 uC to control the direction and angle of a bi-polar stepper motor. How should I proceed? The questions that I have in my mind include:
1. Can I send the no. of steps first in one byte of data, then another byte of data containing the direction data (CW or CCW)? How can I do this?
2. How should I write the assembly code so it receives these two bytes of data and stores them in separate registers?
 

Re: Matlab & AT89S51

Use parallel port /serial port for interface with ur pc
1. Yes u can do this
2.configure 8051 as input , mov receved value to acc. , input nxt value compare for cw,ccw direction
 

Re: Matlab & AT89S51

I have written some code in Matlab GUI for a button which is to be pressed after the input of angle and selection of a radio button corresponding to either clockwise or anti-clockwise direction:

function move_it_Callback(hObject, eventdata, handles)

ccw_selected = get (handles.ccw, 'Value');
cw_selected = get (handles.cw, 'Value');
angle = str2num (get (handles.angle_value, 'String'));
steps = angle / 15;
port = serial ('COM1', 'BaudRate', 9600);
fopen (port)
fwrite (port, steps);
fclose (port);
guidata(hObject, handles);


Will this work? What changes should be done, if required...?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top