fantabulous68
Junior Member level 2
how to enter in switch
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.
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:
main()
{
int i;
TRISB= 0xFF;
i=0;
j=9;
while (1) {
//wait for press
while (RB6); // loop (1)
DelayMs (30); //debounce
//wait for release
while (!RB6); //loop(2)
DelayMs(30); //debounce
i++;
//wait for press
while (RB4); // loop (1)
DelayMs (30); //debounce
//wait for release
while (!RB4); //loop(2)
DelayMs(30); //debounce
j--;
}
how do i combine those digits to use as a numerical number in another function, shud i use a concatination function?