Page 1 of 2

IRP bit must be set manually for indirect access to '?Loca

Posted: 31 May 2009 04:36
by slavka001
Hi,
getting compiler warning:
IRP bit must be set manually for indirect access to '?Local_Text' variable
but can not understand what is causing it.
dim Freq as longint ' Frequency
dim Freq1 as longint
...
Freq1 = Tmr1Hi*65536 + TMR1H*256 + TMR1L
'Freq = Tmr1Hi*65536 + TMR1H*256 + TMR1L
...
What i do not get is Freq1 is causing this error. When swtiching the lines warning disappear.
any idea?

Posted: 01 Jun 2009 13:27
by igor.stancic
Hi,

You have a memory bank problem.IRP is bank select bit used for indirect
addressing.Our compiler is not capable to set IRP bit.

IRP=0 -> Bank 0,1
IRP=1 -> Bank 2,3

So you must do that manually. Also you can use 'absolute' directive and
move variable at memory banks 0 and 1(directive absolute specifies the starting address in RAM for variable.
If variable is multi-byte, higher bytes will be stored at the consecutive
locations).

Instead PIC16F you can always use PIC18F.
That way, you will not have any problems with memory banks.

Regards

Igor

Posted: 01 Jun 2009 15:56
by slavka001
Thank you Igor.

So basically I have two many variables and the compiler started allocating variables to the Bank 2 and 3, correct?

If I manually set the IRP to 1, I still will not be able to perform funcation with variables from Bank01 and Bank23 at the same time, right?

So either I need to trim the number of variables I am using for use ASM to move the data between banks before accessing them.
Am I on the right path?

Posted: 29 Jun 2009 10:09
by amrbekhit
Hello,

We're facing the same problem - does this mean that the compiler can only use variables that it has allocated in bank 0 for the 16F family? Or does it mean that you cannot have variables that span over multiple banks?

Thanks,

--Amr

Posted: 29 Jun 2009 11:09
by piort
amrbekhit wrote: does this mean that the compiler can only use variables that it has allocated in bank 0 for the 16F family?
Or does it mean that you cannot have variables that span over multiple banks?
both are true so like igor say, when facing to this p16 limit, use p18 instead...

hth a bit ;-)

Posted: 29 Jun 2009 11:15
by amrbekhit
Let me just clarify:

The PIC16F88 has 368 bytes of RAM split over 4 banks - with only 96 bytes available in bank 0 - so if I use the mikroC PRO compiler I can only use 96 bytes?

--Amr

Posted: 29 Jun 2009 13:33
by piort
hi,
no but you have to do it manuelly with org and absolute directive...

if you use a 16f88, may i suggest to move with a p18f1320 ? Same pin count, same memory size and near same price. Is not pin compatible but at least Vss and Vdd are at the same place ...

Posted: 29 Jun 2009 15:54
by amrbekhit
Hi piort,

Thanks for your suggestion - unforunately, none of the 18-pin 18Fs have I2C ports, so they're not really very suitable.

I have to say, this is a rather shocking revelation - I do hope that mikroelektronika address this some time soon - having to do it manually is a pain in the butt - the compiler really ought to do the bank switching for you...

Anyway, the 18Fs also have banked memory - will I not also face the same problem? Or does the mikroC compiler automatically handle bank switching for RAM on the 18Fs?

--Amr

Posted: 29 Jun 2009 18:17
by piort
amrbekhit wrote: Thanks for your suggestion - unforunately, none of the 18-pin 18Fs have I2C ports, so they're not really very suitable.
its true, nothing before 20 pin with the 18f14k50... or many 28 pin... If you dont need to use ISR, soft I2C can be use...
If you need ISR, maybe can you adapt your project with a 28 pin (like the P18f2321) in ssop form they are very small ;-)
amrbekhit wrote: Anyway, the 18Fs also have banked memory - will I not also face the same problem? Or does the mikroC compiler automatically handle bank switching for RAM on the 18Fs?
The P18 memory structure isnt the same then P16. Banking structure for P18 can be handle by all mE compiler.

HTH ;-)

Posted: 30 Jun 2009 01:58
by janni
amrbekhit wrote:Let me just clarify:

The PIC16F88 has 368 bytes of RAM split over 4 banks - with only 96 bytes available in bank 0 - so if I use the mikroC PRO compiler I can only use 96 bytes?
Not exactly, BANK1 may also be used without the need of IRP switching.

Re: IRP bit must be set manually for indirect access to '?Lo

Posted: 07 Dec 2011 12:43
by duda1g
This is a BIG PROBLEM!

I´m using the PIC16F886. I use a lot the CCS compiler, but due the LCD Library I have migrated to mikroC.

To start, I have installed the demo version to check if the display was working. After the display work normally I bought de license of mikroC.

So, during the development my LCD started to stay crazy!! Somethings that I wrote in the display of LCD was wrong! I saw this problem, and now I find that is a problem in the mikroC??? I can´t believe this!

I pay for a thing to save me, and no **** me!

I need to finish this project in TWO WEEKS! And I doesn´t want to change my uC!!!

PLEASE HOW CAN I RESOLVE THIS PROBLEM?? EASILY!

Re: IRP bit must be set manually for indirect access to '?Lo

Posted: 08 Dec 2011 10:13
by janko.kaljevic
Hello,

Please can you explain in more details the problem that you are facing.
Aldo if you can post here the project that is causing this behavior so we can inspect it.

Best regards.

Re: IRP bit must be set manually for indirect access to '?Lo

Posted: 08 Dec 2011 10:51
by duda1g
janko.kaljevic wrote:Hello,

Please can you explain in more details the problem that you are facing.
Aldo if you can post here the project that is causing this behavior so we can inspect it.

Best regards.

The problem is the acess in the BANK 1, 2 and 3!

I was reading the mikroC manual and there is this:
"
Limits of Indirect Approach Through FSR
Pointers with PIC16 are "near": they carry only the lower 8 bits of the address. Compiler will automatically clear the 9th bit upon startup, so that pointers will refer to banks 0 and 1. To access the objects in banks 3 or 4 via pointer, user should manually set the IRP, and restore it to zero after the operation. The stated rules apply to any indirect approach: arrays, structures and unions assignments, etc.
Note: It is very important to take care of the IRP properly, if you plan to follow this approach. If you find this method to be inappropriate with too many variables, you might consider upgrading to PIC18.
Note: If you have many variables in the code, try rearranging them with linker directive absolute. Variables that are approached only directly should be moved to banks 3 and 4 for increased efficiency.
"
This messagen is in the page 33 of the mikroC Manual.

So, what I want to know. How can I use the bank 3 and 4? How can I have access in this banks? The manual show de solution, but doesn´t show how to use this solution.
How I use the directive "absolute"? I don´t have idea!

In the mikroC the message is:

102 1511 IRP bit must be set manually for indirect access to 'pe' variable AutoClave.c
101 1511 IRP bit must be set manually for indirect access to 'pd' variable AutoClave.c
0 1511 IRP bit must be set manually for indirect access to '?lstr1_AutoClave' variable AutoClave.c
0 1511 IRP bit must be set manually for indirect access to '?lstr10_AutoClave' variable AutoClave.c

If you really need, I will post the code.

Re: IRP bit must be set manually for indirect access to '?Lo

Posted: 08 Dec 2011 17:56
by p.erasmus
duda1g wrote:This is a BIG PROBLEM!

II pay for a thing to save me, and no **** me!
I need to finish this project in TWO WEEKS! And I doesn´t want to change my uC!!!

PLEASE HOW CAN I RESOLVE THIS PROBLEM?? EASILY!

Before you accuse the compiler just make sure you did not do some thing silly in your code as there are many many people in this forum using mikro compiler and LCD dispalys with no problems

if you so sure post your project and we can see what the problem might be

Re: IRP bit must be set manually for indirect access to '?Lo

Posted: 09 Dec 2011 13:09
by janko.kaljevic
duda1g wrote:If you really need, I will post the code.
Hello,

The best way for all of us to help you is to post your project here.
This way we will be able to see where the problem lies.

For more details regarding linkers directive absolute, please check help file.

Best regards.