Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Servo Controller (Serial Version) and Z-World OP7200 — Parallax Forums

Parallax Servo Controller (Serial Version) and Z-World OP7200

Chris ZemanChris Zeman Posts: 3
edited 2005-09-25 22:57 in General Discussion
We are currently attempting to control servos with a Z-World OP7200 controller and a Parallax Servo Controller (#28023) -Rev B.

The Serial I/O pin is connected to TXC on the OP7200, - to GND on the OP7200 and 5VDC Common, and + to 5VDC. We've tried using the code below, as well as 3 other variations, but cannot get the servos to move.

Any help or suggestions would be greatly appreciated.


Thanks,
Chris

#class auto
#memmap xmem
#define CINBUFSIZE 255
#define COUTBUFSIZE 255
 
void main ()
{
 auto char shoulder[noparse][[/noparse]64];
 auto char elbow[noparse][[/noparse]64];

 /*static const char string1[noparse][[/noparse]] = "!SC";
 static const char hex_array[noparse][[/noparse]] = 0x0D;
 static const char dec_array1[noparse][[/noparse]] = 0;
 static const char dec_array2[noparse][[/noparse]] = 7;
 static const char dec_array3[noparse][[/noparse]] = 226;
 static const char dec_array4[noparse][[/noparse]] = 4;
 static const char dec_array5[noparse][[/noparse]] = 250;*/
 static unsigned char cout [noparse][[/noparse]9];
 static const char ra = 7;
 static const char ch = 0;
 static const char cposh = 0xE2;
 static const char cposl = 0x4;
 brdInit();
 serCopen(2400);
 serCparity(PARAM_2STOP);
 serMode(0);
 serCwrFlush();
 memset(shoulder,0x00,sizeof(shoulder));
 memset(elbow,0x00,sizeof(elbow));
 for(;;)
   {
     //costate
      //{
        sprintf(cout,"!SC%c%c%c%c%c",ch,ra,cposl,cposh,0x0d);
        serCwrite(cout,strlen(cout));
         serCclose();
        //memcpy(shoulder,string1,strlen(string1));
        //memset(shoulder, 0x00, sizeof(shoulder));
      }
    /*costate
     {
       pw = 1050;
       memcpy(elbow,string2,strlen(string2));
       serCputs(elbow);
       memset(elbow,0x00, sizeof(elbow));
       waitfor (DelayMs(2500));
       pw = 300;
       memcpy(elbow,string2,strlen(string2));
       serCputs(elbow);
       memset(elbow,0x00, sizeof(elbow));
     }
   }*/
}

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-24 21:01
    The PSC uses what's called "open-true" baudmode, that is, a 1-bit is 0v and a 0-bit is 5v. The "open" part means that the line is only driven low, and at the end of a transmission it is left in an input state -- this lets the same I/O pin serve bidirectional communication. You may want to check the docs for your device to make sure it can do serial comms in this manner.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris ZemanChris Zeman Posts: 3
    edited 2005-09-25 22:57
    Thank you for the information, Jon. I copied your message to Z-World and asked them if the OP7200 can communicate this way. If they can't, well, I guess I just have to add a Stamp to the project as well. [noparse]:)[/noparse]

    Thank you,
    Chris
Sign In or Register to comment.