Thread: Need Advice on C Programming for MicroProcessor ??

  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72

    Need Advice on C Programming for MicroProcessor ??

    Hi Guys.
    I just start C programming for Micro Processor. I learned the C programming for 8085(8 bit) micro Processor. Now I'm Switching to 8086(16 bit) micro Processor. My aim is to Write a Simple Kernel for 32-bit Micro Processor in C language as My Final year Project.
    I have Few doubts regarding this Topic.. So guys help me Out:

    1. Can Programming for 16-bit micro processor will help me in Writing Programms For 32 bit Micro Processor or I Should Directly Switch to 32 bit without wasting time on 16 bit Micro Processor.???
    2. What kind of Changes Take Place between 32-bit & 16-bit (I think its Only registers and Concept of Memory handling.) I mean What Changes will occur in the Programming while Switching on 32-bit after 16-bit..???
    3. People Advice me To Switch on Assembly language. So in this case Which is better ASM or C ???
    4. If I learn Programming for a 32 bit Micro Processor manufactured by a particular Company then Is there any Change in Programming for another 32 bit Micro Processor manufactured by another Company.???
    5. Someone Please Advice me A good Tutorial for 16-bit or 32-bit Micro Processor in C or ASM ????
    6. What Should A Basic Kernel Contains or Perform According to You..???

    Hufff... I think I ask Too much.. But Guys Please Patiently Answer my Questions.. I really Need HELP..!!! THANKS ^-^

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    1) Talking about the x86 family, a word is either 2 or 4 bytes. Since you're ultimately dealing with "words", go for 32-bit processors directly. After all, 16-bit code is almost fully supported by 32-bit systems.

    2) From programming perspective, many new instruction where added with the 80386 CPU. So, if you want your code to use them, you'll have to change it. Nothing really has changed in the sense of code assembly. If you take an assembled code from a CPU to the other, registers and memory will be handled differently, but if you assemble it in that other processor it'll remain almost exactly the same.

    3) With nowadays compilers, it's much easier to write code in C and then compile it. ( Compilers now tend to build more efficient code than the average assembly programmer ). But there's a problem: Unless you get some TurboCrap, you won't be able to generate 16-bit code. Another setback is that all compilers generate protected mode code.

    4) You'll be rusty in the beginning because you'll have to learn a whole new lot of instructions, but the idea behind them is one and the same.

    5) Try building an OS! ( No kidding! )

    6) What is a Basic Kernel according to you?

    Phew... I'm done!
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72
    Thanks A Lot Buddy. Now I can Start Some Real Stuff.. THANKS ^-^

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    More importantly... the C language is not different for different processors. There is very little to re-learn by switching to a 32 or 64 bit C compiler. The lanugage has (stubbornly) remained the same for nearly 30 years.

    There are some pitfalls with using older compilers... For example: TurboC which is 16 bits produces programs that will not run on 64 bit operating systems. (Vista-x64 and Win 7-x64 will not run 16 bit programs)

    I've also heard tell the next generation of 32bit windows will dump 16bit support as well. (rumours no proof).

    Those processors you've been studying aren't even manufactured anymore. Any still-useable machine that's out there today will have at least a 32 bit processor but far more likely a 64bit one. But, even worse... to learn each one separately is nothing but a total waste of your time... The C language is the same on all of them!

    It's like you're learning in a time warp... and now it seems you're being taught a whole load of unnecessary stuff in the bargain. (We've had this conversation before.)

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    The thing about programming microcomputers is that you need to know more how they work on lowlevel though. You haven't mentioned what kind of project you will be doing but I am gonna guess it is something that uses something along a PIC or ARM microchip. In that case you will have to understand some of how they work semi-low-level.

    I only have experience with PIC MCUs but you will want to understand how to deduct info from the data-sheet. The datasheet will be your closest friend and bible when programming. Being able to find info and how it is used in your particular development environment for your particular chip is invaluable and will save you alot of hassle. This is also what mostly differs betwean different manufacturers. In C a for loop looks the same no matter what chipset, but how you set a certain pin to be an out-going pin, and another to in-coming, how you access the ADC, how you work with timers and timer interrupts and so on, that is what differs.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Shakti View Post
    The thing about programming microcomputers is that you need to know more how they work on lowlevel though. You haven't mentioned what kind of project you will be doing but I am gonna guess it is something that uses something along a PIC or ARM microchip. In that case you will have to understand some of how they work semi-low-level.
    For microcontrollers... yes, some hardware knowledge is necessary.

    However; take a look at the chips he's identifying...

    The 8085 chip is no longer manufactured and predates modern PC systems by 5 years.

    Similarly the 8086 chip is no longer produced and was used in the original IBM XT personal computer only.

    These aren't microcontrollers... they're antique microcomputers...
    Rumour has it that next month they will learn to install and operate MS-DOS.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some advice from the senior C programmers
    By Mark0 in forum C Programming
    Replies: 5
    Last Post: 07-22-2010, 03:34 PM
  2. Advice on C Programming with MSVC++ 2008
    By IT_Guy in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2009, 04:23 AM
  3. Advice on multithreading
    By Calef13 in forum C++ Programming
    Replies: 3
    Last Post: 08-24-2007, 03:28 PM
  4. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  5. girl friend advice (prob. the wrong place)
    By B0bDole in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 10-22-2004, 06:38 PM