Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

when do we use a C code and when do we use a assembly code??

Status
Not open for further replies.

Raviteja Jinka

Newbie level 1
Joined
Aug 14, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
12
Hi.,
i have always being missed up with a lot of questions regarding micro processor and microcontroller as well. Plz clarify me---


what is the difference between a C code and Assembly code??

when do we use them during coding of a micro processor or micro controller???

how we choose to code either in C or Assembler??

thank u>>>
 

Assembly code is a very low level langage ( lovest is direct binary or hexadecimal as on very old computer)
Every familly of microcontroler or microprocessor has there own list of instructions.
You need to study in details , the specific processor you want to use.
so it needs a lot of time to be productif .
after you can use macro or subroutines or librairies to facilitate the job..
The main advantage is THE SPEED and THE SIZE OF CODE .
No evoluate langage can be faster than ASM.

C langage base is UNIVERAL . You can change of midroprocessor or microcontroller and keep some basis.
But also, microcontroller has specific instructions and ofen you are oblige to
check the datasheet of the microcontrooler to know how to do ...
The Execution SPEED is LESS than 100% ASM .. because of class of optimisation of the compiler.
More you paid ,more the compiler is ( must be) performant.
Compiler free of charge are not realy optimised.

Microprocessor is the core of the systeme and need additional circuit as periferics ( UART, I2C..)
Microcontroller = Microprocessor + inbuilt peripherics and also specif instruction to drive them.
 

Usually C coding is preferred because it is not specific to any micro-controller, so the similar type of logic will work (with some modifications due to change in registers or the way they are accessed). We just have to compile and the cross compiler will convert our C coding into the equivalent assembly instructions.

Assembly code is normally used when people do not want to depend on the compiler for the conversion. Their main focus will be the efficient code. So they don't prefer using compilers, instead they code directly in Assembly.

Normally, if we are designing a Compiler, we will need to know both in detail.
 

Now a days assembly language is only used where optimization is required like optimization in processing speed or optimization in code size.


also with some compilers it is possible have as near as compact code given by equivalent assembly code.


rest of the world is now C & C & C,
 

actually Assembly language use where is matter of size of ROM and RAM. so if ur size of ROM much less then u have to go with assembly if ur application is more than than size.
But if its matter of logic and apllication and relaibility then u have to go with C.
 

also their are variety of architectures available in the market so job gets tedious while studding the everyone's ASM. Rather than keep the logic same only change some headers only. This is the advantage of C over ASM.
 

and also to improve efficiency of your programm u can use combination of both.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top