USER INTERFACE:1 enter/settings switch,2switches->2digit value,LCD

Discussion in 'Embedded Systems and Microcontrollers' started by fantabulous68, Aug 29, 2009.

  1. fantabulous68

    Thread Starter Active Member

    Nov 3, 2007
    51
    4
    I want to create a user interface using C programming for a pic microcontroller-see attached picture.

    It will have 3 pushbutton switches. It will allow the user to enter a 2 digit value:

    1.enter/settings switch

    2.increase digit from 0 to 9

    3.decrease digit from 9 to 0


    If the user pushes the settings button then the user will go to a settings screen. The user can then select a 2 digit value EG. 99 or 34. The user can use the increase button to increase the first digit from 0 to 9 and 0 to 9 again. The first digit will be displayed on the LCD whilst the user is increasing. Thereafter the user can use the decrease button to decrease the second digit from 9 to 0 and 9 to 0 again. The second digit will be displayed on the LCD whilst the user is decreasing. So now the user has decided on a 2 digit value and wants to use this value in another function so the user presses ENTER and leaves the Settings screen.

    Any1 with any useful ideas to approach this.

    Code ( (Unknown Language)):
    1. main()
    2. {
    3.  
    4. int i;
    5. TRISB= 0xFF;
    6.  
    7. i=0;
    8. j=9;
    9. while (1) {
    10.      //wait for press
    11.  
    12.      while (RB6);        // loop  (1)
    13.      DelayMs (30);                //debounce
    14.      
    15.      //wait for release  
    16.      
    17.      while (!RB6);      //loop(2)
    18.      DelayMs(30);        //debounce
    19.      i++;
    20.  
    21.  
    22.      //wait for press
    23.  
    24.      while (RB4);        // loop  (1)
    25.      DelayMs (30);                //debounce
    26.      
    27.      //wait for release  
    28.      
    29.      while (!RB4);      //loop(2)
    30.      DelayMs(30);        //debounce
    31.      j--;
    32.  
    33. }

     
    Last edited: Aug 29, 2009
Loading...