Pages: [1] 2   Go Down
Author Topic: Million-and-one noob q:s about Programmers, Programs, Programming and Pragmatism  (Read 12604 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

tl;dr - scroll down

Basically I want to start programming microcontrollers. My final plan is to do a take on the drones America uses to kill people abroad without consequence, using no weapons, no killing, a remote car, and using the Internet instead. So basically no resemblance whatsoever smiley

I've been researching for some days now but have reached no conclusion whatsoever of what this Arduino stuff is about.
Can someone explain what the Arduino IDE is all about? Mind you, I will use exclusively C for my initial stage of the project, do you code in C in the Arduino IDE? No information is available on this. All the code I've seen uses some sort of setup-loop-scheme that I don't want to get involved in.

My earlier projects include context-switching "kernels" in C on an AVR Butterfly, assembler-programming of the same kind on a MIPS-emulator and a remote controlled car (without the remote controlling) that follows a line, black tape on the floor, using LEDs and recievers and an AT90CAN128 Olimex board. There were no "Olimex IDE"'s back then? So what's the deal?

In the case of the AVR Butterfly I used windows, AVR Studio (or atmel studio whatever) and the AVRISP MkII.
In the case of the AT90CAN128 I used ubuntu, Code Blocks and some programmer for the board, JTAG-something not sure.

tl;dr starts here

Questions:

How do I connect the (for instance) Arduino Pro Mini 3.3V to my computer? If I want to use Atmel Studio (windows)? If I want to use Code Blocks or something with AVRDuDe I presume (linux ,or unix och whatever)? Can I use the AVRISP MkII? If so, how do you plug it in? What's the difference between that and the FTDI Basic Breakout?

What is a bootloader? I've never used it before, not consciously at least. What does it do? What's it tied to, who makes it? Atmel, Arduino, Sparkfun?

What language do you use in the Arduino IDE? C? Some sort of blend? Do you use Atmel-datasheets at all, interrupts and pwm-registers etc? Is the arduino IDE better than writing C in Atmel Studio for instance? Does it simplify things or obscure?

So many questions.. Would be grateful if you answered anyone of them, thanks in advance

~tck
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 52
Posts: 1731
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote from: Tickstart
My final plan is to..
So that would make you some potential terrorist.
Good luck with that.

So you're a great coder already and are now considering to start over or what ?
I guess you would understand RTFM then..
How about clicking the Learning and Reference links in the banner you see on top of this very page ?
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mmm, gotta love the snideness on this forum smiley

Nope I'm not planning on committing any terrorist acts, altough it's wholesome of you to deem America as terrorists (:
Niether am I very experienced or proficient at coding, as the title says, n00b. I just can't find any straight answers to my questions.

Are you as ignorant as me or do you just refuse to tell me? If there are any stupid or weird questions then please clarify why so, these particular boards are a new experience for me.

cheers!

~tck
« Last Edit: January 11, 2014, 05:04:08 pm by Tickstart » Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 52
Posts: 1731
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Me being ignorant would mean not replying at all.
Arduino is for a large part about learning.
To do so, you can ask questions.
If the answer is already available and not too hard to find, you will be directed to that answer.

Wikipedia can help too:
Quote from: wikipedia
Integrated development environment, a software application for software development
« Last Edit: January 11, 2014, 05:31:26 pm by MAS3 » Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27434
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Questions:

How do I connect the (for instance) Arduino Pro Mini 3.3V to my computer?
Use an FTDI Basic to connect USB.
Quote
If I want to use Atmel Studio (windows)?
Use AVR ISP MKii, connect to SCK/MISO/MOSI/Reset pins with breakout cable from the MKii's 2x3 header.
Quote
If I want to use Code Blocks or something with AVRDuDe I presume (linux ,or unix och whatever)?
I don't know what Code Blocks is, I've only been using the IDE.
Code:
Can I use the AVRISP MkII? If so, how do you plug it in? What's the difference between that and the FTDI Basic Breakout?
Yes.  See above.
MKii programs memory directly via the SPI interface pins.
FTDI Basic uses the bootloader to move code into flash memory.
Quote
What is a bootloader? I've never used it before, not consciously at least. What does it do? What's it tied to, who makes it? Atmel, Arduino, Sparkfun?
Bootloader interfaces with PC to receive data and store it in flash memory. If data is received, it starts the existing sketch.
Atmel datasheet includes a bootloader example. Arduino/Sparkfun/Adafruit/Nick Gammon/others have written them.

Quote
What language do you use in the Arduino IDE? C? Some sort of blend?
C++. There are libraries, macros, functions available so you don't need to rewrite them.

Quote
Do you use Atmel-datasheets at all, interrupts and pwm-registers etc?
Yes.
Quote
Is the arduino IDE better than writing C in Atmel Studio for instance?
Depends.  I can't stand waiting for Atmel Studio to open up, so I don't use it.
Quote
Does it simplify things or obscure?
Yes and no.
I'll use digitalWrite sometimes, but if I'm concerned about speed I'll use direct port manipulation.
Same for SPI.transfer( ) of data, I'll write at lower assembly commands if I want it really fast.
Serial comm's with the PC? I'll use Serial.read & serial.print commands all the time mostly for debugging, then comment them out for the final embedded program.

As for your dislike of setup, loop, etc. you can always rewrite main.cpp (main.h? main.c? one of those) to not call them out.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks man, I've glanced over most material I've come over, didn't really read the wiki page all that carefully either.

Quote from: wiki
As the Arduino platform uses Atmel microcontrollers, Atmel's development environment, AVR Studio or the newer Atmel Studio, may also be used to develop software for the Arduino.

Right, so I figured, but then how do I connect it? MkII or FTDI? I really have tried to find an answer.

Ok I read up on the bootloader (I did search the archices before, must've skipped that part), it's only relevant when using the Arduino IDE if I'm not mistaking.

Yeah so that basically rules out the FTDI BB? I guess so, but I'm still not sure how to connect the Pro Mini to the AVRISP. This does the trick? (: Just need to find the ISP specs and schematics too..
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If I want to use Atmel Studio (windows)?
Use AVR ISP MKii, connect to SCK/MISO/MOSI/Reset pins with breakout cable from the MKii's 2x3 header.
Thanks a bunch!! I'm not exactly sure what this means as of yet but.. Will keep for reference!

Quote
If I want to use Code Blocks or something with AVRDuDe I presume (linux ,or unix och whatever)?
I don't know what Code Blocks is, I've only been using the IDE.
Code Blocks is just another IDE smiley-wink

Quote
What language do you use in the Arduino IDE? C? Some sort of blend?
C++. There are libraries, macros, functions available so you don't need to rewrite them.
Can I look up their definitions if I want to use them in my own project outside of the Arduino IDE?

Quote
Is the arduino IDE better than writing C in Atmel Studio for instance?
Depends.  I can't stand waiting for Atmel Studio to open up, so I don't use it.
What do you mean? smiley-grin You're that intolerant to load times? x) Get an SSD smiley-wink

Anyway, thanks guys, you've been very helpful  smiley-kitty
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 52
Posts: 1731
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote from: Tickstart
Thisdoes the trick?

Not really.
See the remark there:
Quote
Note that this chart is for the DIP-package chip. The Arduino Mini is based upon a smaller physical IC package that includes two extra ADC pins, which are not available in the DIP-package Arduino implementations.
Go to the product page, and find the pro mini.
You will find schematics and all other information.
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27434
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Atmel Studio will need to use an ISP programmer - connect the AVR programmer header pins to the board -

If there's no header, such as the promini's, then you need 6 wires to from the header to Vcc, Gnd, Reset, D13, D12, D11 for programming.
You can find the header signal locations on the Uno schematic.

Atmel Studio would take minutes to start up vs 30 seconds for the IDE.
Not really being a programmer, I have found the IDE to be sufficient for all my projects over the last 3+ years.

Yes, you can look up the code for the various libraries, etc. They're all included in the IDE files.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 76
Posts: 2247
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As for loop and setup, there is no need to re-write main.h/.cpp if you use the IDE or .cpp files in another compiler. C++ supports function overloading so you can simply provide your own int main() in your local files.

I have started an article on using int main() in relation to the IDE: http://arduino.genx.biz/FAQ/content/2/2/en/can-i-use-int-main-with-arduino.html
Logged


Canberra Australia
Offline Offline
God Member
*****
Karma: 11
Posts: 518
Hardcore Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Mmm, gotta love the snideness on this forum smiley
~tck
I think that if you come here to this forum and start being a bit of a, dare I say it, smart arse with provocative comments like
Basically I want to start programming microcontrollers. My final plan is to do a take on the drones America uses to kill people abroad without consequence, using no weapons, no killing, a remote car, and using the Internet instead. So basically no resemblance whatsoever smiley

that you might expect a mixed response. This isn't Facebook  smiley-evil
Yet despite this you are still offered help and advice so to continue in this vain have a look at this
http://sourceforge.net/projects/arduinodev/
Logged


SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6806
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Code Blocks is just another IDE
"Arduino" is also "just another IDE", plus a set of libraries (sorta like  ASF, only at a different level of abstraction.)

Quote
Can I look up their definitions if I want to use them in my own project outside of the Arduino IDE?
Yep.  The IDE won't automatically look them up for you; it's pretty minimalist as IDEs go.  But there's the Arduino web site "reference page", and all the source code is buried somewhere in the in the code you downloaded (and also on github, if that's easier.)

Quote
then how do I connect it?  MkII or FTDI? I really have tried to find an answer.
MkII is a programmer, so it would connect to the ISP programming connector.  FTDI things are USB Serial ports, suitable for talking to the bootloader.  For the former, you'd use the "upload using programmer" option, for the latter, just "upload" (in the Arduino IDE.)  For other IDEs, you would have to configure them differently depending on which one you were using.

Quote
Ok I read up on the bootloader, it's only relevant when using the Arduino IDE if I'm not mistaking.
A "bootloader" is generally a mechanism for loading code over an "arbitrary" interface, rather than the specific programmer interface implemented by the chip.  Code running in the chip implements the interface, and "self programs" the flash.  In the case of the arduino chips, the interface used is an Async Serial interface ("UART")  In theory, you could set up Atmel Studio with an "external programmer interface" that use the AVRDude application, and program Arduinos over serial interfaces using the bootloader, instead of requiring a real programmer.  (This is exactly what the Arduino IDE does.)  The elimination of the cost and complexity of separate programmer hardware is one of the "features" of Arduino.  Most Arduino boards have the standard atmel-defined 6-pin ISP programming connection, so you can use them with all sorts of Atmel and third party hardware.  (However, the Arduino HW interferes with "debugwires", and few arduino boards have JTAG connections (even if they use a processor that supports JTAG.)

The Butterfly was one of the first Atmel Dev boards to have/support a bootloader, BTW.  I'm surprised you didn't become familiar with the concept when you were working with it.  The concept and code (for butterfly) was described in Atmel App Note AVR109  (the Arduino bootloader is somewhat different.)

Atmel Studio 5 was about 2.6GB of code (for windows.)  (I should try that again with 6.1...)  Arduino is about 350MB; they use basically the same C/C++ compiler (avr-gcc) (AS has a newer version.)
( http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=116011&start=all&postdays=0&postorder=asc )
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This isn't Facebook  smiley-evil
Yet despite this you are still offered help and advice so to continue in this vain have a look at this
http://sourceforge.net/projects/arduinodev/
Granted   smiley-red
Thanks for the tip with Code Blocks, The AVRISP MkII is expensive as all hell (like 70 bucks, yeah I don't live in a tax haven precisely..) so I was considering the Pocket AVR Programmer from Sparkfun, but that seems to be limited to 5V-stuff, I'm interested in the 3.3V Pro cause I can use a Li-Po with that one smiley-sad
I have no hardware at all at this point, I'm just speculating. So I'm open for suggestions! smiley-surprise

there's the Arduino web site "reference page", and all the source code is buried somewhere in the in the code you downloaded (and also on github, if that's easier.)
Cheers, might prove useful.

The Butterfly was one of the first Atmel Dev boards to have/support a bootloader, BTW.  I'm surprised you didn't become familiar with the concept when you were working with it.  The concept and code (for butterfly) was described in Atmel App Note AVR109  (the Arduino bootloader is somewhat different.)
This was my first experience with microcontrollers, for some labs in a realtime systems course at university, so I basically just concentrated on the assignments, the AVRISP worked just fine  smiley-roll-sweat Could've sworn I've seen this document before though...  smiley-red

Atmel Studio 5 was about 2.6GB of code (for windows.)  (I should try that again with 6.1...)  Arduino is about 350MB; they use basically the same C/C++ compiler (avr-gcc) (AS has a newer version.)
( http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=116011&start=all&postdays=0&postorder=asc )
If you read what I said just above this, with my considerations to batteries and voltage and AVRISP vs Pocket AVR Programmer (like, USBtinyISP or something-rather whatever it was called? Open source stuff), can you give me some suggestions on a good setup..? I've heard that you can get Sparkfun's Pocket AVR Programmer working with Atmel Studio, which is what I'd rather use as far as IDE's are concerned.. But then again, that's designed for 5V, whereas the AVRISP is dynamic in that respect.

Anyways, thanks for the support!
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 130
Posts: 8626
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

FWIW I use AS6.1 (with the Visual Micro plugin) now for most Arduino code writing (not that I've done much lately), it works just fine and downloads to the bootloader the same as the Arduino IDE, no extra hardware required.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino IDE is such a horrid code editor (IMHO) that I avoid it as much as I can.  I use Atmel Studio 6 and plain AVR C most of the time now, but the Arduino platform (plus all the third-party libraries for every device under the sun) is undeniably fast and convenient to get from idea to proof-of-concept.

I'm working on my own abstraction framework because I like being able to choose from a wider selection of AVRs.  I know there are Arduino "cores" available for a lot of them (probably all the ones I use even), but the Wiring / Arduino core was written to fit a particular era of micros... trying to impose it upon Tinys and larger Megas is not particularly elegant.  (Again, IMHO.)  No idea if my approach will be any better -- Atmel hasn't made it easy to move code around their portfolio -- but I thought I would give it a try just for kicks.
Logged

Pages: [1] 2   Go Up
Jump to: