Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Assembly Language?! F#$^K that! How do I learn this???

Status
Not open for further replies.

elliottearls

New Member
:twisted: Hey I bought this book "Easy Pic'n" to try to learn assembly. And let me just say that I think it's the worst book ever written. I've read it like 5 times and realize that I don't even undersatnd the frist 30 pages.

How Am I supposewd to learn assembly? Is there a goood resource.


IF you want to program PIC's to work with MIDI. I was told that you better do it in Assembly. Because something about how PIC BASIC and C are "too Slow"


any thoughts?
:evil: [/b]
 
off all the assemblers in the world, pic assembler is one of the simplest. But you need a good source for learning...
Do you have any expierience with computer programming in general? if not, you should start with that first...

you can also search for tutorials on the net (google...)...and visit Nigel's site.

If you get a grip on the basics you could try looking at a working program (lots of examples on the net) and try to figure it out...
and, ALWAYS have the datasheet for the relevant pic handy.

I agree with the fact that for small devices (in terms of available memory and processing power) like pic's high level languages like basic and C are way too wastefull. Simple programs get blown up in size and run at questionable speeds.
if you go to the 18F series of pic's then a C compiler becomes more realistic as it has an C compiler optimized instruction set.
 
and if you are working with microcontrollers u should have a basic knowledge of assembly even if u are going to program in a high level language. because high level languages are an abstraction of assembly.

and the code generated by an assembler is more memory efficient than the code generated by a high level compiler.

and the most important issue is that C compilers are not available for free. they cost alot of money.

if u have a look around on the internet and in electronics magazines u will see that the code provided is usually in assembly. thats because a majority of people use assembler for PICs.

but it is a fact that when u start programming in assembly u feel alot of difficulties and especially if u have an experience of programming in high level languages. it happened to me too. i first learnt C and then C++ at university. but now ive started using assembly for PIC and sometimes it ends with me pulling my hair (Ouch).

but it isnt that bad after all. if u are programming a simple architecture like PIC assembly wont be that bad. i mean at least its not gonna be bad as assembly programming for the x86 processors.

good luck
 
BASIC STAMP is an interpreted hardware device which is very slow. BASIC and C compile to assembly. It is rarely the most efficient code in terms of space or speed for any given task, but it is easy and portable. Assembly instructions are different for different parts, so you have to learn new bits of language for different parts or "forget" ones which aren't implemented.

All emotional attachments to assembly aside, a prime question is, do you NEED to get the extra speed/compactness of handwritten assembly? A PIC18 can give you 10,000,000 instructions/sec, and a 32k code space. I'd have a very hard time believing a MIDI application could not work within this space just because of the code overhead from the C compiler.

You can get "trial" versions of C compilers from HiTech.
 
yes in a way u r right. after all its said that a single line of C code is equivalent to a hundered lines of Assembly code.

i think it all depends on the person. its all a matter of choice. u could get a free trial from HiTech or somewhere else and program PICs better than others who are messed up with assembly. but then again, this might not be true for every case. it all depends on the choice.

this topic has always started heated debates on various forums. so i say that u should try everything. try a little bit of assembly, then C and if u feel the need also try PICBasic. then see for yourself what is right for u.

kool 8)
 
I still think it depends mostly on the platform and appication.

if you have a small project with a 'F84 you want assembly, it will be small and simple anyway, and a C compiler will fill a 'F84 in no time...

but if you're dealing with a highly complex project, that requires a 65K PIC18 anyway, then your better off using C. The larger pic capabilities will let you, and because of program complexity you want to..
 
samcheetah said:
yes in a way u r right. after all its said that a single line of C code is equivalent to a hundered lines of Assembly code.

Hardly! Well, some lines of C can certainly involk 100 lines (or more) of assembly... particularly if you just ask for "x=cos(y);". That in itself implies efficiency rather than inefficiency! You wanna write out all those lines of assembly instead?

But, yes the code efficiency for any particular job is generally worse than assembly. How much may vary by how badly you write C. You can write C in a way that's close to assembly and usually the compiler can be pretty straightforward.

I'm guessing it's like 2 or 3 times larger... possibly more. Not 100. Thing is, if it's a small project, you won't care. There's more space around. On the other hand, if it's a large project, I don't think I'd ever get it done if I had to write tens of thousands of lines of assembly. Things always come up where things have to change, too. I keep finding a variable's the wrong size, for example. In C, with some luck, you can just change the size in the declaration and you're done. Then you want to reuse that assembly code on a different PIC and it's not going to fly.
 
Hello all,
Nigel's site is a good site for a newbie and also there are a few E-Books available. Have a look at the following site. They have a free E-Book you can download and it is quite helpful.
**broken link removed**
Hope this is of help to you.
Cheers.
Barry.
 
Status
Not open for further replies.

Latest threads

Back
Top