Kryten
New Member
So I got the LCD rutine up and working (Thanks 3v0)
I need som help with putting a "couter" or two buttons (one for increase and one for decrease)
I know something is wrong but not what..
And I Know that I might have declared "a" wrong
I need som help with putting a "couter" or two buttons (one for increase and one for decrease)
Code:
void main (void)
{
int a;
a = 1;
// setup PORTA for all digital IO
CMCON0 = 0x07;
ANSEL = 0x00;
TRISA = 0b000110000;
lcd_init();
lcd_goto(0x05); // select first line
lcd_puts("LCD ");
lcd_goto(0x43);// Select second line
lcd_puts("Test");
vait_1_sec ();
lcd_clear ();
lcd_goto(0x02);
lcd_puts ("Press button");
lcd_goto(0x40);
lcd_puts("Count:");
while(1);
{
lcd_goto(0x48);
if (1 == RA4)
{
a = (a + 1);
lcd_puts(a);
}
else if ( 1 == RA5)
{
a = (a - 1);
lcd_puts(a);
}
}
}
I know something is wrong but not what..
And I Know that I might have declared "a" wrong
Last edited: