Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Masking in 8051(4 bit LCD Interfacing)

Status
Not open for further replies.

vinothksr08

Member level 3
Joined
Jun 18, 2013
Messages
66
Helped
7
Reputation
14
Reaction score
7
Trophy points
8
Location
Tamilnadu, India
Activity points
367
hello

What is the use of masking of bits in 8051..? Without masking can i do program for 4 bit LCD in 8051?

help me,
thanks in advance
 

masking is a common concept not only used in keypad 8051... It means that taking the required bits in a byte...

consider you need the LSB in port0 means

A = P0 & 0x01 is the masking..
It will give whatever the LSB is...
 

Code:
Masking is the act of applying a mask to a value. This is accomplished by doing:

    Bitwise ANDing in order to extract a subset of the bits in the value
    Bitwise ORing in order to set a subset of the bits in the value
    Bitwise XORing in order to toggle a subset of the bits in the value

Below is an example of extracting a subset of the bits in the value:

Mask:   00001111b
Value:  01010101b

Applying the mask to the value means that we want to clear the first (higher) 4 bits, and keep the last (lower) 4 bits. Thus we have extracted the lower 4 bits. The result is:

Mask:   00001111b
Value:  01010101b
Result: 00000101b
 
The use of masking can be in a scenario where you have connected two or more devices onto a single port.

As you asked about the LCD case, why mask 4 bits and doesn't it work without masking..?
The answer is it will depend on the connections. We use 4-bit mode to reduce the no. of pins used, and then if you connect some other device to the remaining pins of that port, you have to be careful not to sent data to the incorrect pins.
So better mask the pins where the LCD is not connected.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top