Searching \ for 'boundries' 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/index.htm?key=boundries
Search entire site for: 'boundries'.

No exact or substring matches. trying for part
PICList Thread
'PIC Page Boundries'
1999\02\02@171032 by Steven Kosmerchock

flavicon
face
Friends,
I am writing a program that is more than 2K. I am using
the PIC16C67 (8K) and have never had a program more than 2K.
The problem is that I assembled it in MPLAB and it says:

Crossing page boundary -- ensure page bits are set.

This is new to me. So how do I go about doing this? Do I set
the memory to bank1 where the code first indicates this message?
Any help would be greatly appreciated!! Thanks alot.

Best regards,
Steven



Steven Kosmerchock
Engineering Technician/Student
CELWAVE
Phoenix   Arizona   USA
Email:   spam_OUTsteve.kosmerchockTakeThisOuTspamcelwave.com
http://www.geocities.com/researchtriangle/lab/6584

1999\02\02@174353 by Tony Nixon

flavicon
picon face
Steven Kosmerchock wrote:
>
> Friends,
> I am writing a program that is more than 2K. I am using

It's quite easy to understand Page Boundaries.

GOTO and CALL instructions as with all others in this chip are 14 bits
wide. 3 are for the instruction, so it can only supply another 11 bits
for an address.

Binary 00000000000 - 11111111111 = 0 - 2047 or 2K ROM space.

In order to address more than this 2K instruction limit, there has to be
a mechanism available to add extra bits to the instruction. The
mechanism in the PIC is to use bits from the PCLATH register.

PCLATH bits <4:3> are used for this purpose and become the MSB's of the
GOTO/CALL instructions address. That way the total address becomes 13
bit, ie. able to address 8K of ROM.

If you do simple binary arithmetic on this you will see why it works.

PCLATH <4:3>  +  Instruction Address (00000000000 - 11111111111)
   0 0         0 - 2047     ROM Page 0
   0 1         2048 - 4095  ROM Page 1
   1 0         4096 - 6143  ROM Page 2
   1 1         6142 - 8191  ROM Page 3

It is upto you to determine the target address of your CALL GOTO
instructions. If this address is outside the 2K boundary limits as
mentioned above, then you will need to set the correct PCLATH bits
before the GOTO/CALL instruction.

You must keep track of all GOTO/CALL addresses throughout your program
when it spills over the 1st 2K boundary. If the PCLATH is not set
correctly then errors in your software will occur.

Try this in a simulator

     org 0h
     clrf PCLATH

     goto Page1
here  goto here      ; this is where you will stay.

     org 800h
     nop
     nop
Page1 goto Page1     ; the program will not get here.


If you bsf PCLATH,3 then the program will work as expected.

The PCLATH value does not change after a RETURN instruction, but the PC
will point to the instruction following the CALL. This is because the
stack holds the entire 13 bit address, so it can return from anywhere in
ROM.

--
Best regards

Tony

Multimedia 16F84 Beginners PIC Tools.
** NEW PicNPro Programmer and Port Interface **

http://www.picnpoke.com
Email .....picnpokeKILLspamspam@spam@cdi.com.au

'CROSSING Page Boundries'
1999\02\02@223000 by Ravi Pailoor

flavicon
face
It is just asking you to ENSURE that the page bits are set. If they are
set you do not have to worry.


Pailoor




Steven Kosmerchock wrote:

{Quote hidden}

--
Chip Technologies
Microchip Design Consultant

No. 70, 9th Main Road,
Mathikere,
Bangalore - 560 054.
INDIA
Tel   : +91-80-3362807
Fax   : +91-80-3369451
Email : .....chiptechKILLspamspam.....vsnl.com
Webpage : http://business.vsnl.com/chiptech

'PIC Page Boundries.....THANKS!!'
1999\02\03@142219 by Steven Kosmerchock

flavicon
face
Friends,
Just wanted to say thanks to all of you that replied to my question
about the problems I was having with the 2K page boundries!!
Using MP-SIM, it seems that about 2/3 of my code (<4K) is working
ok. Thanks again people, you saved me TONS of stress!! You
guys/gals are the best!!!


Best regards,
Steven



Steven Kosmerchock
Engineering Technician/Student
CELWAVE
Phoenix   Arizona   USA
Email:  EraseMEsteve.kosmerchockspam_OUTspamTakeThisOuTcelwave.com
http://www.geocities.com/researchtriangle/lab/6584


'[SX] Jump table across page boundries'
2006\05\13@014535 by toru173n/a
flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, toru173 wrote:

I'm looking at the SX28 as the basis of an interpreter, and I have read a few of the posts on these forums relating to this particular usage. I noted, however, that all suggestions result in fairly small instruction sets so that the "jump table" method can be used to interpret them without crossing page boundries. I am wondering if there is a quick and easy way to get around this problem? My goal is to interpret a fairly high-level language, with instructions such as "write character to screen"or something. Please take into account that I've never touched an SX in my life, but I have read a little about them ^_^
My thinking brought me to this;
(I refer to the 'secret' opcodes - specifically "pushPC"  listed here: http://sxlist.com/techref/ubicom/secrets.htm)
The 12bit offset to the start of the code corrosponding to the "opcode" to be interpreted is stored in a list. You would then execute an IREAD relative to the opcode (0-255) and the page at which your list starts, a pushPC then a RETP (in that order)
My understanding is that the IREAD will store the destination address in the M and W registers, the pushPC will then put these registers on the stack, and then the RETP will pop them from the stack into the PC. Is this correct? Is there an easier way of doing this?

Thankyou in advance
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=125768
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\05\13@022536 by peterverkaikn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote:

It would be easier to just create a jumptable that directly jumps to the
appropiate code.
For example:
mov w,opcode
add pc,w
jmp code_opcode0
jmp code_opcode1
etc.

All main entries must then be in the lower half of a single page.
If one page is not enough (most likely) then just do for somee opcodes
code_opcode0:
jmp @code_opcode0_entry
to jump to another page. Return from each code with a retp
You could also double the opcode at the start like this:
mov w,opcode
add w,opcode
add pc,w
jmp @code_opcode0
jmp @code_opcode1
etc.
but I expect this takes more codespace.

regards peter
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=125768#m125772
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\05\13@033423 by toru173n/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, toru173 wrote:

Say I have 256 (the full byte) opcodes. This means that, for whatever method, I will need two pages to occupy the entire jump table. This means that unfortunatly those methods are out. I was hoping to get around this, but I suppose testing the highest bit and setting the page accordingly would work. Is there no other alternative?

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=125768#m125775
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\05\13@034446 by peterverkaikn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote:

You can a simple test at the start:
org #200
cjae opcode,#67,@jumptable2 ;example value = start opcode in next jump table
mov w,opcode
add pc,w
;jumptable1 for opcodes 0-66 org $400 jumptable2:
mov w,opcode
sub w,#67
add pc,w
;jumptable2 for opcodes>=67
You can extend this to more pages.
But I don't think you will reach 256 opcodes as there is only
2K codespace in a SX28. For 256 routines that would be 8 words per routine,
not counting the jumptables.
If you limit the opcodes to 127 then at most two jumptables are required.

regards peter
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=125768#m125776
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\05\13@053808 by peterverkaikn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote:

You may want to check out these threads:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=58265
http://forums.parallax.com/forums/default.aspx?f=7&m=115467&g=118340#m118340
regards peter
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=125768#m125784
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\05\13@084954 by toru173n/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, toru173 wrote:

Thankyou for those links, Peter. The second was what motivated me to join this forum and post this problem, but your smallc interpreter is very interesting. In that discussion you made the following comment:

Other problem, the switch statement reads the address to jmp to
using iread. It looks the only way to do this jump is the use of a
secret instruction and reti
This is similar to the method I had imagined, I think. Could you please show me what you were refering to?

As to why I might need so many opcodes; I had intended to implement a subset of the JVM on the SX. I'm a big fan of the Lego RCX robotics and there has been a port of the JVM to the H8 at the centre of the robot (LeJOS - I think it stands for "Lego Java Operating System", but I believe it also means "far" in spanish) and the code availible is quite easy to understand. Even if I'm not able to squeeze the entire JVM into the memory availible (I am aiming for the stack manipulation operations and the JVM equivilent of the SX native instructions, at least), I would still have a very rich and well-documented language to program with.

What you suggested in your previous post (starting "You can have a simple test at the start:") is what I had thought necessary. I would like to avoid this method though because it limits the amount of code movement availible to me. At the very least, thankyou for verifying that method for me ^_^
I'd also like to thank you for your quick and knowledgable responses. You're helping me to learn more about this chip then the datasheet could have told me - for example, it took me a while to work out the meaning of the @ symbol in front of some of the addresses in your code, but now that I know of it I'm sure I will use it often. Thankyou!

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=125768#m125790
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\05\13@093550 by peterverkaikn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote:

Talking about subset of JVM. This has been done by parallax using an SX48 and is known as Javelin.
http://www.parallax.com/javelin/index.asp
No way this is possible using an SX28 otherwise parallax may have done so.

Smallc has alot smaller memory footprint than JVM, but then it also lacks
some nice features of java. Smallc can be used with an SX28 as I showed in the first link
I provided. Problem is that smallc as a language has no knowledge of ports, memory maps
and all other sx features. That makes writing native compiled code (sx assembler)
difficult, as there are many restrictions for the written code.

The switch table as generated by the smallc compiler has the following layout:

For each 'case' value there are 2 16bit entries: a code address (label) and compare value (case value).
The last 2 16bit entries in this table are 0 ('default') and an address (default label).

As the SX does not have a JMP M:W instruction, and there is no access to the call stack,
the only way to jump to some label address indirectly, is by using secret sx instructions.
However, for an interpreter, you can avoid this, because I showed in the bytecode interpreter thread,
that all address references (labels) are within the generated table of tokens, that will represent
your compiled code.

I have attached my java class for the smallc interpreter as it shows how to interpret the
smallc generated table. If you have specific question about this java program, please
do so in the javelin forum.

If you have specific questions about the smallc files I posted, please do so in the
appropiate thread.


regards peter
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=125768#m125794
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

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