Download Print this page

NEX ROBOTICS Fire Bird V ATMEGA2560 Software Manual page 90

Robotic research platform
Hide thumbs Also See for Fire Bird V ATMEGA2560:

Advertisement

NEX Robotics
The data bus is bidirectional, 4 bit wide and is connected to PC4 to PC7 of the microcontroller.
The MSB bit (DB7) of data bus is also used as a Busy flag. When the Busy flag is 1, the LCD is
in internal operation mode, and the next instruction will not be accepted. When RS = 0 and R/W
= 1, the Busy flag is output on DB7. The next instruction must be written after ensuring that the
busy flag is 0.
We are using LCD in 4-bit mode. In the 4-bit mode the data is sent in nibbles with higher nibble
sent first followed by the lower nibble. Initialization of LCD in 4-bit mode is done only after
setting the LCD for 4-bit mode. LCD reset sequence include following steps.
1. Wait for about 20ms.
2. Send the first value 0x30.
3. Wait for about 10ms.
4. Send the second value 0x30.
5. Wait for about 1ms.
6. Send the third value 0x30.
7. Wait for about 1ms.
8. Send 0x20 for selecting 4-bit mode.
9. Wait for 1ms.
Before we can display any data on the LCD we need to initialize the LCD for proper operation.
The first instruction we send must tell the LCD that we will be communicating with it using 4-bit
data bus. Remember that the RS line must be low if we are sending a command to the LCD. In
the second and third instruction we clear and reset the display of the LCD. The fourth instruction
sets the display and cursor ON. In fifth instruction we place the cursor at the start. Check the
lcd_init( ) function to see how all this is put in code.
The function lcd_reset() and lcd_init completes the initialization of LCD in 4-bit mode. Now
following steps are followed to send the command/data in 4-bit mode.
1. Mask lower 4-bits.
2. Send command/data to the LCD port.
3. Send enable signal to EN pin.
4. Mask higher 4-bits.
5. Shift bits left by 4 positions (to bring lower bits to upper bits position).
6. Send command/data to the LCD port.
7. Send enable signal to EN pin.
The function lcd_wr_command() and lcd_wr_char() are for sending the command and data
respectively to the LCD.
For using the busy flag (polling method) the LCD is read in the similar way, i.e. nibble by nibble,
here we are not using the polling method and instead we are providing the necessary delay
between the commands.
www.nex-robotics.com
Fire Bird V Software Manual
90

Advertisement

loading
Need help?

Need help?

Do you have a question about the Fire Bird V ATMEGA2560 and is the answer not in the manual?

Subscribe to Our Youtube Channel