I been reading through the data sheet and can't think of a way to code what i want done or if what i want to do will work, here is what i got.
So i have a simple button setup, and set the RB1 bin as input. When i power on the device i want the screen to read "XXXXXXXXXX" until the button is pressed 1 twice 3 times does not matter once its pressed at least once for the rest of the time i want to screen to read "YYYYYYYYYYYYYYY"
Ok so i know this probably looks bad but i am new to this so please bare with me.
First of all i think the problem is after the button is pressed will it just go back to the orginal XXXXX screen, I need it to read XXXXXX until the button has been pressed once then from THEN on only display the YYYYYYYY any ideas?
Also will this work for reading the buttons? or do i need some kind of interrupt, or some way of constnly reading the pin to see when the button has been pressed? please help any links or example code would be great!!
So i have a simple button setup, and set the RB1 bin as input. When i power on the device i want the screen to read "XXXXXXXXXX" until the button is pressed 1 twice 3 times does not matter once its pressed at least once for the rest of the time i want to screen to read "YYYYYYYYYYYYYYY"
Code:
#define B11 PORTBbits.RB1 // Buttons one
void main ( void ){
While (B11==1) {
LCD CODE HERE DISPLAY "XXXXXXXXXXX"
}
If (B11==0) {
LCD CODE HERE DISPLAY "YYYYYYYYYYYYY"
{
{
Ok so i know this probably looks bad but i am new to this so please bare with me.
First of all i think the problem is after the button is pressed will it just go back to the orginal XXXXX screen, I need it to read XXXXXX until the button has been pressed once then from THEN on only display the YYYYYYYY any ideas?
Also will this work for reading the buttons? or do i need some kind of interrupt, or some way of constnly reading the pin to see when the button has been pressed? please help any links or example code would be great!!
Last edited: