using machine language on the arduino

Can I program the arduino in machine language?? if so where can I find a list of machine statements?

Yes this is possible, using the gnu avr-gcc toolchain assembler, or maybe even from the Arduino environnement using inline assembler.

For a list a compatible statements, just refer to the ATMega168 datasheet (the huge file with 375 pages, I don’t think they are in the short edition) available at www.atmel.com. List begins on page 348. Dunno if it’s gotta help, but you’re looking for a file called doc2545.pdf.

Can I program the arduino in machine language?? if so where can I find a list of machine statements?

Do you mean machine language or assembly, because there is an immense difference.

You can use inline assembler within the arduino IDE, the list of assembler instructions is in the ATMEGA168 datasheet on the Atmel website.

If you mean machine language, I beleive the OPCODEs are in the datasheet as well (they are for the PICs which I’m more familiar with), but hand assembling machine code is a very tedious process which, thankfully, I haven’t had to do since the MC6802 days.

The mega168 datasheet has a short list of the AVR assembly instructions at the end, as tehboii said, but for a detailed description you can see:

http://www.atmel.com/dyn/resources/prod_documents/doc0856.pdf

  • Ben

The mega168 datasheet has a short list of the AVR assembly instructions at the end, as tehboii said, but for a detailed description you can see:

http://www.atmel.com/dyn/resources/prod_documents/doc0856.pdf

Thanks for this useful link.

(for paul) You’ll need to use both these documents, the one quoted above for a complete description of each mnemonic, and your µC datasheet as I first answered to know which ones it handles. Not all µC can use all instructions.

Thank you!, Those are the documents I;m looking for.
Years ago, I programmed an 1802 (cosmac elf) via the hex key pad using its unique machine language.
It was a bit tedious but fun. I managed to complete a morse code sender and a tty memory dump and some
other stuff. I enjoyed it although it had a very restricted instruction set.
I did a little bit of z80 machine lang. stuff as well.
Havent done any C yet and look forward to learning.

Paul

Years ago, I programmed an 1802 (cosmac elf)

Oh! A contemporary! Gotta love a micro with a SEX instruction!

Cosmac elf Nostalgia Link

Wow! That was fun. I still have my “ELF” though I havent powered it up for years. It had a pretty good following in its day.
I’m looking forward to the delivery of my arduino (how do you pronounce that?) any day now.

Paull

SEX with an ELF ? :smiley:

That would be uncomfortable I guess.
Actually it was “set X to ??”

That would be uncomfortable I guess.

It depends. With Orlando Bloom as Legolas, I think I would try anyway :smiley:

(Ok, going totally out of the subject)

Oh! A contemporary! Gotta love a micro with a SEX instruction!

I think that goes back a bit before my time.

This is a timely thread though, just recently I was reminiscing about those older architectures with some friends. We have it so easy now. We didn’t even have onboard I/O back then much less memory, UARTS and ADCs :slight_smile:

It does make me feel old though, like the stereotypical walking 5 miles to school uphill both ways.

you must be going back to the altair and its ilk.
the elf had audio out and a rudimentry video chip on board.
Maybe that was the super elf, I forgot (I forget a lot these days).

you must be going back to the altair and its ilk.
the elf had audio out and a rudimentry video chip on board.
Maybe that was the super elf, I forgot (I forget a lot these days).

Actually, I never used an Altair and I’m coming in several years later. Mine was completely scratch-built at the chip level, so to use I/O, I needed an I/O chip which was attached to my busses.

My first “pre-built” computer was an Apple, II. Before that it was all homemade stuff. Even pre-built is something I use loosely since I built my own clone from a kit.

I just got my Arduino in the mail!! I’m so excited ! The environment loaded and seems to work with a few bugs on my HP laptop running Vista. The blink program works. I dont see how to send anything but C code to the Arduino though. Guess what I’ll be doing tonite!!!

The easiest way would be to use the C compiler’s inline assembly, as described in
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#s3

or just to use another editor (jedit rocks) (eclipse rocks, too) and make your own makefile using avr-as as the assembler.

Guess what I’ll be doing tonite!!!

Watching an LED blink at various rates and patterns? ;D

yes, pretty much. That and trying to figure out why I cant compose a program on my computer without a compiling error. I can copy a program and it runs great. I can change numbers and it runs great. If I put in curly braces or parenthesis (from the keyboard) it returns an error. May take a while. I hate Vista.

yes, pretty much. That and trying to figure out why I cant compose a program on my computer without a compiling error. I can copy a program and it runs great. I can change numbers and it runs great. If I put in curly braces or parenthesis (from the keyboard) it returns an error. May take a while. I hate Vista.

I hate Vista too. If adding a curly brace adds an error, paste it here and tell me what you added, I can take a look for you. Your first Arduino should be a celebration of blinking lights, not a time of frustration :wink:

Vista haters please stand up ! please stand up ! [smiley=tongue.gif]

(Do you have room for people of the tired-of-mac-os-x group ? :D)

ok, about your strange-seeming problem : I’ve had some trouble with DreamWeaver (bwaaaaah) which from time to time added characters into PHP which looked like spaces or tabs, but weren’t, and led the interpreter to return meaningless (at first sight) errors. Have you tried taking an existing and working source code, then remove a curly brace and just retype it ?