Shop OBEX P1 Docs P2 Docs Learn Events
servo help — Parallax Forums

servo help

Sigma XSigma X Posts: 38
edited 2010-10-17 22:06 in Propeller 1
Hi I'm in need of some help I'm currently working on a project
it's really simple i'm tring to control servos via push buttons and or pressure sensors
for example: they're 4 buttons in all one is a device button (4) the operation is simple




when button 1 is pressed servo 1 runs clockwise when released it runs counterclockwise
same for button 2 and 3
but for button 4 to work either button 1,2,or3 must be pressed

any and all help will be apperciated

sorry for poor grammer it is pretty late

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-02 22:45
    Have you looked at the servo driver objects in the Propeller Object Exchange? Either "Servo-4" or "Servo32v7". Also have a look at "RC_Servo_Control" for some examples of servo control. The link to the Propeller Object Exchange is on the bottom of Parallax's main web page and all three objects mentioned are under Motor Control.
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-10-03 02:53
    Hello and welcome to the propeller-forum Sigma X.

    You can ask as many questions as you like here.
    All members are willing to help. How fast the help helps depends
    on the amount of information you give in.

    From what you describe this could be a hardware-problem
    push-buttons wired in a strange way or a software-problem

    Without providing your code that you have so far
    forum-members would have to code a whole new program to help you.

    It will be much faster if you attach your code to a posting that you have so far. That experienced programmers can take a look inside your code.

    And you will learn much more on that way than copy and paste a working solution.

    look at the attached picture how your COMPLETE code can be attached to a posting by a few mouse-clicks

    Further on I would like to comment on your posting-style:
    It seems to be a very quick written posting. My personal experience is:
    If you want the things to go superfast it turns out to be superslow.

    You posted a little information and now it takes a posting back and forwards to add information that was left out in the first posting.
    So the saving of 15 minutes to find out how to attach propeller code and
    write a few sentences more turned out to waste several hours until the forum can help you

    best regards

    Stefan
  • kwinnkwinn Posts: 8,697
    edited 2010-10-03 07:55
    What Stefan says. Post the schematic of the buttons and the code.
  • Sigma XSigma X Posts: 38
    edited 2010-10-03 11:11
    Thanks for the welcome and tips I will put them to use.
    I didn't have a schematic,(just a flow chart) I was just mainly asking for advice and tips to get started Mike Green helped there. I'll post what I have once I get started.

    I was also wondering if it is possible to use MPLAB to program the propeller?
    or use the .ASM language rather than spin to program? I thought I seen it done before, but I feel better to ask. If so how can it be done?
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-10-03 12:23
    Hi Sigma X,

    the Servo32-object itself is written in assembler but has a interface to
    SPIN. For reading buttons SPIN is fast enough. Assembler is only needed if have high speed-requirements. If you are new to programming I recommend
    to learn SPIN first. I think SPIN is easier than assembler.

    So the next step is that you write a small piece of code yourself
    and play around with it. And then come back with questions.

    As far as I see it if you have concrete questions about a few lines of code
    you will get an answer quickly.

    best regards

    Stefan
  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-03 12:34
    You can program in Spin or in the Propeller's assembly language. You can program the Propeller for free in several flavors of Basic (PropBasic, FemtoBasic), in C (Catalina), and in Forth. There's a graphical programming system called "12Blocks" that's inexpensive and produces Spin code.

    You can't use MATLAB to program the Propeller
  • Sigma XSigma X Posts: 38
    edited 2010-10-06 06:54
    Thanks for the tips again guys. This is very helpful I will have a code soon to post.
  • w4fejw4fej Posts: 264
    edited 2010-10-06 08:31
    StefanL38 wrote: »
    Hello and welcome to the propeller-forum Sigma X.

    You can ask as many questions as you like here.
    All members are willing to help. How fast the help helps depends
    on the amount of information you give in.

    From what you describe this could be a hardware-problem
    push-buttons wired in a strange way or a software-problem

    Without providing your code that you have so far
    forum-members would have to code a whole new program to help you.

    It will be much faster if you attach your code to a posting that you have so far. That experienced programmers can take a look inside your code.

    And you will learn much more on that way than copy and paste a working solution.

    look at the attached picture how your COMPLETE code can be attached to a posting by a few mouse-clicks

    Further on I would like to comment on your posting-style:
    It seems to be a very quick written posting. My personal experience is:
    If you want the things to go superfast it turns out to be superslow.

    You posted a little information and now it takes a posting back and forwards to add information that was left out in the first posting.
    So the saving of 15 minutes to find out how to attach propeller code and
    write a few sentences more turned out to waste several hours until the forum can help you

    best regards

    Stefan

    Stefan:
    Thanks! Although I am not the poster, you just showed me something I didn't know! I will (I am sure) be starting to code my project very soon and I would have made forum postings the hard (wrong) way. I wasn't aware of the archive feature in the "tool".

    I love this forum!! :idea:

    Mike B.
  • Sigma XSigma X Posts: 38
    edited 2010-10-11 17:03
    Sorry for the delay, I had to test what I have here's the code so far any help is greatly needed.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-11 17:13
    First of all, what's "Utilities"? It look like it has to do somehow with an MCP3202 ADC.

    Second, you're setting ServoPos from two cogs and there's no way to tell which cog is going to get to it first. Probably the main cog will get to it since it takes about 100us to start up a new cog, but I don't know how long the 3202 method takes to execute. It's best to arrange things so that only one cog sets a variable, then one or more other cogs reads it. There are other ways for two cogs to communicate that don't require locks (semaphores), but you can use locks if you want.
  • Sigma XSigma X Posts: 38
    edited 2010-10-13 07:02
    wait i'm using two cogs ok I think I got what i'm doing wrong
    I'll post the new code soon
  • Sigma XSigma X Posts: 38
    edited 2010-10-15 11:02
    OK I decided to get 12 Blocks to make programming easier
    and it is but I have one problem the propeller isn't recieving the configuration
    it open the port but could not recieve config does any one have any tips?
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-10-15 11:26
    Hi Sigma X,

    same as always: please provide a DETAILED description of what you have tried so far

    which propeller-board?
    what kind of power-supply?
    what kind of serial connection?
    what did you do install in which sequence?

    what is the EXACT message that you do receive?

    best regards

    Stefan
  • Sigma XSigma X Posts: 38
    edited 2010-10-15 11:52
    parallax education kit (breadboard)
    9v battery
    usb connection
    I installed 12 blocks trial to experiment around before I buy

    the error messages is:
    Cannot connect to Propeller

    DETAIL
    Unable to recieve configuration

    Timed Out
    COM:3 opened port, but could not recieve configuration

    TIP
    Verfy that your device is well connected and has a good power supply (checked)
    Verfy that your your program's clock settings match your hardware (checked at 5 Mhz)
    Verfy that your vp. share at the start of your program (???)
  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-15 12:36
    The message means exactly what it says. The Propeller Tool cannot establish a connection with the Propeller. 90% or more of cases where this happens is due to one of two things:

    1) The Propeller is not powered or not adequately powered. The Propeller must be working. It doesn't need the crystal for downloading.

    2) There's something wrong with the serial connection. Most commonly you might be using a USB to serial adapter that doesn't properly implement the control lines like DTR. Most adapters that use the FTDI chips work. You have to have the manufacturer's driver installed. The default Windows driver doesn't work for downloading.
  • Sigma XSigma X Posts: 38
    edited 2010-10-15 15:18
    Thanks Mike I'll try removal of the crystal
  • max72max72 Posts: 1,155
    edited 2010-10-16 04:32
    If you open the parallax propeller tool, and press F7, can the program detect your propeller?

    Massimo
  • Sigma XSigma X Posts: 38
    edited 2010-10-17 16:15
    The propeller tool works fine it detects the propeller and also runs programs also
    but what I can do is get the code on 12blocks and run them in the tool which works fine
    but I have no schematic of the demo board to know which pins do what
  • Sigma XSigma X Posts: 38
    edited 2010-10-17 22:06
    I didn't get 12 blocks to run the way I want but I did get the code finished
    and I must say the results are quite good I just may order 12 blocks it's simple quick and easy to program although more blocks are needed to give the user more to work with this is still a amazing program
Sign In or Register to comment.