Fixed timing issues, working again

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
Collin J. Doering 2015-09-30 05:02:43 -04:00
parent 047c4b5c31
commit 3ba737fc7b
2 changed files with 15 additions and 11 deletions

View File

@ -163,7 +163,8 @@ void initLCD (void) {
softwareLCDInitPulse();
// Function set (2 lines with 5x7 dot character font)
writeLCDInstr_(0x38); // RS=RW=0, 0b00111000, 0x38
// RS=RW=0, DBUS=b00111000,0x38
writeLCDInstr_(INSTR_FUNC_SET | (1 << INSTR_FUNC_SET_DL) | (1 << INSTR_FUNC_SET_N));
/* BF now can be checked */
@ -171,13 +172,16 @@ void initLCD (void) {
writeLCDInstr_(INSTR_DISPLAY); // Display off
_delay_us(LCD_GENERIC_INSTR_DELAY);
writeLCDInstr_(CMD_CLEAR_DISPLAY); // Clear display
// Clear display
writeLCDInstr_(CMD_CLEAR_DISPLAY);
_delay_us(LCD_CLEAR_DISPLAY_DELAY);
writeLCDInstr_(0x06); // Increment mode, no shift
// Increment mode, no shift
writeLCDInstr_(INSTR_ENTRY_SET | (1 << INSTR_ENTRY_SET_ID));
_delay_us(LCD_GENERIC_INSTR_DELAY);
writeLCDInstr_(0x0E); // Display on, cursor on, blink off
// Display on, cursor on, blink off
writeLCDInstr_(INSTR_DISPLAY | (1 << INSTR_DISPLAY_D) | (1 << INSTR_DISPLAY_C));
_delay_us(LCD_GENERIC_INSTR_DELAY);
flashLED(5); // DEBUG

View File

@ -50,8 +50,8 @@
//#define FOUR_BIT_MODE
// LCD delays (in microseconds when unspecified)
#define LCD_DELAY 1
#define LCD_INIT_DELAY0 30 // milliseconds
#define LCD_DELAY 25
#define LCD_INIT_DELAY0 15 // milliseconds
#define LCD_INIT_DELAY1 8200
#define LCD_INIT_DELAY2 200
@ -68,14 +68,14 @@
// Entry Set instruction and associated options
#define INSTR_ENTRY_SET 0x04
#define INSTR_ENTRY_SET_ID 0x02
#define INSTR_ENTRY_SET_S 0x01
#define INSTR_ENTRY_SET_ID 1
#define INSTR_ENTRY_SET_S 0
// Display control instruction and associated options
#define INSTR_DISPLAY 0x08
#define INSTR_DISPLAY_D 0x04
#define INSTR_DISPLAY_C 0x02
#define INSTR_DISPLAY_B 0x01
#define INSTR_DISPLAY_D 2
#define INSTR_DISPLAY_C 1
#define INSTR_DISPLAY_B 0
// Cursor or display shift instruction and associated options
#define INSTR_MOV_SHIFT 0x10