what (1<<LCRW) mean ?

Status
Not open for further replies.

koky

Full Member level 2
Joined
May 12, 2001
Messages
145
Helped
11
Reputation
22
Reaction score
8
Trophy points
1,298
Location
Italy
Activity points
1,097
I have found this source, but i don't understand why is used movlw (1<<LCRW)
what is the result ? why is not used a real value?

LCEN equ 1 ;rb1
LCRW equ 2; rb2
LCRS equ 3;rb3

tst_lcd_busy
movlw (1<<LCRW)
movwf PORTB
waitbusy
bsf PORTB,LCEN ; get hi-Nibble
rlf PORTB,w ; Busy-flag to Carry
bcf PORTB,LCEN
bsf PORTB,LCEN ; get lo-Nibble
bcf PORTB,LCEN
btfsc STATUS,C ;
goto waitbusy ;
return
 

Hi Koky,
I may be wrong here, but, are you sure that is not (LCRW<<1) which means shift reg defined as LCRW (2) left one bit?
Regards,
Robert
 

is : movlw (1<<LCRW)

and the software work, but i don't like use sw with strange assembler, i prefer rewrite it in more readable system
 

THIS IS A PROGRAMED SHIFT.Shift 1 left for a value writed in LCRW.It is a common use in a IAR C compiler.
EG: /* Enable receiver and transmitter */
UCSR0B = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSR0C = (1<<USBS)|(3<<UCSZ0);
}



Greetings
Dragan
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…