Picdem™ 17 demonstration board user’s guide – Arizona Picdem 17 User Manual

Page 52

Advertising
background image

PICDEM™ 17 Demonstration Board User’s Guide

DS39024B-page 46

2001 Microchip Technology Inc.

E_PIN = 1;

// Clock cmd in

DelayFor18TCY();

E_PIN = 0;

#endif

#ifdef BIT8

// 8-bit interface

TRIS_DATA_PORT = 0xff;// Make data port input

#else

// 4-bit interface

#ifdef UPPER

// Upper nibble

interface

TRIS_DATA_PORT |= 0xf0;

// Make data nibble

input

#else

// Lower nibble

interface

TRIS_DATA_PORT |= 0x0f;

// Make data nibble

input

#endif

#endif

// Set data interface width, # lines, font

while(BusyXLCD());

// Wait if LCD busy

WriteCmdXLCD(lcdtype);

// Function set cmd

// Turn the display on then off

while(BusyXLCD());

// Wait if LCD busy

WriteCmdXLCD(DOFF&CURSOR_OFF&BLINK_OFF);// Display OFF/Blink

OFF

while(BusyXLCD());

// Wait if LCD busy

WriteCmdXLCD(DON&CURSOR_ON&BLINK_ON);// Display ON/Blink ON

// Clear display

while(BusyXLCD());

// Wait if LCD busy

WriteCmdXLCD(0x01);

// Clear display

// Set entry mode inc, no shift

while(BusyXLCD());

// Wait if LCD busy

WriteCmdXLCD(SHIFT_CUR_LEFT);// Entry Mode

// Set DD Ram address to 0

while(BusyXLCD());

// Wait if LCD busy

SetDDRamAddr(0);

// Set Display data

ram address to 0

return;

}

/

*******************************************************************

*

* Function Name:

WriteCmdXLCD

* Return Value:

void

* Parameters:

cmd: command to send to LCD

* Description:

This routine writes a command to the Hitachi

*

HD44780 LCD controller. The user must check

*

to see if the LCD controller is busy before

*

calling this routine.

*******************************************************************

*/

void WriteCmdXLCD(static unsigned char cmd)

Advertising