Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

compilation error MikroC , PIC16F877A

Status
Not open for further replies.

toto_na16

Member level 1
Joined
Feb 21, 2010
Messages
34
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
Egypt
Activity points
1,478
Dear all,

I am using PIC16F877A to interface a password system and I wrote this code

Code:
char t;
char temp;
char ks[4];
char pp1[4];
char pp2[4];
char Ta[16]={'A','9','8','7','B','6','5','4','C','3','2','1','D','#','0','*'};
unsigned ec;
char factorypass[4]={'1','2','3','4'};
int flag;
int newflag;
int fcfp=0; // flag correct factory password
int compare(char*,char*);
void input(char*);







void main(){
            // se eeprom add 0x00
            Eeprom_Write(0x00,0);
            // fu eeprom add 0x01
            Eeprom_Write(0x01,0);
            TRISD=0x00;
            Lcd_Config(&PORTD,2,3,0,7,6,5,4);
            LCD_Cmd(LCD_Cursor_Off);
            Keypad_Init(&PORTC);


             while(1){
                      if(Eeprom_Read(0x00)==1){
                                               LCD_Cmd(LCD_Clear);
                                               LCD_Out(1,3,"system error");
                                               LCD_Out(2,3,"contact factory");
                                               delay_ms(20);
                                               break;
                                               }
                      if(Eeprom_Read(0x01)==0){
                                               while(fcfp==0){
                                               LCD_Cmd(LCD_Clear);
                                               LCD_Out(1,3,"enter factory");
                                               LCD_Out(2,3,"password");
                                               delay_ms(3000);
                                               LCD_Cmd(LCD_Clear);
                                               LCD_Chr(2,4,' ');
                                               input(ks);
                                               /*for(temp=0;temp<4;temp++){
                                                                              ec=0;
                                                                              while(ec==0)
                                                                                    ec = keypad_Released();
                                                                              LCD_Chr_Cp('*');
                                                                              t= Ta[ec-1];
                                                                              ks[temp] = t;
                                                                        }*/
                                               /*for(temp=0;temp<4;temp++){
                                                                         if(factorypass[temp]!=ks[temp])
                                                                                                         {flag=1;}
                                                                        }*/
                                               flag = compare(factorypass,ks);
                                               if(flag==1){
                                                           LCD_Cmd(LCD_Clear);
                                                           LCD_Out(1,3,"enter new");
                                                           LCD_Out(2,3,"password");
                                                           fcfp=1;
                                                           delay_ms(3000);
                                                           LCD_Cmd(LCD_Clear);
                                                           LCD_Chr(2,4,' ');
                                   inputpp1:                        /*for(temp=0;temp<4;temp++){
                                                                                          ec=0;
                                                                                          while(ec==0)
                                                                                                ec = keypad_Released();
                                                                                          LCD_Chr_Cp('*');
                                                                                          t= Ta[ec-1];
                                                                                          pp1[temp] = t;
                                                                                    }*/
                                                           input(pp1);
                                                           LCD_Cmd(LCD_Clear);
                                                           LCD_Out(1,1,"enter the same");
                                                           LCD_Out(2,1,"password again");
                                                           delay_ms(3000);
                                                           LCD_Cmd(LCD_Clear);
                                                           LCD_Chr(2,4,' ');
                                                           /*for(temp=0;temp<4;temp++){
                                                                                          ec=0;
                                                                                          while(ec==0)
                                                                                                ec = keypad_Released();
                                                                                          LCD_Chr_Cp('*');
                                                                                          t= Ta[ec-1];
                                                                                          pp2[temp] = t;
                                                                                    }*/
                                                           input(pp2);
                                                           /*for(temp=0;temp<4;temp++){
                                                                                     if(pp1[temp]!=pp2[temp])
                                                                                     {newflag=1;}
                                                                                    }*/
                                                           newflag = compare(pp1,pp2);
                                                           if(newflag==1){
                                                                          LCD_Cmd(LCD_Clear);
                                                                          LCD_Out(1,1,"doesn't match");
                                                                          LCD_Out(2,1,"enter again");
                                                                          delay_ms(3000);
                                                                          LCD_Cmd(LCD_Clear);
                                                                          LCD_Chr(2,4,' ');
                                                                          goto inputpp1;
                                                                          }
                                                           if(newflag==0){
                                                                          LCD_Cmd(LCD_Clear);
                                                                          LCD_Out(1,1,"you have set");
                                                                          LCD_Out(2,1,"new password");
                                                                          ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////cpppppp
                                                                          //////////////////////////////
                                                                          ///////////////////////////
                                                                          ////////////////////
                                                                          }

                                                           }


                                               if(flag==0){
                                                           LCD_Cmd(LCD_Clear);
                                                           LCD_Out(1,3,"wrong factory");
                                                           LCD_Out(2,3,"password");
                                                           delay_ms(2000);
                                                           LCD_Cmd(LCD_Clear);
                                                           LCD_Out(1,1,"enter correct");
                                                           LCD_Out(2,1,"factory password");
                                                           }
                                                           }
                                               }
                                               }   /////main while end
                                               
} ///////////main func end

int compare(char* a,char* b){
                             int FF;
                             int i;
                             for(i=0;i<4;i++){
                                                       if(a[i]!=b[i])
                                                       {FF=1;
                                                        break;
                                                       }
                                              }
                             return FF;
                             }
                             
void input(char* c){
                    int j;
                    for(j=0;j<4;j++){
                                              ec=0;
                                              while(ec==0)
                                                          ec = keypad_Released();
                                               LCD_Chr_Cp('*');
                                               t= Ta[ec-1];
                                               c[j] = t;
                                              }
                   }

I got this error " Not Enough RAM Istr_(code file name)"

does anyone know how to solve this problem ???

it seems that the MCU I am using doesn't have enough RAM ??????
 

u can change the mc to 18f452 pin compitable with high memory configuration, also check the compiler version
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top