User manual
dsPICDEM™ 2.0
DEVELOPMENT BOARD
USER’S GUIDE
© 2005 Microchip Technology Inc. Advance Information DS51558A-page 103
Appendix B. Writing to LCD
B.1 OVERVIEW
A 2x16 ASCII-text LCD is provided on the dsPICDEM2 Development Board. dsPIC30F
devices installed on the dsPICDEM2 development board may use this LCD to display
characters. The interface to the LCD is via a 2-wire Serial Peripheral Interface (SPI™).
dsPIC30F devices may send serial clock and data signals on 2 pins to the
dsPIC30F2011 device that controls the 2x16 LCD.
B.2 LCD HARDWARE SETUP
To enable communication between your dsPIC30F device and the dsPIC30F2011 LCD
controller, simply jumper the appropriate pair of pins on the header H1.For example, in
order to enable communication between the dsPIC30F2010 device and the LCD,
jumpers on the pin-pair labelled “M28” need to be installed on header H1.
B.3 LCD SOFTWARE SPECIFICATION
The following power-up sequence should be observed by the user's application
firmware when writing characters to the LCD:
1. After any reset operation wait 500 milliseconds to allow the LCD to begin normal
operation. The cursor on the LCD will be positioned at the top row on the
left-most column.
2. Configure SPI1 module on your dsPIC30F device to operate in 8-bit Master
mode. The serial clock may be set for any frequency up to 1 MHz.
3. To write an ASCII character to the LCD at the location pointed to by the cursor,
load the SPIBUF register with the ASCII character byte.
4. After the character is displayed on the LCD, the cursor is automatically relocated
to the next position on the LCD.
5. To reposition the cursor to another column on any of the two rows, write the
address of the desired location to the SPIBUF register. Addresses in the first row
of the LCD range from 0x80 to 0x8F, while addresses on the second row range
from 0xC0 through 0xCF.
6. After 16 characters are written to the first row on the LCD, it is necessary for the
user's application to write the address 0xC0 of the second row to the SPIBUF in
order to roll the cursor over to the second row.
7. The user application must wait for a minimum of 5 milliseconds between writing
two successive characters in the first row of the LCD.
8. The user application must wait for a minimum of 250 microseconds after writing
an address byte.
9. The user application must wait for a minimum of 250 microseconds between
writing two successive characters in the second row of the LCD.