Searching \ for '[PIC]MPLAB ASM30 variable question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=mplab
Search entire site for: 'MPLAB ASM30 variable question'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]MPLAB ASM30 variable question'
2005\10\23@031016 by Stephen D. Barnes

picon face
I am currently reading the documentation for MPLAB ASM30 and will be
writing code for
the dsPIC30F2010. When coding for non-dsPIC devices, CBLOCK is used to
declare relocatable variables.
I do not see how this is done for the dsPIC.Either I have spent too much
time reading and cannot see the obvious,
or I really am missing something. Can anyone point me in the right
direction?

--
Regards,
Stephen D. Barnes

2005\10\23@082909 by Jan-Erik Soderholm

face picon face
Stephen D. Barnes wrote :

> When coding for non-dsPIC devices, CBLOCK is used to
> declare relocatable variables.

Don't use CBLOCK för *any* PICs.
That will make life easier, in particular
when switching to PIC24/30/33, since CBLOCK,
as far as I know, isn't supported when developing
for them (or any other absolute-mode-specific
directives). That is a good thing, imho.

> I do not see how this is done for the dsPIC.

How *what* is done ?
Allocating RAM space ?

You should read about RES.

> Can anyone point me in the right
> direction?

=======>>>    ***Relocatable code***

B.t.w, doesn't the docs have some chapter named
"Allocating RAM" or something like that ?

Best Regards,
Jan-Erik.


2005\10\23@083641 by John J. McDonough

flavicon
face
Stephen

First of all, CBLOCk is not "used to declare relocatable variables".

CBLOCK simply assigns a string of sequential constants.  In absolute
programming (as opposed to relocatable programming) CBLOCK might be used
to assign a string of constants which refer to fole register locations, bt
they are not relocatable, and they are not "variables".  They are simply
constants that contain values that happen to correspond to GPR locations
that you have chosen to use for variable storage.

In the PIC16x/18x look at udata and res for relocatable gpr allocation.

On the dsPIC look at .bss for a similar capability.

--McD



2005\10\23@100815 by olin piclist

face picon face
Stephen D. Barnes wrote:
> When coding for non-dsPIC devices, CBLOCK is used to
> declare relocatable variables.

Argh!  After the many discussions on this I thought everyone got this by
now.

CBLOCK does not allocate variables, and it certainly isn't used to declare
variables in relocatable mode.  All CBLOCK does is create a bunch of symbols
with sequential values.  This is used in ancient crufty absolute code to
define variable symbols, although this has associated problems.  CBLOCK
should only be used for something simular to a C ENUM.  Variables are
defined and allocated with the RES directive.

> I do not see how this is done for the dsPIC.

What, defining symbols with sequential values or defining variables?  The
latter can be done several ways, including with the .BSS directive.  I use a
macro called ALLOC to get more flexibility about what section the variable
goes in, but you can start out using .BSS.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2005\10\23@101404 by olin piclist

face picon face
Jan-Erik Soderholm wrote:
> Allocating RAM space ?
>
> You should read about RES.

The OP was asking about dsPICs, which have a totally different assembler and
linker.  There is no such thing as absolute mode on dsPICs, for example.
The directives are also different and there is no RES directive, although
there are ways of achieving the same thing.


******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products

2005\10\23@102136 by Jan-Erik Soderholm

face picon face
Olin Lathrop wrote :

> Jan-Erik Soderholm wrote:
> > Allocating RAM space ?
> >
> > You should read about RES.
>
> The directives are also different and there is no RES
> directive,...

Yes, I saw that from later post, I thought about posting a
correction, but hoped that the OP would sort it out using
the info in the later posts...

Sorry about that.

Jan-Erik.



2005\10\23@154814 by Stephen D. Barnes

picon face
Olin Lathrop wrote:

>Stephen D. Barnes wrote:
>  
>
>>When coding for non-dsPIC devices, CBLOCK is used to
>>
>>    
>>
>declare relocatable variables.
>Argh!  After the many discussions on this I thought everyone got this by
>now.
>
>  
>
>
Sorry Olin! I should have mentioned that I have been away from PIC's
altogether for almost a year
and have been intermittent at best in my reading the PICList.
I was a beginner at the time I accepted a field engineering position
that required 90% travel. I am now
In one location with somewhat normal hours at work and at home.
I do appreciate the reply and it has led me in the right direction.
Thank you for the help!

--
Regards,
Stephen D. Barnes

2005\10\23@155543 by Stephen D. Barnes

picon face
Thanks to everyone for the input. I am on the right track now.
For those interested, I am attempting to implement a dedicated
brush DC servomotor controller...yes... for hobby robotics.
The dsPIC30F2010 has a hardware QEI which maked the design
a bit easier for me.

--
Regards,
Stephen D. Barnes

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