Searching \ for '[PIC]: Starting to use 18C252 with MPLAB' 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: 'Starting to use 18C252 with MPLAB'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Starting to use 18C252 with MPLAB'
2000\08\22@070246 by Martin Hill

picon face
Hi all,
  I am converting some code to the 18C252 and am having a
couple of problems.

Firstly, according to the compile the available codes space is
65536bytes.  the data sheet says 32768, is this an error in the
compiler.

Secondly, I am having problems setting the option registers.  The
compiler error says I have the wrong format.  Any ideas how to fix
it?

Thirdly.  Is there any advantage to using GOTO or CALL instead of
BRA or RCALL, other than the obvious that you cannot jump or call
very far with BRA or RCALL.  Since the addresses are set at
compile time, is there any way of making the compiler use BRA
and RCALL whenever possible and GOTO and CALL when it isn't.
Currently I am just changing to BRA and RCALL and changing back
when errors are generated.

Thanks for any help

Martin

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@071658 by Alan B. Pearce

face picon face
>is there any way of making the compiler use BRA
>and RCALL whenever possible and GOTO and CALL when it isn't.

Work out a macro to use GOTO and CALL when the address difference is too large.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@072753 by Bob Ammerman

picon face
See my notes below.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\22@074014 by Andy Jancura

picon face
Hi,

>I am converting some code to the 18C252 and am having
>a couple of problems.

Did you read the application note about migrating to 18C?

>Firstly, according to the compile the available codes
>space is 65536bytes. the data sheet says 32768, is this
>an error in the compiler.

16bit wide instructions -> 32678 words.

>Thirdly.  Is there any advantage to using GOTO or CALL
>instead of BRA or RCALL, other than the obvious that you
>cannot jump or call very far with BRA or RCALL.

Yes, only one word needed.


Andrej

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@075049 by Bob Ammerman

picon face
> >Thirdly.  Is there any advantage to using GOTO or CALL
> >instead of BRA or RCALL, other than the obvious that you
> >cannot jump or call very far with BRA or RCALL.
>
> Yes, only one word needed.

And if you skip the instruction (eg with BTFSC) it'll still take 2 cycles
(not 1 like a BRA/RCALL). This is because you are actually skipping into the
middle of the two-word instruction. The second word is always in the form
0xFnnn and if executed as a separate instruction is treated as a NOP.

>
> Andrej
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> --
> http://www.piclist.com hint: PICList Posts must start with ONE topic:
> [PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@075300 by Martin Hill

picon face
> Hi,
>
> >I am converting some code to the 18C252 and am having
> >a couple of problems.
>
> Did you read the application note about migrating to 18C?
I did, but it didn't cover any of the points I am having trouble with, it
all assumes that all data is stored in memory bank 0, which makes
a difference to all the code as I have more than 256 variables I can't
do this.  It makes no mention of setting the bit on each command to
specify a memory bank.  This is what took ages to go through all
8000 lines of code and check each one.  This also impacts on the
indirect addressing which it doesn't really mention.  To be honest I
wasn't all that impressed with it.  It will help for the few SFRs whos
names have changed, and for the new oscillator modes.

>
> >Firstly, according to the compile the available codes
> >space is 65536bytes. the data sheet says 32768, is this
> >an error in the compiler.
>
> 16bit wide instructions -> 32678 words.

But the data sheet says 32768 bytes, 16384 word

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@083717 by Martin Hill

picon face
I see that it will make a difference to the execution time of the code,
but I am only interested in making the code as small and fast as
possible.  Looks like I will have to try to do a macro for it.  Seems
like a good option to be able to have in the assembler to do it
automatically.

Martin

{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@090547 by Olin Lathrop

flavicon
face
> >is there any way of making the compiler use BRA
> >and RCALL whenever possible and GOTO and CALL when it isn't.
>
> Work out a macro to use GOTO and CALL when the address difference is too
large.

Note that this is only possible if you assemble everything in one pass.  You
can't make assembly time decisions about link time values.


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

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@090550 by Olin Lathrop

flavicon
face
> However, if you really want to do this, for backward GOTO's/CALL's it
should
> be possible to create a macro that chooses one instruction or the other by
> computing the difference between the current location counter and the
target
> of the GOTO/CALL.
>
> I don't know of a way to handle forward GOTO's/CALL's

I don't think forward/backward matter since this is a multi-pass assembler.
You can forward reference symbolic addresses at assembly time.  The real
issues is absolute versus linked.  I don't see how this is possible (accross
modules at least) when the linker is used.


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

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@091008 by Alan B. Pearce

face picon face
>> >is there any way of making the compiler use BRA
>> >and RCALL whenever possible and GOTO and CALL when it isn't.
>>
>> Work out a macro to use GOTO and CALL when the address difference is too
>>large.

>Note that this is only possible if you assemble everything in one pass.  You
>can't make assembly time decisions about link time values.

As someone else pointed out it also has difficulty with forward references on
the first pass of a multipass assembly

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@091220 by Martin Hill

picon face
I am just compiling in one module, with a whole load of included
files at the end of the main one.  It would certainly be beneficial if it
can be done.  I have already saved a noticable amount of code
space by changing GOTO to BRA, but these tend to be closer
jumps than the CALLs.

Martin

{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@092046 by Scott Dattalo

face
flavicon
face
On Tue, 22 Aug 2000, Olin Lathrop wrote:

> > >is there any way of making the compiler use BRA
> > >and RCALL whenever possible and GOTO and CALL when it isn't.
> >
> > Work out a macro to use GOTO and CALL when the address difference is too
> large.
>
> Note that this is only possible if you assemble everything in one pass.  You
> can't make assembly time decisions about link time values.

The x86 assemblers I've used in the past provide NEAR/FAR/HUGE macros to get
around this limitation. At assembly time you could specify a call to be NEAR (CS
doesn't need to be reloaded) and if at link time it turned out that the call
couldn't be near you got an error. I'm not sure if MPASM/MPC have this option
(gpasm doesn't).

Scott

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@103000 by Andy Jancura

picon face
>Hi,
>
> >I am converting some code to the 18C252 and am having
> >a couple of problems.
>
>Did you read the application note about migrating to 18C?

>I did, but it didn't cover any of the points I am having trouble
>with, it all assumes that all data is stored in memory bank 0, which
>makes a difference to all the code as I have more than 256 variables
>I can't do this.

Isn't AN716 written for 16C74 with 192 RAM?

>It makes no mention of setting the bit on each command to specify
>a memory bank.

I agree, but in 18Cxx2.pdf is written on pp.41 and again exactly on pp.46
that the 18Cxx2 can access either variables in Banks 0-15 or  Access Bank
without paging. Nice feature for programming and optimizing... In assembler
too.

Andrej
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@124158 by Bob Ammerman

picon face
----- Original Message -----
From: Olin Lathrop <.....olin_piclistKILLspamspam.....COGNIVIS.COM>
To: <EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU>
Sent: Tuesday, August 22, 2000 8:16 AM
Subject: Re: [PIC]: Starting to use 18C252 with MPLAB


> > >is there any way of making the compiler use BRA
> > >and RCALL whenever possible and GOTO and CALL when it isn't.
> >
> > Work out a macro to use GOTO and CALL when the address difference is too
> large.
>
> Note that this is only possible if you assemble everything in one pass.
You
> can't make assembly time decisions about link time values.
>
Assuming MPASM is a typical two-pass assembler (and I think it is) you will
only be able to handle backward branches / calls.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

>
> *****************************************************************
> Olin Lathrop, embedded systems consultant in Devens Massachusetts
> (978) 772-3129, olinspamspam_OUTcognivis.com, http://www.cognivis.com
>
> --
> http://www.piclist.com hint: PICList Posts must start with ONE topic:
> [PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]: PIC only [EE]: engineering [OT]: off topic [AD]: advertisements

2000\08\22@124207 by Bob Ammerman

picon face
Ah, but a two-pass assembler must know the correct amount of memory used on
the first pass or you will get phase errors. (of a different sort than those
in the thread about 3-phase power sine wave generation :-) ).

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\22@124210 by Bob Ammerman

picon face
A real simple memory allocation scheme to use for the 18C chips:

Set the BSR (bank select register) to 1.

Now you can access locations 0x00 through 0x7F in bank 0 (via the access
bank), locations 0x100 through 0x1FF in bank 1 (via the BSR) and the SFR's
in location 0xF80 through 0xFFF (again via the access bank), without any
bank switching.

You can then use the FSRs (3 of them!) to access locations in other banks.

This results in very simple, easy to debug, code.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2000\08\23@045759 by Martin Hill

picon face
This is exactly as I have done it.  I needed just over 300 memory
locations so doing this works fine.  The only thing to make of is that
you know whether the memory locations are in bank 0 or when so
you can add the bit to the end of each command.  I am using the
FSRs but not to read locations in other banks.

Martin

{Quote hidden}

--
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


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