IRP bit must be set manually for indirect access to

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
b0gdan
Posts: 2
Joined: 14 May 2012 13:44

IRP bit must be set manually for indirect access to

#1 Post by b0gdan » 14 May 2012 13:57

hi,
i use "mikroc PRO for PIC v4.60".

i get the follow warning:
"IRP bit must be set manually for indirect access to datax variable". How can i fix it.


Thank you.

code look like this:
//-----------------------------------------
char datax[9][9];
unsigned int k=0;

void main()
{do
{
adc_rd=ADC_Read(2);
datax[k][0]=adc_rd/10;
datax[k][1]=adc_rd%10;
Lcd_Chr(1, 1, ( datax[k][0]) + 48);
Lcd_Chr(1, 2, ( datax[k][1]) + 48);
k++;
if(k==10)k=0;
delay_ms(1000);
}while(1);}
//-----------------------------------------

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

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

#2 Post by Mince-n-Tatties » 14 May 2012 16:25

1. search the forum for information, then work out how to switch between banks or go directly to item 2 and never see the problem again.

2. use an 18F pic.

3. you could likely use a 16F but one with much much more RAM.
Best Regards

Mince

Acetronics
Posts: 715
Joined: 27 Dec 2006 14:33
Location: Le Tréport , FRANCE

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

#3 Post by Acetronics » 14 May 2012 17:23

Hi, Mince

If my old brain still works fine ...

there's an assembler Command called " BANKSEL" ...

Should it be possible to use it ???
Alain

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

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

#4 Post by zristic » 16 May 2012 07:58

BANKSEL is MPLAB macro, it is translated to a set of ASM instructions upon compiling.

Once you reach the problem with IRP bit, it is a good sign to switch to P18. Almost every P16 chip has pin-to-pin compatible cousin in P18 family. Moreover, the mE compilers are adapted so switching between P16 and p18 requires very little change in code - only that for PORT setup (ANSEL and ADCON registers).

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

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

#5 Post by Mince-n-Tatties » 16 May 2012 10:45

zristic wrote:Almost every P16 chip has pin-to-pin compatible cousin in P18 family. Moreover, the mE compilers are adapted so switching between P16 and p18 requires very little change in code
and... PIC18 tend to have much greater internal osc options and they have hardware LATch and and and...
Best Regards

Mince

Acetronics
Posts: 715
Joined: 27 Dec 2006 14:33
Location: Le Tréport , FRANCE

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

#6 Post by Acetronics » 16 May 2012 10:58

zristic wrote:BANKSEL is MPLAB macro, it is translated to a set of ASM instructions upon compiling.
Hi, Zristic

my purpose was just to try to find something simple to use for everyone ( with my soooo little skills ! ) ... whatever it is a macro or what you want.
the advantage with this one is you do not have to know where your variable is located ... :roll:

" use a PIC 18 " looks the very easy solution ... for you not to work on this problem. :mrgreen:

I could also have said : " use Picbasic Pro ( or else ) Compiler , it deals fine with that " ....

BTW ... I still have a lot of Pic 16's in my drawers, AND I won't let them fall down in the wastebox ...

Alain

MR2010
Posts: 109
Joined: 06 Jun 2010 13:28

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

#7 Post by MR2010 » 16 May 2012 11:23

b0gdan wrote:hi,
i use "mikroc PRO for PIC v4.60".

i get the follow warning:
"IRP bit must be set manually for indirect access to datax variable". How can i fix it.


Thank you.

code look like this:
//-----------------------------------------
char datax[9][9];
unsigned int k=0;

void main()
{do
{
adc_rd=ADC_Read(2);
datax[k][0]=adc_rd/10;
datax[k][1]=adc_rd%10;
Lcd_Chr(1, 1, ( datax[k][0]) + 48);
Lcd_Chr(1, 2, ( datax[k][1]) + 48);
k++;
if(k==10)k=0;
delay_ms(1000);
}while(1);}
//-----------------------------------------
Try this man;

Code: Select all

char datax[9][9] absolute 0x120;//check your pic datasheet to find witch bank you select,
mC Pro is easy and much better than PBP.
unsigned int k=0;

void main()
{do
    {
    adc_rd=ADC_Read(2);
    
irp_bit = 1; //always enable this before  absolute vars
    datax[k][0]=adc_rd/10;
    datax[k][1]=adc_rd%10;
    Lcd_Chr(1, 1, ( datax[k][0])   + 48);
    Lcd_Chr(1, 2, ( datax[k][1])   + 48);
irp_bit = 0;   // disable it just after using the absolute vars
    k++;
    if(k==10)k=0;
    delay_ms(1000);
}while(1);}
hope this help

MARIO
Posts: 978
Joined: 18 Aug 2008 22:13
Location: Brasil

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

#8 Post by MARIO » 16 May 2012 12:48

Alain wrote:BTW ... I still have a lot of Pic 16's in my drawers, AND I won't let them fall down in the wastebox ...
Me too.
I'm just wondering if ME isn't forcing all of us to use PIC18 for now on...discarding PIC16 in the future.
As I've said before, non-pro MKC version deals fine with this issue...

BR

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

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

#9 Post by Mince-n-Tatties » 16 May 2012 13:52

no one is being forced to doing anything. worst case is the user needs to actually do some reading and understanding. But for the most case the best option is to go for an 18F especially for newbies who dont have the investment time.

Don't forget, mE are one of the few compiler suppliers that include multiple family devices in the same compiler at no extra cost. So there is no financial advantage to mE for users that want to switch between pic12, 16 and 18 family.

There is also plenty of how-to work around information on the forum.

I would still advise anyone (regardless of the compiler supplier) to use 18F family. My drawer is full of pic 10, 12, 16 and now i basically only use these for testing other peoples code as part of helping out. I would be clear that i consider the 10, 12, 16 device family to be a legacy device now which i would never design into a product and this has nothing to do with mikroC.

I agree that mE should make the bank switching transparent (it would not take much searching on the forum to find my view on that) to the user. But it is not, so learn how to do it yourself or use an 18F. I have several large programs which i had to convert from mikroC to mikroC pro so i had to go through the pain on this topic a long time back.
Best Regards

Mince

Acetronics
Posts: 715
Joined: 27 Dec 2006 14:33
Location: Le Tréport , FRANCE

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

#10 Post by Acetronics » 16 May 2012 19:50

:roll:

are there lots of low pincount devices in the 18F series ???

... :mrgreen:

That's one of my problems ( I build small custom units for modellers ... so, chip size is rather important ...)

May be I should ask Microchip to make some, just for me ... :lol:

Alain

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

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

#11 Post by Mince-n-Tatties » 17 May 2012 08:16

there are a number of PIC18F options with OFN 6mmx6mm :D
Best Regards

Mince

Post Reply

Return to “mikroC PRO for PIC General”