Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1. #11

    Default Re: how to edit this program if u want to change the default password..


    Quote Originally Posted by neigyl_noval View Post
    Let the Computer Engineers do the coding.

    do u know about MPLAB IDE and the coding of it?

  2. #12

    Default Re: how to edit this program if u want to change the default password..

    lisud man sabton ang code but murag kani nga code ang imo interesan bai.

    unsigned char stalled_char[6]="123456"

    then, since 4 characters raman imong code, modify lang pud ni nimo diri

    if(password_count==6)
    {
    password_count=0;
    if((keyin_char[0]==stalled_char[0])&&(keyin_char[1]==stalled_char[1])&&
    (keyin_char[2]==stalled_char[2])&&(keyin_char[3]==stalled_char[3])&&
    (keyin_char[4]==stalled_char[4])&&(keyin_char[5]==stalled_char[5])) //compare the keyin value with stalled value to test whether password is correct



    change the password count from 6 to 4. then change the array items checked. skip the 4 & 5 indices. sulayi lang ha kay wa pud kaayo nako gibasa ang code. maglibog ko kay kadlawon na unya hanaphanap na akong pananaw, wa pa jud klaro ang nesting sa logic blocks...

    good luck! agi na pud ko ani. pure PIC assembly lang to akoa sa una (hambog gamay.... )

  3. #13

    Default Re: how to edit this program if u want to change the default password..

    Post the schematics ... its hard to understand where you assigned which ports to what peripheral and how its being connected, whether you have de-bouncing circuit built in or what keypad are you using. The LCD also has several varieties, are you using character based LCD's or graph based?

    Post lang schematics, ang importante if possible specs also of your LCD.

    Then that's the time masabtan nato imo program.

  4. #14

    Default Re: how to edit this program if u want to change the default password..

    Quote Originally Posted by binarypill View Post
    lisud man sabton ang code but murag kani nga code ang imo interesan bai.

    unsigned char stalled_char[6]="123456"

    then, since 4 characters raman imong code, modify lang pud ni nimo diri

    if(password_count==6)
    {
    password_count=0;
    if((keyin_char[0]==stalled_char[0])&&(keyin_char[1]==stalled_char[1])&&
    (keyin_char[2]==stalled_char[2])&&(keyin_char[3]==stalled_char[3])&&
    (keyin_char[4]==stalled_char[4])&&(keyin_char[5]==stalled_char[5])) //compare the keyin value with stalled value to test whether password is correct



    change the password count from 6 to 4. then change the array items checked. skip the 4 & 5 indices. sulayi lang ha kay wa pud kaayo nako gibasa ang code. maglibog ko kay kadlawon na unya hanaphanap na akong pananaw, wa pa jud klaro ang nesting sa logic blocks...

    good luck! agi na pud ko ani. pure PIC assembly lang to akoa sa una (hambog gamay.... )


    i mean d i brad maka change ko og new pasword anha na sa matrix keypad. then unsaon d i ni nako ang program.?

  5. #15

    Default Re: how to edit this program if u want to change the default password..

    Quote Originally Posted by kolz View Post
    Post the schematics ... its hard to understand where you assigned which ports to what peripheral and how its being connected, whether you have de-bouncing circuit built in or what keypad are you using. The LCD also has several varieties, are you using character based LCD's or graph based?

    Post lang schematics, ang importante if possible specs also of your LCD.

    Then that's the time masabtan nato imo program.

    Simple raman ni.

    Move the keyboard scanning logic into anther function which will read the keyboard input:

    Code:
    #define MAXPASSWORDLEN 6
    
    void scan_keyboard(unsigned char * read_data)
    {
        lcd_clr();                            //clear LCD
        delay(1000);                        //delay
        lcd_goto(0);                        //initial display
        send_string("PLEASE ENTER");        //Display "PLEASE ENTER" on lcd
        lcd_goto(20);                        //Display on 2nd line
        send_string("6-DIGIT PASSWORD");    //Display "6-DIGIT PASSWORD" on lcd
    
        
        while(1)
        {                                            //keypad scanning algorithm
                clearrow1();                        //Clear 1st output pin and set the others
                scancolumn1();                        //scan column 1-3
                clearrow2();                        //Clear 2nd output pin and set the others
                scancolumn2();                        //scan column
                clearrow3();                        //Clear 3rd output pin and set the others
                scancolumn3();                        //scan column
                clearrow4();                        //Clear 4th output pin and set the others
                
                
                if(password_count==MAXPASSWORDLEN)    
                {
                    password_count=0;
                    // transfer the password to buffer (input array), do this in a loop or copy byte by byte
                    // since std library for PIC is limited (no memcpy, etc.)
                    for (int i=0; i<MAXPASSWORDLEN; i++)  buffer[i] = keyin_char[i];
    
                    return; //break;
                }
            }
    }
    
    /* Checks the contents of passbuffer if it matches stalled_char, the stored password */
    bool check_password(unsigned char * passbuffer)
    {
         for (int i=0; i<MAXPASSWORDLEN; i++)
             if (passbuffer[i] != stalled_char[i]) return false;
    
         return true;
    }
    
    /* Ask the user for a new password and store it to stalled_char, the stored password */
    bool change_password()
    {
       // Instruct the user to input the old password
       unsigned char newpassword[6];
    
       scan_keyboard(&newpassword);
       for (int i=0; i<MAXPASSWORDLEN; i++)
           stalled_char[i] = newpassword[i]; // Store the new password
    }
    That is just a code snippet above, you do the rest.

    For storage of the password to persist (even after reboot/power off). You must have an external storage such as NVRAM
    or somewhere and store it there. I'm not sure if you use a PIC which already has an NVRAM storage (there should be). The
    last time I was working on PIC was more than 10 years ago (PIC16F84), that one has its own NVRAM storage which I forgot the offset address.

  6. #16

    Default Re: how to edit this program if u want to change the default password..

    Quote Originally Posted by kolz View Post
    Simple raman ni.

    Move the keyboard scanning logic into anther function which will read the keyboard input:

    Code:
    #define MAXPASSWORDLEN 6
    
    void scan_keyboard(unsigned char * read_data)
    {
        lcd_clr();                            //clear LCD
        delay(1000);                        //delay
        lcd_goto(0);                        //initial display
        send_string("PLEASE ENTER");        //Display "PLEASE ENTER" on lcd
        lcd_goto(20);                        //Display on 2nd line
        send_string("6-DIGIT PASSWORD");    //Display "6-DIGIT PASSWORD" on lcd
    
        
        while(1)
        {                                            //keypad scanning algorithm
                clearrow1();                        //Clear 1st output pin and set the others
                scancolumn1();                        //scan column 1-3
                clearrow2();                        //Clear 2nd output pin and set the others
                scancolumn2();                        //scan column
                clearrow3();                        //Clear 3rd output pin and set the others
                scancolumn3();                        //scan column
                clearrow4();                        //Clear 4th output pin and set the others
                
                
                if(password_count==MAXPASSWORDLEN)    
                {
                    password_count=0;
                    // transfer the password to buffer (input array), do this in a loop or copy byte by byte
                    // since std library for PIC is limited (no memcpy, etc.)
                    for (int i=0; i<MAXPASSWORDLEN; i++)  buffer[i] = keyin_char[i];
    
                    return; //break;
                }
            }
    }
    
    /* Checks the contents of passbuffer if it matches stalled_char, the stored password */
    bool check_password(unsigned char * passbuffer)
    {
         for (int i=0; i<MAXPASSWORDLEN; i++)
             if (passbuffer[i] != stalled_char[i]) return false;
    
         return true;
    }
    
    /* Ask the user for a new password and store it to stalled_char, the stored password */
    bool change_password()
    {
       // Instruct the user to input the old password
       unsigned char newpassword[6];
    
       scan_keyboard(&newpassword);
       for (int i=0; i<MAXPASSWORDLEN; i++)
           stalled_char[i] = newpassword[i]; // Store the new password
    }
    That is just a code snippet above, you do the rest.

    For storage of the password to persist (even after reboot/power off). You must have an external storage such as NVRAM
    or somewhere and store it there. I'm not sure if you use a PIC which already has an NVRAM storage (there should be). The
    last time I was working on PIC was more than 10 years ago (PIC16F84), that one has its own NVRAM storage which I forgot the offset address.

    thanks so much brad...by the way we are using PIC16F877A 40 pins brad.. ang amo LCD gi used brad ky 2x16. then 4x3 na keypad. MPLAB IDE among gamit na software. Thanks again....

  7. #17

    Default Re: how to edit this program if u want to change the default password..

    Quote Originally Posted by kolz View Post
    Simple raman ni.

    Move the keyboard scanning logic into anther function which will read the keyboard input:

    Code:
    #define MAXPASSWORDLEN 6
    
    void scan_keyboard(unsigned char * read_data)
    {
        lcd_clr();                            //clear LCD
        delay(1000);                        //delay
        lcd_goto(0);                        //initial display
        send_string("PLEASE ENTER");        //Display "PLEASE ENTER" on lcd
        lcd_goto(20);                        //Display on 2nd line
        send_string("6-DIGIT PASSWORD");    //Display "6-DIGIT PASSWORD" on lcd
    
        
        while(1)
        {                                            //keypad scanning algorithm
                clearrow1();                        //Clear 1st output pin and set the others
                scancolumn1();                        //scan column 1-3
                clearrow2();                        //Clear 2nd output pin and set the others
                scancolumn2();                        //scan column
                clearrow3();                        //Clear 3rd output pin and set the others
                scancolumn3();                        //scan column
                clearrow4();                        //Clear 4th output pin and set the others
                
                
                if(password_count==MAXPASSWORDLEN)    
                {
                    password_count=0;
                    // transfer the password to buffer (input array), do this in a loop or copy byte by byte
                    // since std library for PIC is limited (no memcpy, etc.)
                    for (int i=0; i<MAXPASSWORDLEN; i++)  buffer[i] = keyin_char[i];
    
                    return; //break;
                }
            }
    }
    
    /* Checks the contents of passbuffer if it matches stalled_char, the stored password */
    bool check_password(unsigned char * passbuffer)
    {
         for (int i=0; i<MAXPASSWORDLEN; i++)
             if (passbuffer[i] != stalled_char[i]) return false;
    
         return true;
    }
    
    /* Ask the user for a new password and store it to stalled_char, the stored password */
    bool change_password()
    {
       // Instruct the user to input the old password
       unsigned char newpassword[6];
    
       scan_keyboard(&newpassword);
       for (int i=0; i<MAXPASSWORDLEN; i++)
           stalled_char[i] = newpassword[i]; // Store the new password
    }
    That is just a code snippet above, you do the rest.

    For storage of the password to persist (even after reboot/power off). You must have an external storage such as NVRAM
    or somewhere and store it there. I'm not sure if you use a PIC which already has an NVRAM storage (there should be). The
    last time I was working on PIC was more than 10 years ago (PIC16F84), that one has its own NVRAM storage which I forgot the offset address.
    um..just want to ask if what command of MPLAB IDE to input a 6 digit password and save it through the use of 4x3 keypad.its like u want to input a new password for the user and save it through the 4x3 keypad..? thanks..

  8. #18

    Default Re: how to edit this program if u want to change the default password..

    Quote Originally Posted by arjea2490 View Post
    um..just want to ask if what command of MPLAB IDE to input a 6 digit password and save it through the use of 4x3 keypad.its like u want to input a new password for the user and save it through the 4x3 keypad..? thanks..
    There is no MPLAB IDE command, it doesn't matter if you code it through an IDE or a simple text editor. Inputing chars from your 4x3 keyboard is not done by the IDE, its done by your program code when you compile and download the executable to your PIC.

    The code snippet I gave already has a function called scan_keyboard() which is responsible for clearing the registers and reading the keys of your 4x3 keyboard through scancolumn1(), scancolumn2(), etc. I don't even know which registers and port addresses are used, i based it on the original code and schematics.

    Sabta usa ang program brod, especially how it relates to the the schematics.

  9. #19

    Default Re: how to edit this program if u want to change the default password..

    Quote Originally Posted by arjea2490 View Post
    um..just want to ask if what command of MPLAB IDE to input a 6 digit password and save it through the use of 4x3 keypad.its like u want to input a new password for the user and save it through the 4x3 keypad..? thanks..
    There is no MPLAB IDE command, it doesn't matter if you code it through an IDE or a simple text editor. Inputing chars from your 4x3 keyboard is not done by the IDE, its done by your program code when you compile and download the executable to your PIC.

    The code snippet I gave already has a function called scan_keyboard() which is responsible for clearing the registers and reading the keys of your 4x3 keyboard through scancolumn1(), scancolumn2(), etc. Each key pressed is stored in keyin_char buffer (which is global). From this you can deduce how to change the password in the change_password() function, all that needs to be done is replace the data contained in stalled_char buffer.

    I don't even know which registers and port addresses are used, i based it on the original code and schematics. I believe I had an error on the line:
    Code:
     for (int i=0; i<MAXPASSWORDLEN; i++)  read_data[i] = keyin_char[i]; //buffer[i] = keyin_char[i];
    Sabta usa ang program brod, especially how it relates to the the schematics. When we did this in USC-TC more than 10 years ago, we were doing it in assembly language, we don't have a luxury of a C compiler back then. But for you guys, since you have a C compiler already, its now very easy.

    Naa lang ko question, did you design the circuit schematics yourself?

  10.    Advertisement

Page 2 of 2 FirstFirst 12

Similar Threads

 
  1. Replies: 29
    Last Post: 02-26-2013, 02:49 PM
  2. how to edit this program using MPLAB IDE
    By arjea2490 in forum Programming
    Replies: 2
    Last Post: 05-17-2011, 07:25 AM
  3. Replies: 55
    Last Post: 08-04-2008, 09:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top