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.

[SOLVED] origin address of microcontroller?

Status
Not open for further replies.

uday mehta

Advanced Member level 4
Joined
Dec 30, 2011
Messages
104
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Activity points
1,979
in asm coding i can start my code from beginning by "org 00h". how can i start from 00h using "c".
 

org 00h is a directive that tells the assembler where to write the program into the micrcocontroller's program memory. By using a data address of 00h, org tells MPLAB to store the first program instruction into the first memory location (address 0000h), which is also known as the Reset Vector.
The Reset Vector in the PIC is the first memory location that the microcontroller goes to on power-up or after a hardware reset, so the first program instruction must always be stored there. In C lang using C18,i think is start from 00h only. No extra instuction is required.
 
by writing the code in assembly is the only way you can control the addresses....

else you have to mix the asm inside a C file..............
still it can collapse the program in any manner, the compiler itself will take care of everything.............
 
Depending on the compiler, you can specify the address of functions or variables e.g. using the "address" attribute in Microchip's PIC24 compiler.

Keith
 

Yeah there is a lot with pragma keyword(like writing ISR).. If you go through the compiler manual you could get it.... still be careful about choosing memory locations and its not a good idea.......
 

how can i mix asm inside c in keil compiler?
 

This way :-
Code:
#pragma asm
//(assembly code and assembly style comments)(Insert your assembly lines)
#pragma endasm

btw discussion on mixing of asm into C is already in edaboard :- https://www.edaboard.com/threads/47463/
 
Last edited by a moderator:
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top