Searching \ for '[Pic]:Org' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Org'.

Exact match. Not showing close matches.
PICList Thread
'[Pic]:Org'
2000\08\31@162919 by Shawn Yates

flavicon
face
Hello.

       I have been using the PICs for about two years now and every now and
then I see the macro ORG.  What is that for?  I have never had a need to use
it, but if its usefull maybee I have been missing out on something.

Thanks

Shawn

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2000\08\31@174005 by Tony Nixon

flavicon
picon face
Shawn Yates wrote:
>
> Hello.
>
>         I have been using the PICs for about two years now and every now and
> then I see the macro ORG.  What is that for?  I have never had a need to use
> it, but if its usefull maybee I have been missing out on something.
>
> Thanks
>
> Shawn
>
> --
> http://www.piclist.com hint: The list server can filter out subtopics
> (like ads or off topics) for you. See http://www.piclist.com/#topics

Hi Shawn,

It sets the assemblers program address.


Eg

       org 0000h   ; start compiling code from address 0h

       org 0010h   ; start compiling code from address 10h


Try it out and look at the *.lst file to see the effect.

--
Best regards

Tony

ICmicro's
http://www.picnpoke.com
spam_OUTsalesTakeThisOuTspampicnpoke.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2000\08\31@175219 by Shawn Yates

flavicon
face
Got it.  It directs the assembler what address to place the lines of code
in.  Interesting.  So, if I wanted to I could have a block of code that is
typed at the top of my ASM file, but using the ORG command, its the thing in
the memory map of the PIC.

Thanks for the insight.

Shawn

{Original Message removed}

2000\08\31@190138 by Olin Lathrop

flavicon
face
>         I have been using the PICs for about two years now and every now
and
> then I see the macro ORG.  What is that for?  I have never had a need to
use
> it, but if its usefull maybee I have been missing out on something.

ORG is actually an assembler directive, not a macro.  It is used in absolute
code (one assembly module, linker not used) to set the address where the
next thing you write into program memory will go.  This is how you make sure
your interrupt routine starts at the interrupt vector (address 4 for 16C
PICs).

I don't think I've personally ever used it since I like breaking code up
into separate functional modules.  This greatly enhances maintainability and
code reusability.  It is also the only way to get a separate scope for
symbols local to a particular code chunk.  However, multiple modules forces
you to use the linker, which prohibits use of the ORG directive.  The
equivalent directive for relocatable code is the CODE <adr> directive.

Of course you could also look in the manual for the answer to this question.
ORG, CODE and a whole pile of other directives are all described there.
It's worth a read thru for anyone doing PIC programming.  How have you
managed to program PICs for two years without ever having cracked the
manual?  How have you been locating the start of your interrupt routines?


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, .....olinKILLspamspam@spam@cognivis.com, http://www.cognivis.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


'[Pic]:Org'
2000\09\01@094231 by Shawn Yates
flavicon
face
>  How have you
> managed to program PICs for two years without ever having cracked the
> manual?  How have you been locating the start of your interrupt routines?

I have been found out.  I just read over some sample programs in a book
microchip put out (UCHB update or something like that) and then made a lot
of trial and errors.  I have never had a good handle on the assembler
directives, I just use the 13 assembler directives.

Funny thing about interupts.  I use this great processor (16C67) with lots
of peripheral interupts, and i have never used them.  I monitor some of the
bits sometimes, but never used the interupts.  However, I would have used
'brute force' like this:

nop
goto SETUP    ;go see if it s power up, brown out, or WDT reset
nop
I_HANDLE    ;start my interupt handler here
blah
blah

I bit unrefined I am sure, but like I said all I am used to using the
language only.

Thanks for the feedback though, I am learning.

Shawn

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...