void initLCD(void) { // PMP initialization mPMPOpen(PMP_ON | PMP_READ_WRITE_EN | 3, PMP_DATA_BUS_8 | PMP_MODE_MASTER1 | PMP_WAIT_BEG_4 | PMP_WAIT_MID_15 | PMP_WAIT_END_4, 0x0001, // only PMA0 enabled PMP_INT_OFF); // no interrupts used // wait for >30ms delayTimer1(9375); //initiate the HD44780 display 8-bit init sequence PMPSetAddress(LCDCMD); // select command register PMPMasterWrite(0x38); // 8-bit int, 2 lines, 5x7 delayTimer1(15); PMPMasterWrite(0x0c); // ON, no cursor, no blink delayTimer1(15); PMPMasterWrite(0x01); // clear display delayTimer1(563); PMPMasterWrite(0x06); // increment cursor, no shift delayTimer1(563); }
/********************************************************************* * Function: * * PreCondition: * * Input: * * Output: * * Side Effects: * * Overview: * * Note: ********************************************************************/ inline void __attribute__((always_inline)) Ex16LCDCmd(BYTE cmd, UINT wait) { PMPSetAddress(0x0000); PMPMasterWrite(cmd); MSTimerWait(wait); }
void PMP_Write(CPU_INT16U address, CPU_INT08U data) { #ifdef _TARGET_440H #else PMPSetAddress(address); PMPMasterWrite(data); #endif }
void vLCDTFTWriteData(UINT16 Data){ mPORTGSetBits(LCD_PIN_RS); mPORTDClearBits(LCD_PIN_CS); mPORTDClearBits(LCD_PIN_WR); PMPMasterWrite(Data); mPORTDSetBits(LCD_PIN_WR); mPORTDSetBits(LCD_PIN_CS); }
// LCD initialization sequence void initializeLCD(void) { mPMPOpen(CONTROL, MODE, PORT, INTERRUPT); // Initialize PMP using above settings // PMCON = 0x83BF; // Enable the PMP, long waits //PMMODE = 0x3FF; // Master Mode 1 //PMAEN = 0x0001; // PMA0 enabled OpenTimer1(CONFIG, PERIOD); // Enable Timer 1 Delay_ms(30); // LCD needs 30ms to power on, perform startup functions, etc PMPSetAddress(CMDREG); // Access the LCD command register PMPMasterWrite(0x38); // LCD Function Set - 8-bit interface, 2 lines, 5*7 Pixels Delay_ms(1); // Needs a 40us delay to complete PMPMasterWrite(0x0C); // Turn on display (with cursor hidden) Delay_ms(1); // Needs a 40us delay to complete PMPMasterWrite(0x01); // Clear the display Delay_ms(2); // Needs a 1.64ms delay to complete PMPMasterWrite(0x06); // Set text entry mode - auto increment, no shift Delay_ms(1); // Needs a 40us delay to complete }
//Writes byte to selected page void lcdWrite(uint8_t page, uint8_t column) { // make sure column and page are within bounds page %= 9; column %= 128; // set column MSB lcdCommand(0x10 | ((127 - column) >> 4)); // set column LSB lcdCommand(0x0F & (127 - column)); // set page lcdCommand(0xB0 |(0x0F & (7-page))); //Data write PMPSetAddress(1); PMPMasterWrite( display[page][column] ); //Reverse Vertical Axis }
/********************************************************************* * Function: * * PreCondition: * * Input: * * Output: * * Side Effects: * * Overview: * * Note: ********************************************************************/ inline void __attribute__((always_inline)) Ex16LCDPutChar(BYTE data) { PMPSetAddress(0x0001); PMPMasterWrite(data); MSTimerWait(2); // wait 1ms }
static void prvLCDData( char cChar ) { PMPSetAddress( LCD_DATA_ADDRESS ); PMPMasterWrite( cChar ); vTaskDelay( lcdVERY_SHORT_DELAY ); }
static void prvLCDCommand( char cCommand ) { PMPSetAddress( LCD_COMMAND_ADDRESS ); PMPMasterWrite( cCommand ); vTaskDelay( lcdSHORT_DELAY ); }
// Write a byte of data to either of the two LCD registers (DATAREG, CMDREG) void writeToLCD(int reg, char c) { Delay_ms(1); // 40us needed in between each character write PMPSetAddress(reg); // Select either 'DATAREG' or 'CMDREG' PMPMasterWrite(c); // Write the byte to selected register }
void writeLCD(int addr, char c) { while (busyLCD()); // wait for LCD ready PMPSetAddress(addr); // select register PMPMasterWrite(c); // init write sequence }