Hello guys,
I've a program which contains this code
and later it is used as
My question is why we used PB0, PB1 and PB2 instead of 0, 1 and 2 ??
doesn't the below code make more sense?
Please help, it's very urgent.
Thanks.
I've a program which contains this code
Rich (BB code):
#define rs PB0
#define rw PB1
#define en PB2
Rich (BB code):
void lcd_cmd(int x)
{
PORTB=x;
PORTB &= ~(1<<rs);
PORTB &= ~(1<<rw);
PORTB |= (1<<en);
_delay_ms(2);
PORTB &= ~(1<<en);
}
doesn't the below code make more sense?
Rich (BB code):
void lcd_cmd(int x)
{
PORTB=x;
PORTB &= ~(1<<0);
PORTB &= ~(1<<1);
PORTB |= (1<<2);
_delay_ms(2);
PORTB &= ~(1<<2);
}
Please help, it's very urgent.
Thanks.