Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

problem in MikroC coad for LCD

Status
Not open for further replies.
i have tried these and it is working...

int adc_rd,k=1;
char data_x[5][5];

void main() {

do
{
adc_rd=ADC_Read(1);
IRP_bit = 1; //always enable this before absolute vars
datax[k][0]=adc_rd/10;
datax[k][1]=adc_rd%10;
irp_bit = 0; // disable it just after using the absolute vars
k++;
if(k==10)k=0;
delay_ms(1000);
}while(1);
}
 
Hi RB,

I got these information from the one of the MikroC members... MikroC compiler forum....
And here above post does mean that it is not capable to IRP bit manually...

And it will do the automatic bank switching for the PIC18..
 
Last edited:
Thanks for the info, I checked the help file in MikroC and found 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 the linker directive absolute. Variables that are approached only directly should be moved to banks 3 and 4 for increased efficiency."

I have never experienced the issue myself as arrays etc are loaded by the compiler into the first ram banks, so it has never been an issue for me on PIC16F devices.

I still don't understand what the problem is with the OPs code, unless he has manually forced arrays into the last banks or has so much RAM used the compiler has had no choice but to put an array in the last banks?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top