C vs Assembly Language

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

C vs Assembly Language

Postby ahmad » Sun Feb 21, 2010 4:33 pm

Haalllooo there...Happy Chinese New Year..
I just wondering..when cytron come to my IPT, they introducing Asembly Language. And a few years later, they come with C language.

i just wanna know what the difference between it? does C more easy than AL? If we see now all cytron project using C include AR40B etc..

any comment?? :lol:
User avatar
ahmad
Newbie
 
Posts: 12
Joined: Tue Jul 28, 2009 7:00 pm

Re: C vs Assembly Language

Postby sich » Mon Feb 22, 2010 2:06 pm

They are two different languages for programming. Syntax, program structure and compiler are different. Generally C language is easier than Assembly language for newbies.

When you're using C language, you need to use C compiler to compile the source code to .hex file which will be loaded into the microcontroller. There are many compiler available in the market, namely Hi-Tech, Microchip C18, CCS, MikroC and so on. You have to choose the right one that supports the microcontroller you want to use. Any C compiler will provide library to be used in your program. These libraries help you to get started faster and boosted the software development process. In some cases, you don't even have to understand the actual process thoroughly in order to use a function.

Meanwhile, MPLAB IDE provides assembler to assemble your source code in Assembly language. So you don't have to include another compiler to create the .hex file. By using Assembly, you'll have to read the microcontroller's datasheet, understand the background process and alter each single bit/register in your program. The program execution is faster compared to C language but the time to develop the software with the same function is much longer. Eventually you will end up with a long source code for the microcontroller to do a simple task. Assembly is recommended for the one who wish to learn the actual flow of the program.

That's what come into my mind at the moment.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: C vs Assembly Language

Postby ahmad » Mon Feb 22, 2010 4:47 pm

yeah...C look much simple...dont u have trouble to compile C?i just test it last night...C much simple...but when time to compile its dit't create .hex file...
User avatar
ahmad
Newbie
 
Posts: 12
Joined: Tue Jul 28, 2009 7:00 pm

Re: C vs Assembly Language

Postby ober » Mon Feb 22, 2010 8:22 pm

In that case, you din successfully compile the source file. It might be troublesome for first timer to get the success build. You can refer to the guide from DIY project to start.

Anyway I still agree with sich as most of industry in embedded business used C language for development.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: C vs Assembly Language

Postby ahmad » Tue Feb 23, 2010 2:19 am

yeah...i want to learn C to...slowly but surely..hehhe
ober, can u suggest some books or website to begin learn C?
User avatar
ahmad
Newbie
 
Posts: 12
Joined: Tue Jul 28, 2009 7:00 pm

Re: C vs Assembly Language

Postby ober » Mon Mar 01, 2010 11:55 am

Googling will result in millions of result.... I cannot remember which book I refer or website, but I did learn a lot from Microchip RTC Workshop. Most of the time, you need to write program to learn more.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: C vs Assembly Language

Postby shahrul » Mon Mar 01, 2010 8:22 pm

Ahmad, I provide a simple PIC lesson on my blog like LED, seven segment, switch, keypad, dot matrix, character LCD, servo motor, ADC module, Timer module, interrupt, PWM module and more to come. Click here.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: C vs Assembly Language

Postby sich » Tue Mar 02, 2010 4:50 pm

Ober & Shahrul direct you to how to program your PIC in C language. If you want to learn more about C in general, this is a good reference which is free: http://publications.gbdirect.co.uk/c_book/
You may download the pdf version available at the website too.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: C vs Assembly Language

Postby ahmad » Fri Mar 05, 2010 2:05 pm

thanks guys! i just learn how to blink LED.hehehhe its really useful...
User avatar
ahmad
Newbie
 
Posts: 12
Joined: Tue Jul 28, 2009 7:00 pm

Re: C vs Assembly Language

Postby shahrul » Fri Mar 05, 2010 2:19 pm

ahmad WROTE:thanks guys! i just learn how to blink LED.hehehhe its really useful...

Yes, that is the first step.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 11 guests