View Single Post
  #33   Report Post  
Posted to alt.binaries.schematics.electronic
ian field ian field is offline
external usenet poster
 
Posts: 396
Default MPLAB programmer interface.


"John Ferrell" wrote in message
...
On Thu, 22 Nov 2007 21:36:37 GMT, "ian field"
wrote:



The tutorial I'm reading doesn't explain the reason for an ORG at 0 and a
further 2 more for reset & interrupt vectors, before I try coding a
program
for myself I'd like to understand the rules and all the tutorials I've
found
just give example code in wildly differing layouts without any explanation
of why its done the way it is.

I think your question is a very good question.
Here is the way it works:
The ORG does not generate code. It instructs the Compiler to generate
code that is stored at a particular location. The ORG 0 says the put
this code starting at physical storage location 0.

These different interrupt code locations (vectors) allow external
events to be recognized and acknowledged without the need for the cpu
to expend resources watching for an event.

Without ORG's it would be necessary to pad unused storage manually to
put the appropriate code in the proper location.


Thanks, its starting to make sense, I think there were branches to the start
point of the program proper as it was a simple "flash a LED" program which
didn't use the vectors for anything else, it still seems to be a simple
instruction with a lot of complexity about it though.