Connect with us

Need help (Atmega328)

Discussion in 'Microcontrollers, Programming and IoT' started by Xeuscryste, Jul 18, 2012.

Scroll to continue with content
  1. Xeuscryste

    Xeuscryste

    52
    0
    Jun 20, 2012
    Starting a new thread because this is a new topic.

    Ive got a atmega328 and a ttl adapter to hook it up to pc via USB port, ive never had any experience with microcontrollers.. i want to make a single led do things like flash, just for a test, what program do i use and what pins do i hook the led to on the atmega?
     
  2. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    You use an AVR compiler of your choice that supports your AVR, and you write the code to toggle the appropriate pin... Most hobbiest use the WinAVR suite... You hook the LED to any digital pin (based on your code) on the AVR and toggle it high/low... The other leg of the LED can be attached to ground or the positive supply through the proper limiting resistor... This will work fine for one LED, but any more and you will need to use a transistor on the AVR pin as to not overload it's source/sink values...
     
  3. Xeuscryste

    Xeuscryste

    52
    0
    Jun 20, 2012
    Does it matter what bootloader i have on my atmega? when i bought it they said it had arduino uno bootloader on it. also can you give me the codes to use just to get me started to control the LED, as im a beginner.
     
  4. Xeuscryste

    Xeuscryste

    52
    0
    Jun 20, 2012
    Also i have a 16mhz crystal what pins do i connect that to?
     
  5. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    Maybe, with the Arudio bootloader you can pop it in an Arduino and use the Arduino software suite to program and burn it... But, it's not necessary if you take another avenue...

    And yes I could give you the codes to do it, but as I have stated previous (in your other threads) it's clear you are in well over your head and you need to step WAY back and start to learn to crawl before you attempt to walk, the code it totally useless to you at this point, you need to gain more knowledge of the hardware before it will be of any use... The official Ardunio forums would be a great start, as would investing in an Arduino if that is the route you want to take... I'm 100% sure that there are dozens of blinky LED 'sketches' in those Arduino forums you can play with once you get an Arduino...

    The OSC pins with the proper, capacitors... Get that datasheet for your AVR and start reading, it might be a boring read but it should enlighten you on some things and it's necessary if you want to learn to crawl let alone walk or run...
     
    Last edited: Jul 18, 2012
  6. Xeuscryste

    Xeuscryste

    52
    0
    Jun 20, 2012
    Ok, I can't buy an arduino as I already have spent enough money on this stuff I have an atmega328 and a USB to rs232 module that connects to the pc. Now, I have the arduino Uno boot loader installed on it by the seller, do I have to write another boot loader on it to be able to ttl commands? Also how does the at mega recognize these codes? ALL I want is to send a few commands from pc to control two servos or dc motors one left and right at 180 C and the other forward and back.. Other than these forums I wouldnt even know where to start.
     
  7. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    The bootloader simply offers an alternative method to program the chip (not using a traditional programmer) it does not do anything more than offer this alternative method of programming...

    You as the programmer write code that gives the chip the power to do what you desire, the chip itself it blank right now it won't do anything, it's like a computer with a freshly formatted hard drive... It's a blank slate right now, you have to fill that slate up with a series of commands before it will do anything...

    I know this might be hard to swallow, but that is equivalent to a newborn baby saying "All I want to do is learn how to ride a motorcycle at 200mph, around a twisting track" Do you now get why I have said multiple times that you need to learn to crawl before you can walk or run? You simply can't skip from nothing to expert, you have to devote the time to learn and crawl up the ladder...

    Since you have the AVR chip and have already started down that path, you should get an Arduino, and then start reading any and ALL newbie Ardunio forums and tutorials you can, read, read and then read some more... It's not going to come to you overnight, in fact it will take years for you to actually get good at it, although you can follow a tutorial and get some blinky lights after a few hours... But to actually get enough knowledge behind yourself to accomplish the task you want to do is going to take a lot of work, unless you find someone to do it for you...

    I can't even imagine what it's like for a newbie, I started programming computers as a child back in 1979 at the age of 8... I was hungry for knowledge and wanted to make my Atari 800 at home do something that I programmed it to do, it was so long ago I don't remember half the struggles... But, I know I spent hundreds of hours a week learning... I remember staying after school every day and heading to the principles office where the only 'student' computer resided, and students could sign up to use it after school (very few did except me) I spent hours plugging away on that Apple II (no real help as the principle and school staff were more clueless then I) until the principle kicked me out each day when he wanted to go home for the day... I remember in high school when the computer class teacher (promoted match teacher) would come to ME for advice when he couldn't figure things out...

    I'm not saying it will take you a lifetime, but I will say that you NEVER ever stop learning, and you need to crawl well before you walk and even when you know how to run, you will trip and fall and have to learn all over again... Don't expect this to come to you overnight...
     
  8. Xeuscryste

    Xeuscryste

    52
    0
    Jun 20, 2012
    Thanks for all the advise I appreciate it but I just ruined my chip with solder, now I have to wait like a week to get a new one, however I have this motor driver chip, can that be used on its own?
     
  9. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    [​IMG]

    Xeuscryste, I have said it multiple times now, you are in over your head... Take many, many steps backwards and start again, you simply have to accept the fact that what you are attempting to do is well beyond your skill level or understanding at this time...
     
  10. Xeuscryste

    Xeuscryste

    52
    0
    Jun 20, 2012
    You obviously misread my last post, I already realize I'm in over my head, no need to act so superior about it..
     
  11. donkey

    donkey

    1,289
    56
    Feb 26, 2011
    prctise on easy stuff first. breadboard stuff, then practise your soldering technique. and maybe pcb making. feel free to ask questions but start at the beginning and work up to micro controllers, or buy something like picduino/arduino and just use them to experiment on for now, they have screw terminals and breadboards that simply click onto the existing board making life easy.
    I wish you the best.
    and as for superior I must point out that coca cola's feedback was wise, how much did you spend so far? if you wreck too many more IC's or other components then this will be a very costly excercise. as well as time consuming as you need a week to get the critical components.
    best of luck
     
  12. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,411
    2,779
    Jan 21, 2010
    Perhaps you need to show us what you did and we can give you some tips on soldering.

    You don't want to keep breaking stuff.
     
  13. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    No, my reply was to your last post... Why were you soldering the AVR chip, to what purpose? If you have been listening to what I have been saying to you, what where you hoping to accomplish with solder? And why after what I have been telling you would you jump out and get another chip, a chip that for all intents and purposes (as I have been telling you) is beyond your means and skills to work with at this point?

    Also as Steve may have eluded to you, you probably didn't wreck the chip at all, but again because you are in well over your head you are haphazardly jumping to conclusions and attempting to run forward with no running skills or direction...

    Save your money, don't buy another chip at this point as you have nothing to use it in or any skills or hardware to make it do anything... Remember when I stated that you should purchase an Ardunio so that you can actually use that chip? This would be a good time to do that, not spend a second round of money on a chip that you can't use yet...
     
    Last edited: Jul 18, 2012
  14. Eng.MG

    Eng.MG

    5
    0
    Jul 19, 2012
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-