One Person
Newbie level 2
Hi all
I should implement a program using C language to sample the LDR and potentiometer values I faced a problem when I want to select the sampling time on the LCD I write an if statement so if RB6 is pressed the sampling time should be moved from 1 to 10 and when I release the button the selected value should appear on the LCD I enabled the RBIE (Bits 4-7 in portB interrupt) because I should use it in a part of the program.
The problem is that the sampling time keeps moving on the LCD even if I did not press RB6 I used RB7 to check and it is work fine (sampling time move when I press RB7 and stop when I release it) does anyone have an idea why the same code work with RB7 but does not work with RB6?
if (RB6==1)
{
del(1);
x++; // Counter for holding the sampling time value
if(x>10)
x=1;
}
Best Regards
I should implement a program using C language to sample the LDR and potentiometer values I faced a problem when I want to select the sampling time on the LCD I write an if statement so if RB6 is pressed the sampling time should be moved from 1 to 10 and when I release the button the selected value should appear on the LCD I enabled the RBIE (Bits 4-7 in portB interrupt) because I should use it in a part of the program.
The problem is that the sampling time keeps moving on the LCD even if I did not press RB6 I used RB7 to check and it is work fine (sampling time move when I press RB7 and stop when I release it) does anyone have an idea why the same code work with RB7 but does not work with RB6?
if (RB6==1)
{
del(1);
x++; // Counter for holding the sampling time value
if(x>10)
x=1;
}
Best Regards