![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| I have written some code which works but the 2nd line of the display does not work. I have made sure ive set the lcd to be in 2line mode and set the correct 5x8 font but i just cant get any text come up. However i can get the cursor to flash on that line. heres my setup routine: Code: INIT CLRF LCD_CTRL CALL DELAYSTART ;delay 30ms MOVLW 0X38 ;set disp as 2line 5x8 font MOVWF LCD_DATA CALL ENABLE CALL DELAY40 ;delay 45us MOVLW 0X0F ;set disp on with blinking cursor MOVWF LCD_DATA CALL ENABLE CALL DELAY40 ;40us delay CALL CLRDISP ;clear disp RETURN im totally stuck here. | |
| |
| | (permalink) |
| Second line starts on address 0x40 on a hd44780 lcd... so any letters beyond the end of line 1 do not emmidiately begin at line 2 | |
| |
| | (permalink) | |
| Quote:
The actual memory in a smaller LCD is still actually 2x40, and the LCD has commands to scroll along this 40 character wide buffer if you want. | ||
| |
| | (permalink) |
| Yeah i realise that and my program actually writes the first line, then it goes back into command mode, writes the new cursor location (40h for this display), then it goes back into data mode and starts writing the second line. Probem is the second line never shows. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Th weird thing is I if i start writing a whole bunch of characters on the first line eventually the counter in the lcd will hit 40h and start writing perfectly on the second line. This is the bit in my program where is changes lines: Code: BCF PORTA,0 ;Set RS Line low (command) MOVLW 0X40 ;Set DDram address in W CALL SENDDATA ;move data in W to lcd data lines and strobe enable line BSF PORTA,0 ;Set RS Line back to high ready for next character Ive checked everything else, ive made the delays a bit longer to be sure, the only other thing i can think of is there are these commands in the datasheet which i havent used. They are 'cursor or display shift' and 'set DDRAM address'. | |
| |
| | (permalink) |
| Wait, dont worry ive worked it out now. For some reason the DDRAM address table on my datasheet goes from 00 - 4F but i found another datasheet which goes from 80 - CF. I dont get that at all. | |
| |