Previous in Forum: Windows XP Fanatics take note   Next in Forum: Wide-Angle LED Drivers
Close
Close
Close
17 comments
Rate Comments: Nested
Active Contributor

Join Date: Dec 2009
Posts: 17

Embedded C and Microcontrollers

03/21/2010 10:13 AM

Will the embedded c programing differ in the environment in which we develop the program ????? or it is common to all ?? some use ccs, some use mickro c for a pic.... which is best????????????? apart from pic which compiler is used for other Microcontrollers????

can a programmer adapt to all environments

oh my god!!!!!!!

am a kid and I am confused..............

__________________
No man really becomes a fool until he stops asking questions
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#1

Re: Embedded C and Microcontrollers

03/21/2010 6:27 PM

You need a development system and compiler specific to the particular microcontroller you are using.
Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Guru
Hobbies - Musician - New Member Hobbies - Car Customizing - New Member Hobbies - Target Shooting - New Member Engineering Fields - Power Engineering - New Member

Join Date: Jul 2007
Location: FL Space Coast
Posts: 536
Good Answers: 14
#2

Re: Embedded C and Microcontrollers

03/21/2010 11:15 PM

I think that the details of the High level code (C, basic, etc) is more dictated by the compiler that you are using. The different micro controllers typically use simple hex code. I know that the stamp uses basic. Now the vocabulary of the hex commands is usually MCU specific.

Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#3

Re: Embedded C and Microcontrollers

03/22/2010 4:02 AM

To expand on #1.
Differnt families of micro' have differnt architectures, registerset and structures and different peculiarities... .like decrement doesn't set the carry flag if you decremet zero whereas subtracting 1 does (Z86733).
Thus the compiler must be matched to the micro.
Self evidently the hardware must match up too.
Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Active Contributor

Join Date: Dec 2009
Posts: 17
#5
In reply to #3

Re: Embedded C and Microcontrollers

03/23/2010 12:27 PM

If it is so,if I have to work with a microcontroller for a specific application then I should know about its compiler ,architecture, development environment( for Eg. if im choosing pic16XXX then,should i have to know about mikro c,ccs,c51,MBASIC,MPLAB etc.,.???????????)

__________________
No man really becomes a fool until he stops asking questions
Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#6
In reply to #5

Re: Embedded C and Microcontrollers

03/23/2010 12:36 PM

Everything is on a 'need to know basis'. You only need to know the C language and the peculiarities of your particular compiler/linker & development system (usually an ill documented nightmare).
Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Guru
Hobbies - Musician - Engineering Fields - Chemical Engineering - New Member Engineering Fields - Control Engineering - New Member Engineering Fields - Instrumentation Engineering - New Member

Join Date: Jan 2007
Location: Moses Lake, WA, USA, Thulcandra - The Silent Planet (C.S. Lewis)
Posts: 4216
Good Answers: 194
#7
In reply to #5

Re: Embedded C and Microcontrollers

03/23/2010 1:17 PM

Hi prady,

When I got started with uControllers, there were so many to choose from. Because I knew that there were also a lot of programming solutions too, I had to limit myself and decide on a "system".

Of all of the uController projects on the web and in books, they were by far mostly using PIC16F chips. Since I had mostly done Basic programming, I chose the PIC Basic package.

What I use now:

(not an endorsement)

I can program the majority of PIC16s and quite a few PIC18s as well as a few PIC10s and PIC 12s. With the MicroCode Studio Plus I can Debug some PIC models.

I have been happy with this setup for several years.

Mike

__________________
"Reason is not automatic. Those who deny it cannot be conquered by it. Do not count on them. Leave them alone." - Ayn Rand
Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#8
In reply to #5

Re: Embedded C and Microcontrollers

03/23/2010 5:11 PM

Dear prady, I gave you a clear path on how to start, why jump in at the deep end when you can start at the shallow end of the PIC swimming pool and work your way up to what ever level of complexity that you desire?

It would appear that English is NOT your strong point, so the way I showed you would give you a far better chance of learning everything......little by little......and improving your English at the same time....

But the final choice is ALL YOURS!!!

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#4

Re: Embedded C and Microcontrollers

03/22/2010 10:44 AM

If you are just starting, there are several manufacturers who have chips with a built in Basic Interpreter, which makes life really simple, but slows the chip down.

When I say slow, upwards of 4000 instructions per second, depending upon the clock frequency used.....

They are still cheap, except for the Arduino versions which are many times more expensive than necessary.....

Some chips have 40 pins and some chips have many processors (Cogs).....

All you need is a serial or USB interface on your PC and download all the free software.....PICAXE is a great starting place, all the needed software is free and there are also free tutorials and also a Yahoo group.....

If you need considerably more speed later, you can upgrade to chips without the interpreter, but then you need a compiler etc. Sometimes these are also free.....you can also better decide what you want after a few weeks with such a starter version.....of course it may do all you want in terms of price and speed etc., then you don't need to go to a compiler etc..

Its a great hobby.....check these links out:-

http://www.rev-ed.co.uk/picaxe/

http://en.wikipedia.org/wiki/Parallax_Propeller

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Associate

Join Date: Feb 2008
Location: New York
Posts: 54
Good Answers: 2
#9

Re: Embedded C and Microcontrollers

03/26/2010 2:26 AM

If you are not married to PICs, I would suggest starting with an Arduino of any kind.

They have a decent, decently documented IDE which accepts C, and C++ and are relatively fast compared to using BASIC. (I know I know I know.....)

Point being:

It is all open source, so while you get stuff done you can peek "under the skirt" at the toolchain (compiler, assember, linker, Java driven C++ to C parser, etc...) and get a good sense of what a working, semi-professional development environment entails. And an Arduino can be easily programmed to function as an Atmel programmer for other chips thanks to the donated work of a few people.

By the time you are programming uCs with the Arduino you will understand that there aren't clean cut, "nice" answers to most of your questions.

Register to Reply
Associate

Join Date: Oct 2008
Location: South Africa and China
Posts: 52
Good Answers: 1
#10

Re: Embedded C and Microcontrollers

03/26/2010 5:00 AM

Most C code are portable as long as you adhere to the ANSI standard. The only difference between the generated machine codes are the target they intend to run on. As for micro-controllers there are differences between them, and the C complier will have to be specific for the type and manufacturer of the uP. Most compilers come with IDE (integrated development environment) package that makes development easy. Remember there is not only PIC on the market but some 8051 derivatives are much more powerful and have more built-in features than a PIC. See Atmel, Silabs etc. Have a look at www.8052.com

__________________
The best vision is insight - Malcolm Forbes
Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#11
In reply to #10

Re: Embedded C and Microcontrollers

03/26/2010 5:19 AM

Most C code are portable as long as you adhere to the ANSI standard.

I've never really understood this sort of statement...surely it's only portable between identical machines...which isn't portable at all. If the I/O devices or processor chance the code is no good any more.
I'm not trying to start an argument (as your post is excellent) I'm just struggling with the concept.
I mostly write in assembler, but we also use one chip which I program in C with very limited kit...it's a right pain in the ar$e. Like all this stuff, once it all up and running on a developmet kit it's ok. but unless you have some sort of working dev't board/compiler/linker etc the initial configuration with their nightmarish /o/i/j/gawdknowswhat options becoms a nightmare. I find I move from a glossy front end to weird undocumented linker librarian options in about a microsecond.
Whoops, slipped into rant mode... but don't you find the startup time on any new processor depressing? (or does your company buy you decent kit)

Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Associate

Join Date: Oct 2008
Location: South Africa and China
Posts: 52
Good Answers: 1
#12
In reply to #11

Re: Embedded C and Microcontrollers

03/26/2010 5:47 AM

What I mean by "portable" is the source code. In the old days before flash memory and fancy IDE's, I used to write and debug PASCAL code on the PC and then port the source to the microprocessor I was using. These procedures will normally be algorithms that perform a function or some arithmetic calculation. The PASCAL complier on the PC had a good debug feature which the uP did not have. I still do it from time to time now, but with the software and hardware available for uP, debugging algorithms is much easier. IDE and JTAG has made it for me in developing good code in quick time. The current uP I am using has a JTAG interface with built-in "in circuit emulator" and I can stop, start the uP and change any register, memory location, timer, etc. while connected to the PC via the JTAG inteface, and you don't need a development kit, your target PCB is your development kit. H3ll I sound like a salesman without naming the product... sorry.. .

__________________
The best vision is insight - Malcolm Forbes
Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#13
In reply to #12

Re: Embedded C and Microcontrollers

03/26/2010 6:01 AM

Cheers, yeah, I see what you mean.
I have an emulator for the chips I write assembler for and that's fine. I'm just struggling with a cheapskate set up for this one C application (No debug facilities at all!, usual story, small project needed yesterday, develop it quickly of a demo board...next thing you know it's 5 years later and they want to add layers of complexity and unreliability sophistication to the product)
I'm getting older and more cynical/dissillusioned by the minute...
Hopefully I'll go down to 2 days soon and do my own funky thing.
Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Associate

Join Date: Oct 2008
Location: South Africa and China
Posts: 52
Good Answers: 1
#14
In reply to #13

Re: Embedded C and Microcontrollers

03/26/2010 6:07 AM

Life (electronics) is sometimes tough, good luck with your own thing (I have been there, got the T-shirt and hat).

__________________
The best vision is insight - Malcolm Forbes
Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#16
In reply to #12

Re: Embedded C and Microcontrollers

03/26/2010 6:55 AM

Don't say sorry!! It was good and informative.

Maybe you should name the product, we understand you are not financially involved...and its always good to know a viable combination in such areas!

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Associate

Join Date: Oct 2008
Location: South Africa and China
Posts: 52
Good Answers: 1
#17
In reply to #16

Re: Embedded C and Microcontrollers

03/27/2010 9:38 AM

OK, you force me to name the product... Have a good look at the Silabs range of microprocessors and the development aids that they have. The uP are very complex but I have used them with great success. They are sometimes tricky to understand but very flexible and the debugging using the JTAG is great. A starter kit is about $100 but you don't have to buy that, only the USB to JTAG interface pod is sufficient. I am personally a 8051, and its derivatives, fan and have used it for more than 20 years.. PICS unfortunately is not my kettle of fish.

__________________
The best vision is insight - Malcolm Forbes
Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#15
In reply to #11

Re: Embedded C and Microcontrollers

03/26/2010 6:27 AM

Surely what he meant was that as long as you stay tightly within the ANSI C code standard, the compiler for a particular chip should handle differences between chips.

eg. A program written for one ANSI compatible compiler for one chip should be recompilable on the ANSI compatible compiler for another chip and just run.....

I am personally sceptical that it will be 100% perfect and not require any slight modifications, but that is at least the theory as I understand it.....

(its a long time ago but I have programmed many times in assembler, Fortran, basic and Forth at various times in my life, not as extensive as many others here though!) I am looking at PICs at this time in both Basic, C and assembler......but have not really started, just playing with the emulators.....

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Register to Reply 17 comments
Copy to Clipboard

Users who posted comments:

Andy Germany (4); Dead Bear (1); IanR (1); lewisthebear (4); Mikerho (1); prady (1); user-deleted-1105 (5)

Previous in Forum: Windows XP Fanatics take note   Next in Forum: Wide-Angle LED Drivers
You might be interested in: Embedded Systems Software, Microcontrollers (MCU)

Advertisement