cD3DXFont::cD3DXFont(LPDIRECT3DDEVICE9 theDevice, HINSTANCE hInstance, LPCSTR theFontname) // Constructor { if(FAILED(createCustomFont( hInstance, theFontname))) { OutputDebugString("Error: Cannot create Custom Font!"); } else if(FAILED(createDXFont( theDevice ))) { OutputDebugString("Error: Cannot create DX Font!"); } }
void lcd_init() // Works like a constructor { // Power on delay lcd_direction |= 0xfc; // set port a as output lcd_wait( 20000 ); // Power on wait lcd_wait( 20000 ); lcd_port &= ~((1<<lcd_E) | (1<<lcd_RS)); // EN=0, RS=0 // lcd_port &= ~(1<<lcd_RW); // Set RW = 0 in case it is connected lcd_nibble_transfer(SET_FUNCTION+IN8_BIT); //lcd_wait(longdelay ); // wait 24 ms _delay_ms(24); lcd_nibble_transfer(SET_FUNCTION+IN8_BIT); //lcd_wait(longdelay); _delay_ms(24); lcd_nibble_transfer(SET_FUNCTION+IN8_BIT); //lcd_wait(longdelay); _delay_ms(24); lcd_nibble_transfer(SET_FUNCTION); // lcd_wait(longdelay); _delay_ms(24); lcd_cmd_write(SET_FUNCTION+LN2_BIT); // Function set: 0x28 2 lines // lcd_wait(WAIT_15m); // Wait 39 uS _delay_ms(2); lcd_cmd_write(SET_DISPLAY); //display off //lcd_wait(WAIT_15m); _delay_ms(2); lcd_cmd_write(CLR_DISPLAY); // Display clear: 0x01 clear data // lcd_wait(WAIT_15m); // 1.53 mS _delay_ms(2); lcd_cmd_write(SET_ENTRY_MODE+INC_BIT); // +INC_BIT // Entry mode set: shift cursor 1 position to right // lcd_wait(WAIT_15m); _delay_ms(2); lcd_cmd_write(SET_DISPLAY+ON_BIT+CUR_BIT+BLK_BIT); //+CUR_BIT+BLK_BIT); Display ON/OFF control: 0x0f // lcd_wait(WAIT_15m); // Wait 39 uS // 1.53 mS //lcd_wait(WAIT_15m); // 1.53 mS _delay_ms(2); createCustomFont(); _delay_ms(2); lcd_cmd_write(RTN_HOME); } // end lcd_init()