Shop OBEX P1 Docs P2 Docs Learn Events
how to use an adapt812DX microcontroller with parallax servo controller — Parallax Forums

how to use an adapt812DX microcontroller with parallax servo controller

plasmaplasma Posts: 3
edited 2005-05-10 12:34 in General Discussion
hi
I am new to micro-controllers. I am given a adapt812DX( http://www.technologicalarts.com/myfiles/ad812dx.html·)

and i am suppose to use it to interface with a parallax servo controller (PSC).

From what i learnt, the PSC has 3 inputs from the controller - grd, 5V and serial in.

My question is how do i obtain the serial in from the adapt812dx? I have read thru the manuals of the adapt812 and i have totally no idea about how to tap correct output of the serial in.

And is it possible for me to share the same power supply for both micro-controller and the servo controller?

Thanks for replying



·

Comments

  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-05-09 18:03
    You should read through the Parallax documentation that comes with the PSC first. If you don't have it you can get it from the Parallax website here:
    http://www.parallax.com/dl/docs/prod/motors/ServoController.pdf

    It should be pretty clear how to communicate with the PSC from reading that. The documentation for your Adapt product should be able to help you on how to control from that end.

    Ryan
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-05-09 18:13
    Generally speaking it is not a good idea to use the same power source for your control (Adapt) and your servos. If the draw is going to be small then you are generally ok, but it is still not a good habit to get into. The drain from your servos straining may be enough to cause a brown-out (and generally a reboot)-

    Ryan
  • plasmaplasma Posts: 3
    edited 2005-05-10 02:45
    Hi guys

    I have found this C++ code for testing the microcontroller.

    #include "HC12.h"
    int function(int a, int b, int c, int d){ int e;
    · e = a+b;
    · return e;
    }
    int f;
    void main(void){
    · COPCTL = 0x00;· // disable COP
    · f = function(1,2,3,4);
    · DDRT = 0xFF;·· // PortT is output
    · DDRJ = 0x00;·· // PortJ is input
    · while(1){
    ··· if(PORTJ&0x01){
    ····· PORTT=0xFF;·
    ··· }
    ··· else{
    ····· PORTT=0x00;
    ··· }
    · }
    }
    extern void _start();
    #pragma abs_address:0xfffe
    void (*reset_vector[noparse]/noparse)() = { _start };
    #pragma end_abs_address

    May i know what is the meaning of the "pragma" and "extern void _start();"


    thanks a lot
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-10 02:49
    You might want to start with a good book on C/C++.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • plasmaplasma Posts: 3
    edited 2005-05-10 08:51
    Thanks for the reply.
    Now i have another question.
    Since the PSC (parallax servo controller) uses a basic stamp code, how can i implement using C++ in the microcontroller to drive the servo controller?
    Do you have some basic C++ sample programs to run the servo controller as my C++ knowledge is quite limited?
    thanks a lot!!

    yongway
  • kb2hapkb2hap Posts: 218
    edited 2005-05-10 11:44
    You may want to talk to the makers of your microcontroller. You'll have to figure out how to send serial data with your uC using C++. Which as Jon said, you should really pick up a good book on the subject. The PSC is very easy to use you just need to figure how to program your uC. I'm sure you could google the subject to find out more info. The major programming languages on this forum are PBasic,SX/B and Assembly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-10 12:34
    The PSC does not use BASIC Stamp code; it accepts serial commands from any controller that can send asynch serial data. What you need to do is determine if your micro has a UART or software serial routines that can send the data at the correct baud to the PSC.· We don't do a lot with C/C++, but I believe that a couple Javelin customers have written Java code for the PSC.· Java is much closer to C that BASIC, but the Javelin version of Java may not be a big help to you as it uses embedded routines in the Javelin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.