Results 1 to 7 of 7

Thread: Help With Micro Controllers!

  1. #1
    Registered Smertrios's Avatar
    Join Date
    Mar 2005
    Location
    USA
    Posts
    248
    Downloads
    0
    Uploads
    0

    Help With Micro Controllers!

    Years ago I purchased a NerdKit with the intent of learning electronics and programming for microcontrollers. The time is NOW (didn't do much with it back then except go through a very brief tutorial).

    Its taken me the better part of a day trying to read the details about my ATMEL microcontroller and I am no better off there is just a ton of new information for me to try and take in.

    The reason behind the need to learn electronics was that I wanted to make a closed loop stepper driver believing the low speed holding torque to be superior to most servos.

    From when I bought the NerdKit I have a prepared stepper with a 300cpr encoder on it. I hooked the AB leads to my ATMELs PC5 and PC4 pins. After browsing some souce code I found out how to set those pins to use the "pull ups" (IE: so I could use those pins as inputs).

    The code for converting the graycode into either a +1 or -1 on a counter is non-trivial and super fast. I estimate that the chip running at 14mhz could keep track of a motor spinning well over 35,000 rpm! But thats a noobies chat and its entirely possible I over-estimate how fast the signal wire inputs can be read.

    In any case that was hacked together and I dont yet have the knowledge to accomplish much else. What I want is a step motor driver controlled by the IC so that it can prevent missed steps.

    BTW I am not a noob programmer just new to microcontrollers and the low level documentation. Anyone have suggestions on what I can do to get upto speed a bit faster? I will be out of time or ambition soon if I dont get help =/


  2. #2
    Registered
    Join Date
    Feb 2009
    Location
    usa
    Posts
    4,018
    Downloads
    0
    Uploads
    0
    Don't know how old your kit is, but about 2 years ago I bought an arduino kit. Lots of how to around, lots of free programming examples, even with stepper motors. Took me about a day to kinda figure it out.


  3. #3
    Registered apache405's Avatar
    Join Date
    Jan 2007
    Location
    USA
    Posts
    197
    Downloads
    0
    Uploads
    0
    Read the datasheet for your chip, I've made some VERY stupid mistakes (wired an LPC2148 into boot loader loop) because I didn't read the datasheet.

    All of the Arduinos are based on Atmel products, and if you're mildly experienced with programming, the Arduino IDE will annoy you to the point of using an external editing tool for the code (like Notepad++). That being said the Arduino has a lot of merits for being easy to use and get started with. The library set they've put together is decent for the beginning MCU programmer, and makes thing really easy for someone coming from a desktop programming environment. Some of the libraries are bad (they are bloated or buggy) but they are getting better with time.

    Are you using interrupts to service the encoder or just sampling it as the main loop iterates?
    -Jeff


  4. #4
    Registered Smertrios's Avatar
    Join Date
    Mar 2005
    Location
    USA
    Posts
    248
    Downloads
    0
    Uploads
    0
    Right now I am using the mainloop but want to use interupts so I can use the LCD display without missing any graycodes (LCD takes a relatively long time to update).


  • #5
    Registered apache405's Avatar
    Join Date
    Jan 2007
    Location
    USA
    Posts
    197
    Downloads
    0
    Uploads
    0
    which model chip are you using?
    -Jeff


  • #6
    Registered Smertrios's Avatar
    Join Date
    Mar 2005
    Location
    USA
    Posts
    248
    Downloads
    0
    Uploads
    0
    ATMEGA168


  • #7
    Registered apache405's Avatar
    Join Date
    Jan 2007
    Location
    USA
    Posts
    197
    Downloads
    0
    Uploads
    0
    I'm assuming you're using STK500/similar to program the chip? The 328P has 2x the program memory is shipped with all Arduino Unos.

    How many bits of grey code do you have from your encoder? I'm guessing more than 8, since 255 is the max number for an 8-bit line.

    The pesky part about the 168/328 chips are that there are 2 external interrupt lines, so you're going to be forced into using a timer based ISR to service the encoder.

    Have you considered upgrading to an XMEGA series chips? They are much faster (32MHz from the internal clock generator) and they have more UARTS and USARTS on them. The only downside is they are 3V3 logic levels versus 5V like the 168 is. The most important feature the XMEGA has for your application though is that they have the ability to use most, if not all of the GPIO pins for external interrupts.
    -Jeff


  • Similar Threads

    1. Newbie- Used Controllers
      By terryd999 in forum Controller & Computer Solutions
      Replies: 5
      Last Post: 01-10-2011, 11:06 PM
    2. CNC Controllers
      By dolphin2010 in forum Want To Buy...Need help!
      Replies: 0
      Last Post: 07-26-2010, 07:49 AM
    3. CNC Controllers
      By ronald44 in forum Mechanical Calculations/Engineering Design
      Replies: 1
      Last Post: 11-14-2006, 08:00 PM
    4. use for controllers
      By don_harby in forum Fanuc
      Replies: 3
      Last Post: 03-02-2006, 09:14 AM
    5. Controllers ?
      By Ken_Shea in forum General CAM Discussion
      Replies: 23
      Last Post: 05-25-2004, 12:51 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.