New to programing

Electronics Computer Programming Q&A
Post Reply
amelecsol2000

New to programing

Post by amelecsol2000 »

In my studies I am just now getting into programing. Starting with the Basic Stamp, and comming up is the 68HC11.

From what I see it seems that every different microcontroller has a very different program language.

My question: Is there a universal program or do I have to learn a different one for every different microcontroller?

If so then, is there one in particular I should pay attention to, such as the 68HC11 or the Basic Stamp?
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Post by Engineer1138 »

Most of the currently popular microcontrollers are programmable in C. The BASIC stamp is just a PIC that runs a BASIC interpreter; the underlying PIC probably has a C compiler available.
bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Post by bodgy »

There was an attempt at such a beast, I think it was called UMPS, but I don't think it progressed very far.

However, if you are willing/able to learn 'C', structured basic, Java, then you can get very close to one language for many uC's.

Unforutnately, there are not only differences between 'C' compilers, but also of course different instructions available depending on the capabilities of the uC in question. One reason why you'll find programmers tend to stick to one companys product.

You'll get a better match in syntax variabilities, if you find one of the commercial compiler companies who produce compilers for a variety of uC's. Sadly, this will mean paying for a compiler rather than using one of the free offerings from a hardware manufacturer.

Having said that, once 'C' etc has been learnt for one uC, then porting a program or writing a new program for a different flavour of uC, is not that hard.

Colin
On a clear disk you can seek forever.
amelecsol2000

Programming in C

Post by amelecsol2000 »

I thank both of you,
I am willing and able to learn C , and thats what I am going to do.
I have been to verona web site and will be there again.
Are there any other helpful web sites or books that you know of for the beginner?

Again , thank you
bwts
Posts: 229
Joined: Tue Jun 11, 2002 1:01 am
Location: britain
Contact:

Post by bwts »

Hi

I agree with all thats been said so far but if you are going to get into microcontrollers in a big way it would be a good idea to have a look at assembly language.

Although the array of assembly languages is mind boggling, they do give you a much better feel for the hardware involved and give much more efficient code.

Once you get to grips with programming and the logic involved with such low level languages it usually isnt that hard to pick up other assembly languages.

But yeah C is much easier :grin:
"Nothing is true, all is permitted" - Hassan i Sabbah
amelecsol2000

New to Programming

Post by amelecsol2000 »

Thank you,

I am moving forward.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

bwts wrote:Hi

<snip>
But yeah C is much easier :grin:
Yeah, he he, but i like to know what my machine is doing for
every single instruction cycle. Unfortunately this means i cant
use a high level language unless i investigate every single
function call it makes. I guess that's possible though.
I also thought of maybe making my own higher level language
that would compile into assembler. This way during program debug
the assembler code could be reviewed which might show an extra
instruction or nop or something like that that causes a problem in
the overall software.
LEDs vs Bulbs, LEDs are winning.
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Post by philba »

Actually, Al, C is pretty decent for that (low level control). While ASM is clearly the best at total control of the uC, with C you can usually get an assembly listing so you know what's going on. Yeah, as an ASM programmer, sometimes you cringe at the code but unless you run out of space or the code sequence has very specific performance reqs, it is livable.

Of course, the advantage of C is that it's pretty well universal and give you a much higher level of productivity. Especially for some one with out years of ASM experience. In my case, I have 30 years of experience writing both C and ASM on numerous processors. Most of it was systems SW (OS, media, ...). I'll take C in a heart beat because I can bang out the code very fast. If necessary, I can drop to ASM for speed or space needs. In fact, when I target ASM code, I often use C as the prototyping tool - get the algorithm right and then rewrite in ASM.
bwts
Posts: 229
Joined: Tue Jun 11, 2002 1:01 am
Location: britain
Contact:

Post by bwts »

Like philba I usually do prototype code in C first.

Then spend the rest of the time trying to work out why my ASM version doesnt work LOL.
"Nothing is true, all is permitted" - Hassan i Sabbah
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Post by philba »

yeah, especially on the PIC where you have to use double inversion logic to do jumps using the skip instructions. I sure wish the 16F series had jump-not-equal, jump-less-than and so on. I hate the idea of bit testing the condition word and then skipping over the jump instruction based on the opposite condition.

Even if it's hideously inefficient, I usually stay with the C code.
Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests