go_away

Author Topic: two dc motors synchronous commanding  (Read 635 times)

0 Members and 1 Guest are viewing this topic.

Offline arixIITopic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
two dc motors synchronous commanding
« on: June 10, 2009, 04:40:55 PM »
Hi,
In a post I made here:
http://www.societyofrobots.com/robotforum/index.php?topic=8180.0
I asked a question, about how I can command two motors using one line of code, but not two separate lines. I compared two coding style of ssc-32 motor controller, where you can command two dc motors in two separate lines like:
Code: [Select]
Serial.println("#0 P1400");
Serial.println("#1 P1600");
and also in ONE single line which is my intention as:
Code: [Select]
Serial.println("#0 P1400 #1 P1600");
the thing is that I am going to use PIC and I don't know how this is being implemented with a pic, and two dc motors connected to it with two standard H-Bridge. In that post I made, someone gave a good answer as:
Quote
To start/stop both motors at the same time, just change the bits of a byte that you transfer to a port they're hanging on, no big deal.

this is a correct answer, as I am not going to use any serial communication, but the PIC has PWM and is going to be connected directly to H-Bridges, hence setting bits to change the port is right in theory. But I don't know how this can be coded (I am a novice). Please if anyone knows how to implement this answer in programs, give me a code fragment example, showing how to "change the bits of a byte that you transfer to a port" for simultaneously commanding two motors.


 


Get Your Ad Here