Serial Port and Visual C# question

Status
Not open for further replies.

zohaib

Member level 4
Joined
Aug 24, 2007
Messages
75
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Location
PAKISTAN
Visit site
Activity points
1,729
Hello forum,
I m building an interface on Visual C# to send data to microcontroller to rotate stepper motor on different angles. Currently i m sending different characters one byte at a time to microcontroller. Microcontroller receiving the ascii code of that character and rotating the motor accordingly. For example if "a" is sent to micro, microcontroller knows that on receiving character "a" it has to move particular degree.

My question is , is there any better approach to do this???

if i have to connect two motors on one port (one motor uses 4 pins ) then how should data be sent to microcontroller to drive two motors irrespective of other one??
 

It is about resolution of angle you need to rotate, if it is enough for you the methods good and fast. By the way do you want to use same port for two motors and with different rotation task ?
 

thanx to reply, yes you get it right, it is like 4pins of the port will be totally unrelated to other 4 pins of that port.
 

there are two different techniques you may use,
1. send one byte data for both motors, LSB motor1 and MSB motor2
2. for example motors are installed on portb do it as PORTB = PORTB & motor2;
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…